2011-06-18 Dimitri Glazkov <dglazkov@chromium.org>
authordglazkov@chromium.org <dglazkov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 19 Jun 2011 17:00:27 +0000 (17:00 +0000)
committerdglazkov@chromium.org <dglazkov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 19 Jun 2011 17:00:27 +0000 (17:00 +0000)
        Reviewed by Darin Adler.

        Separate concerns of loading file icons and choosing files.
        https://bugs.webkit.org/show_bug.cgi?id=62931

        Loading an icon and choosing files have similar async nature, but completely different
        lifetimes: FileChooser should only exist when we are actually attempting to choose a file,
        not anytime we need to render an input with a proper icon.

        This patch introduces FileIconLoader, a separate abstraction for loading an icon, and removes
        any notion of an icon from the FileChooser.

        Also, the loaded icon is now stored on the RenderFileUploadControl, which better matches its
        purpose.

        Refactoring, covered by existing tests.

        * CMakeLists.txt: Added FileIconLoader to build system.
        * GNUmakefile.list.am: Ditto.
        * WebCore.exp.in: Updated.
        * WebCore.gypi: Added FileIconLoader to build system.
        * WebCore.pro: Ditto.
        * WebCore.vcproj/WebCore.vcproj: Ditto.
        * WebCore.xcodeproj/project.pbxproj: Ditto.
        * loader/EmptyClients.h: Updated.
        (WebCore::EmptyChromeClient::loadIconForFiles): Renamed function to better reflect what it does.
        * page/Chrome.cpp:
        (WebCore::Chrome::loadIconForFiles): Ditto.
        * page/Chrome.h: Ditto.
        * page/ChromeClient.h: Ditto.
        * platform/FileChooser.cpp:
        (WebCore::FileChooser::FileChooser): Removed now-unnecessary bool.
        (WebCore::FileChooser::create): Removed the tangled web.
        (WebCore::FileChooser::clear): Removed icon-related code.
        (WebCore::FileChooser::chooseFiles): Ditto.
        * platform/FileChooser.h:
        * platform/FileIconLoader.cpp: Copied from Source/WebCore/platform/FileChooser.cpp.
        (WebCore::FileIconLoaderClient::~FileIconLoaderClient): Added.
        (WebCore::FileIconLoader::create): Added.
        (WebCore::FileIconLoader::disconnectClient): Added.
        (WebCore::FileIconLoader::notifyFinished): Added.
        (WebCore::FileIconLoader::FileIconLoader): Added.
        * platform/FileIconLoader.h: Copied from Source/WebCore/platform/FileChooser.cpp.
        * rendering/RenderFileUploadControl.cpp:
        (WebCore::RenderFileUploadControl::RenderFileUploadControl): Added new member initializations.
        (WebCore::RenderFileUploadControl::~RenderFileUploadControl): Added FileIconLoader disconnect.s
        (WebCore::RenderFileUploadControl::requestIcon): Added a helper.
        (WebCore::RenderFileUploadControl::valueChanged): Changed to request an icon load.
        (WebCore::RenderFileUploadControl::updateRendering): Added implementation of FileIconLoaderClient func.
        (WebCore::RenderFileUploadControl::updateFromElement): Added clearing of icon.
        (WebCore::RenderFileUploadControl::maxFilenameWidth): Changed to use new member directly.
        (WebCore::RenderFileUploadControl::paintObject): Ditto.
        (WebCore::RenderFileUploadControl::fileTextValue): Ditto.
        * rendering/RenderFileUploadControl.h: Updated decls.
2011-06-18  Dimitri Glazkov  <dglazkov@chromium.org>

        Reviewed by Darin Adler.

        Separate concerns of loading file icons and choosing files.
        https://bugs.webkit.org/show_bug.cgi?id=62931

        * src/ChromeClientImpl.cpp:
        (WebKit::ChromeClientImpl::loadIconForFiles): Renamed to better reflect the intent.
        * src/ChromeClientImpl.h: Ditto.
        * src/WebIconLoadingCompletionImpl.cpp:
        (WebKit::WebIconLoadingCompletionImpl::WebIconLoadingCompletionImpl): Changed to use FileIconLoader.
        (WebKit::WebIconLoadingCompletionImpl::didLoadIcon): Ditto.
        * src/WebIconLoadingCompletionImpl.h: Dito.
2011-06-18  Dimitri Glazkov  <dglazkov@chromium.org>

        Reviewed by Darin Adler.

        Separate concerns of loading file icons and choosing files.
        https://bugs.webkit.org/show_bug.cgi?id=62931

        * WebCoreSupport/ChromeClientEfl.cpp:
        (WebCore::ChromeClientEfl::loadIconForFiles): Renamed.
        * WebCoreSupport/ChromeClientEfl.h:
2011-06-18  Dimitri Glazkov  <dglazkov@chromium.org>

        Reviewed by Darin Adler.

        Separate concerns of loading file icons and choosing files.
        https://bugs.webkit.org/show_bug.cgi?id=62931

        * WebCoreSupport/ChromeClientGtk.cpp:
        (WebKit::ChromeClient::loadIconForFiles): Renamed.
        * WebCoreSupport/ChromeClientGtk.h:
2011-06-18  Dimitri Glazkov  <dglazkov@chromium.org>

        Reviewed by Darin Adler.

        Separate concerns of loading file icons and choosing files.
        https://bugs.webkit.org/show_bug.cgi?id=62931

        * WebCoreSupport/ChromeClientHaiku.cpp:
        (WebCore::ChromeClientHaiku::loadIconForFiles): Renamed.
        * WebCoreSupport/ChromeClientHaiku.h:
2011-06-18  Dimitri Glazkov  <dglazkov@chromium.org>

        Reviewed by Darin Adler.

        Separate concerns of loading file icons and choosing files.
        https://bugs.webkit.org/show_bug.cgi?id=62931

        * WebCoreSupport/WebChromeClient.h:
        * WebCoreSupport/WebChromeClient.mm:
        (WebChromeClient::loadIconForFiles): Renamed.
2011-06-18  Dimitri Glazkov  <dglazkov@chromium.org>

        Reviewed by Darin Adler.

        Separate concerns of loading file icons and choosing files.
        https://bugs.webkit.org/show_bug.cgi?id=62931

        * WebCoreSupport/ChromeClientQt.cpp:
        (WebCore::ChromeClientQt::loadIconForFiles): Renamed.
        * WebCoreSupport/ChromeClientQt.h:
2011-06-18  Dimitri Glazkov  <dglazkov@chromium.org>

        Reviewed by Darin Adler.

        Separate concerns of loading file icons and choosing files.
        https://bugs.webkit.org/show_bug.cgi?id=62931

        * WebCoreSupport/WebChromeClient.cpp:
        (WebChromeClient::loadIconForFiles): Renamed.
        * WebCoreSupport/WebChromeClient.h:
2011-06-18  Dimitri Glazkov  <dglazkov@chromium.org>

        Reviewed by Darin Adler.

        Separate concerns of loading file icons and choosing files.
        https://bugs.webkit.org/show_bug.cgi?id=62931

        * WebCoreSupport/ChromeClientWinCE.cpp:
        (WebKit::ChromeClientWinCE::loadIconForFiles): Renamed.
        * WebCoreSupport/ChromeClientWinCE.h:
2011-06-18  Dimitri Glazkov  <dglazkov@chromium.org>

        Reviewed by Darin Adler.

        Separate concerns of loading file icons and choosing files.
        https://bugs.webkit.org/show_bug.cgi?id=62931

        * WebKitSupport/ChromeClientWx.cpp:
        (WebCore::ChromeClientWx::chooseIconForFiles): Renamed.
        * WebKitSupport/ChromeClientWx.h:
2011-06-18  Dimitri Glazkov  <dglazkov@chromium.org>

        Reviewed by Darin Adler.

        Separate concerns of loading file icons and choosing files.
        https://bugs.webkit.org/show_bug.cgi?id=62931

        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
        (WebKit::WebChromeClient::loadIconForFiles): Renamed.
        * WebProcess/WebCoreSupport/WebChromeClient.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@89216 268f45cc-cd09-0410-ab3c-d52691b4dbfc

51 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.pro
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/loader/EmptyClients.h
Source/WebCore/page/Chrome.cpp
Source/WebCore/page/Chrome.h
Source/WebCore/page/ChromeClient.h
Source/WebCore/platform/FileChooser.cpp
Source/WebCore/platform/FileChooser.h
Source/WebCore/platform/FileIconLoader.cpp [new file with mode: 0644]
Source/WebCore/platform/FileIconLoader.h [new file with mode: 0644]
Source/WebCore/rendering/RenderFileUploadControl.cpp
Source/WebCore/rendering/RenderFileUploadControl.h
Source/WebCore/svg/graphics/SVGImage.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/ChromeClientImpl.cpp
Source/WebKit/chromium/src/ChromeClientImpl.h
Source/WebKit/chromium/src/WebIconLoadingCompletionImpl.cpp
Source/WebKit/chromium/src/WebIconLoadingCompletionImpl.h
Source/WebKit/efl/ChangeLog
Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp
Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.h
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h
Source/WebKit/haiku/ChangeLog
Source/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.cpp
Source/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebChromeClient.h
Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp
Source/WebKit/win/WebCoreSupport/WebChromeClient.h
Source/WebKit/wince/ChangeLog
Source/WebKit/wince/WebCoreSupport/ChromeClientWinCE.cpp
Source/WebKit/wince/WebCoreSupport/ChromeClientWinCE.h
Source/WebKit/wx/ChangeLog
Source/WebKit/wx/WebKitSupport/ChromeClientWx.cpp
Source/WebKit/wx/WebKitSupport/ChromeClientWx.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h

index 219206a..6806854 100644 (file)
@@ -1025,6 +1025,7 @@ SET(WebCore_SOURCES
     platform/DragData.cpp
     platform/DragImage.cpp
     platform/FileChooser.cpp
+    platform/FileIconLoader.cpp
     platform/FileSystem.cpp
     platform/GeolocationService.cpp
     platform/KURL.cpp
index c3c43f0..b1cd35a 100644 (file)
@@ -1,3 +1,60 @@
+2011-06-18  Dimitri Glazkov  <dglazkov@chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Separate concerns of loading file icons and choosing files.
+        https://bugs.webkit.org/show_bug.cgi?id=62931
+
+        Loading an icon and choosing files have similar async nature, but completely different
+        lifetimes: FileChooser should only exist when we are actually attempting to choose a file,
+        not anytime we need to render an input with a proper icon.
+
+        This patch introduces FileIconLoader, a separate abstraction for loading an icon, and removes
+        any notion of an icon from the FileChooser.
+
+        Also, the loaded icon is now stored on the RenderFileUploadControl, which better matches its
+        purpose.
+
+        Refactoring, covered by existing tests.
+
+        * CMakeLists.txt: Added FileIconLoader to build system.
+        * GNUmakefile.list.am: Ditto.
+        * WebCore.exp.in: Updated.
+        * WebCore.gypi: Added FileIconLoader to build system.
+        * WebCore.pro: Ditto.
+        * WebCore.vcproj/WebCore.vcproj: Ditto.
+        * WebCore.xcodeproj/project.pbxproj: Ditto.
+        * loader/EmptyClients.h: Updated.
+        (WebCore::EmptyChromeClient::loadIconForFiles): Renamed function to better reflect what it does.
+        * page/Chrome.cpp:
+        (WebCore::Chrome::loadIconForFiles): Ditto.
+        * page/Chrome.h: Ditto.
+        * page/ChromeClient.h: Ditto.
+        * platform/FileChooser.cpp:
+        (WebCore::FileChooser::FileChooser): Removed now-unnecessary bool.
+        (WebCore::FileChooser::create): Removed the tangled web.
+        (WebCore::FileChooser::clear): Removed icon-related code.
+        (WebCore::FileChooser::chooseFiles): Ditto.
+        * platform/FileChooser.h:
+        * platform/FileIconLoader.cpp: Copied from Source/WebCore/platform/FileChooser.cpp.
+        (WebCore::FileIconLoaderClient::~FileIconLoaderClient): Added.
+        (WebCore::FileIconLoader::create): Added.
+        (WebCore::FileIconLoader::disconnectClient): Added.
+        (WebCore::FileIconLoader::notifyFinished): Added.
+        (WebCore::FileIconLoader::FileIconLoader): Added.
+        * platform/FileIconLoader.h: Copied from Source/WebCore/platform/FileChooser.cpp.
+        * rendering/RenderFileUploadControl.cpp:
+        (WebCore::RenderFileUploadControl::RenderFileUploadControl): Added new member initializations.
+        (WebCore::RenderFileUploadControl::~RenderFileUploadControl): Added FileIconLoader disconnect.s
+        (WebCore::RenderFileUploadControl::requestIcon): Added a helper.
+        (WebCore::RenderFileUploadControl::valueChanged): Changed to request an icon load.
+        (WebCore::RenderFileUploadControl::updateRendering): Added implementation of FileIconLoaderClient func.
+        (WebCore::RenderFileUploadControl::updateFromElement): Added clearing of icon.
+        (WebCore::RenderFileUploadControl::maxFilenameWidth): Changed to use new member directly.
+        (WebCore::RenderFileUploadControl::paintObject): Ditto.
+        (WebCore::RenderFileUploadControl::fileTextValue): Ditto.
+        * rendering/RenderFileUploadControl.h: Updated decls.
+
 2011-06-19  Michael Saboff  <msaboff@apple.com>
 
         Reviewed by Darin Adler.
index 07ad7ed..b8a6757 100644 (file)
@@ -2367,6 +2367,8 @@ webcore_sources += \
        Source/WebCore/platform/EventLoop.h \
        Source/WebCore/platform/FileChooser.cpp \
        Source/WebCore/platform/FileChooser.h \
+       Source/WebCore/platform/FileIconLoader.cpp \
+       Source/WebCore/platform/FileIconLoader.h \
        Source/WebCore/platform/FileMetadata.h \
        Source/WebCore/platform/FileStreamClient.h \
        Source/WebCore/platform/FileStream.cpp \
index 299d719..962693c 100644 (file)
@@ -156,7 +156,6 @@ __ZN7WebCore11CachedFrame26setCachedFramePlatformDataEN3WTF10PassOwnPtrINS_23Cac
 __ZN7WebCore11EditCommand7reapplyEv
 __ZN7WebCore11EditCommand7unapplyEv
 __ZN7WebCore11FileChooser10chooseFileERKN3WTF6StringE
-__ZN7WebCore11FileChooser10iconLoadedEN3WTF10PassRefPtrINS_4IconEEE
 __ZN7WebCore11FileChooser11chooseFilesERKN3WTF6VectorINS1_6StringELm0EEE
 __ZN7WebCore11FileChooserD1Ev
 __ZN7WebCore11FrameLoader11loadArchiveEN3WTF10PassRefPtrINS_7ArchiveEEE
@@ -346,6 +345,7 @@ __ZN7WebCore14DocumentLoaderC1ERKNS_15ResourceRequestERKNS_14SubstituteDataE
 __ZN7WebCore14DocumentLoaderC2ERKNS_15ResourceRequestERKNS_14SubstituteDataE
 __ZN7WebCore14DocumentLoaderD2Ev
 __ZN7WebCore14DocumentWriter11setEncodingERKN3WTF6StringEb
+__ZN7WebCore14FileIconLoader14notifyFinishedEN3WTF10PassRefPtrINS_4IconEEE
 __ZN7WebCore14FrameSelection10setFocusedEb
 __ZN7WebCore14FrameSelection12setSelectionERKNS_16VisibleSelectionEjNS0_19CursorAlignOnScrollENS_15TextGranularityENS_20DirectionalityPolicyE
 __ZN7WebCore14FrameSelection15revealSelectionERKNS_15ScrollAlignmentEb
index 0f77517..15dd72f 100644 (file)
             'platform/DragImage.cpp',
             'platform/EventLoop.h',
             'platform/FileChooser.cpp',
+            'platform/FileIconLoader.cpp',
+            'platform/FileIconLoader.h',
             'platform/FileMetadata.h',
             'platform/FileStream.cpp',
             'platform/FileSystem.cpp',
index aa8fca5..8b12c92 100644 (file)
@@ -970,6 +970,7 @@ SOURCES += \
     platform/DragData.cpp \
     platform/DragImage.cpp \
     platform/FileChooser.cpp \
+    platform/FileIconLoader.cpp \
     platform/FileStream.cpp \
     platform/FileSystem.cpp \
     platform/GeolocationService.cpp \
index 1dd7c3a..0369487 100755 (executable)
                                >
                        </File>
                        <File
+                               RelativePath="..\platform\FileIconLoader.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\platform\FileIconLoader.h"
+                               >
+                       </File>
+                       <File
                                RelativePath="..\platform\FileMetadata.h"
                                >
                        </File>
index 96f954a..049c5a4 100644 (file)
                4127D5370F8AAB1D00E424F5 /* ScriptState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */; };
                4138D3351244054800323D33 /* EventContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 4138D3331244054800323D33 /* EventContext.h */; };
                4138D3361244054800323D33 /* EventContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4138D3341244054800323D33 /* EventContext.cpp */; };
+               414B867313AD074E00B4B373 /* FileIconLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 414B867113AD074E00B4B373 /* FileIconLoader.cpp */; };
+               414B867413AD074E00B4B373 /* FileIconLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 414B867213AD074E00B4B373 /* FileIconLoader.h */; settings = {ATTRIBUTES = (Private, ); }; };
                4150F9F112B6E0E70008C860 /* SliderThumbElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4150F9EF12B6E0E70008C860 /* SliderThumbElement.h */; };
                4150F9F212B6E0E70008C860 /* SliderThumbElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4150F9F012B6E0E70008C860 /* SliderThumbElement.cpp */; };
                4157AF8012F1FB0400A8C6F5 /* MediaControlRootElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4157AF7E12F1FB0400A8C6F5 /* MediaControlRootElement.h */; };
                4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptState.cpp; sourceTree = "<group>"; };
                4138D3331244054800323D33 /* EventContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventContext.h; sourceTree = "<group>"; };
                4138D3341244054800323D33 /* EventContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventContext.cpp; sourceTree = "<group>"; };
+               414B867113AD074E00B4B373 /* FileIconLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileIconLoader.cpp; sourceTree = "<group>"; };
+               414B867213AD074E00B4B373 /* FileIconLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileIconLoader.h; sourceTree = "<group>"; };
                4150F9EF12B6E0E70008C860 /* SliderThumbElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SliderThumbElement.h; sourceTree = "<group>"; };
                4150F9F012B6E0E70008C860 /* SliderThumbElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SliderThumbElement.cpp; sourceTree = "<group>"; };
                4157AF7E12F1FB0400A8C6F5 /* MediaControlRootElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaControlRootElement.h; sourceTree = "<group>"; };
                                1CA19E150DC255CA0065A994 /* EventLoop.h */,
                                934FE9E40B5CA539003E4A73 /* FileChooser.cpp */,
                                066C772A0AB603B700238CC4 /* FileChooser.h */,
+                               414B867113AD074E00B4B373 /* FileIconLoader.cpp */,
+                               414B867213AD074E00B4B373 /* FileIconLoader.h */,
                                2EF1BFE8121C9F4200C27627 /* FileStream.cpp */,
                                2EF1BFE9121C9F4200C27627 /* FileStream.h */,
                                2EF1BFF8121CB0CE00C27627 /* FileStreamClient.h */,
                                893C480F1248BD3A002B3D86 /* FileEntrySync.h in Headers */,
                                976D6C83122B8A3D001FD1F7 /* FileError.h in Headers */,
                                2EDF369F122C94C8002F7D4E /* FileException.h in Headers */,
+                               414B867413AD074E00B4B373 /* FileIconLoader.h in Headers */,
                                F55B3DBE1251F12D003EF269 /* FileInputType.h in Headers */,
                                976D6C86122B8A3D001FD1F7 /* FileList.h in Headers */,
                                4689F1AF1267BAE100E8D380 /* FileMetadata.h in Headers */,
                                934FE9E50B5CA539003E4A73 /* FileChooser.cpp in Sources */,
                                89878561122CA064003AABDA /* FileEntry.cpp in Sources */,
                                893C480E1248BD3A002B3D86 /* FileEntrySync.cpp in Sources */,
+                               414B867313AD074E00B4B373 /* FileIconLoader.cpp in Sources */,
                                F55B3DBD1251F12D003EF269 /* FileInputType.cpp in Sources */,
                                976D6C85122B8A3D001FD1F7 /* FileList.cpp in Sources */,
                                976D6C88122B8A3D001FD1F7 /* FileReader.cpp in Sources */,
index 33c26bc..ba885c4 100644 (file)
@@ -197,7 +197,7 @@ public:
 #endif
 
     virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>) { }
-    virtual void chooseIconForFiles(const Vector<String>&, FileChooser*) { }
+    virtual void loadIconForFiles(const Vector<String>&, FileIconLoader*) { }
 
     virtual void formStateDidChange(const Node*) { }
 
index 04f9e4b..c0aba94 100644 (file)
@@ -24,6 +24,7 @@
 #include "ChromeClient.h"
 #include "DNS.h"
 #include "Document.h"
+#include "FileIconLoader.h"
 #include "FileChooser.h"
 #include "FileList.h"
 #include "FloatRect.h"
@@ -34,6 +35,7 @@
 #include "HTMLInputElement.h"
 #include "HTMLNames.h"
 #include "HitTestResult.h"
+#include "Icon.h"
 #include "InspectorInstrumentation.h"
 #include "Page.h"
 #include "PageGroupLoadDeferrer.h"
@@ -462,9 +464,9 @@ void Chrome::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> fileChooser)
     m_client->runOpenPanel(frame, fileChooser);
 }
 
-void Chrome::chooseIconForFiles(const Vector<String>& filenames, FileChooser* fileChooser)
+void Chrome::loadIconForFiles(const Vector<String>& filenames, FileIconLoader* loader)
 {
-    m_client->chooseIconForFiles(filenames, fileChooser);
+    m_client->loadIconForFiles(filenames, loader);
 }
 
 void Chrome::dispatchViewportDataDidChange(const ViewportArguments& arguments) const
index bab7ee3..db4588b 100644 (file)
@@ -37,6 +37,7 @@ namespace WebCore {
 
     class ChromeClient;
     class FileChooser;
+    class FileIconLoader;
     class FloatRect;
     class Frame;
     class Geolocation;
@@ -152,7 +153,7 @@ namespace WebCore {
         void cancelGeolocationPermissionRequestForFrame(Frame*, Geolocation*);
 
         void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
-        void chooseIconForFiles(const Vector<String>&, FileChooser*);
+        void loadIconForFiles(const Vector<String>&, FileIconLoader*);
 #if ENABLE(DIRECTORY_UPLOAD)
         void enumerateChosenDirectory(const String&, FileChooser*);
 #endif
index f6ca2f5..1bb5ed2 100644 (file)
@@ -46,6 +46,7 @@ namespace WebCore {
     class AccessibilityObject;
     class Element;
     class FileChooser;
+    class FileIconLoader;
     class FloatRect;
     class Frame;
     class Geolocation;
@@ -226,7 +227,7 @@ namespace WebCore {
 
         virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>) = 0;
         // Asynchronous request to load an icon for specified filenames.
-        virtual void chooseIconForFiles(const Vector<String>&, FileChooser*) = 0;
+        virtual void loadIconForFiles(const Vector<String>&, FileIconLoader*) = 0;
 
 #if ENABLE(DIRECTORY_UPLOAD)
         // Asychronous request to enumerate all files in a directory chosen by the user.
index 881395d..0f452bb 100644 (file)
 #include "config.h"
 #include "FileChooser.h"
 
-#include "Icon.h"
-
 namespace WebCore {
-    
+
 FileChooserClient::~FileChooserClient()
 {
 }
 
 inline FileChooser::FileChooser(FileChooserClient* client, const Vector<String>& initialFilenames)
     : m_client(client)
-    , m_isInitializing(true)
 {
     m_filenames = initialFilenames;
 }
 
 PassRefPtr<FileChooser> FileChooser::create(FileChooserClient* client, const Vector<String>& initialFilenames)
 {
-    RefPtr<FileChooser> chooser(adoptRef(new FileChooser(client, initialFilenames)));
-    chooser->loadIcon();
-    chooser->m_isInitializing = false;
-    return chooser;
+    return adoptRef(new FileChooser(client, initialFilenames));
 }
 
 FileChooser::~FileChooser()
@@ -59,7 +53,6 @@ FileChooser::~FileChooser()
 void FileChooser::clear()
 {
     m_filenames.clear();
-    m_icon = 0;
 }
 
 void FileChooser::chooseFile(const String& filename)
@@ -74,22 +67,8 @@ void FileChooser::chooseFiles(const Vector<String>& filenames)
     if (m_filenames == filenames)
         return;
     m_filenames = filenames;
-    loadIcon();
     if (m_client)
         m_client->valueChanged();
 }
 
-void FileChooser::loadIcon()
-{
-    if (m_filenames.size() && m_client)
-        m_client->chooseIconForFiles(this, m_filenames);
-}
-
-void FileChooser::iconLoaded(PassRefPtr<Icon> icon)
-{
-    m_icon = icon;
-    if (!m_isInitializing && m_icon && m_client)
-        m_client->repaint();
-}
-
 }
index ed3b430..bcc29a2 100644 (file)
 namespace WebCore {
 
 class FileChooser;
-class Font;
-class Icon;
 
 class FileChooserClient {
 public:
     virtual void valueChanged() = 0;
-    virtual void repaint() = 0;
     virtual bool allowsMultipleFiles() = 0;
 #if ENABLE(DIRECTORY_UPLOAD)
     virtual bool allowsDirectoryUpload() = 0;
 #endif
     virtual String acceptTypes() = 0;
-    virtual void chooseIconForFiles(FileChooser*, const Vector<String>&) = 0;
     virtual ~FileChooserClient();
 };
 
@@ -62,14 +58,10 @@ public:
 
     const Vector<String>& filenames() const { return m_filenames; }
 
-    Icon* icon() const { return m_icon.get(); }
-
     void clear(); // for use by client; does not call valueChanged
 
     void chooseFile(const String& path);
     void chooseFiles(const Vector<String>& paths);
-    // Called when FileChooserClient finishes to load an icon requested by iconForFiles().
-    void iconLoaded(PassRefPtr<Icon>);
 
     bool allowsMultipleFiles() const { return m_client ? m_client->allowsMultipleFiles() : false; }
 #if ENABLE(DIRECTORY_UPLOAD)
@@ -80,12 +72,9 @@ public:
 
 private:
     FileChooser(FileChooserClient*, const Vector<String>& initialFilenames);
-    void loadIcon();
 
     FileChooserClient* m_client;
     Vector<String> m_filenames;
-    RefPtr<Icon> m_icon;
-    bool m_isInitializing;
 };
 
 } // namespace WebCore
diff --git a/Source/WebCore/platform/FileIconLoader.cpp b/Source/WebCore/platform/FileIconLoader.cpp
new file mode 100644 (file)
index 0000000..34de8a5
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "FileIconLoader.h"
+
+#include "Icon.h"
+
+namespace WebCore {
+
+FileIconLoaderClient::~FileIconLoaderClient()
+{
+}
+
+PassRefPtr<FileIconLoader> FileIconLoader::create(FileIconLoaderClient* client)
+{
+    return adoptRef(new FileIconLoader(client));
+}
+
+void FileIconLoader::disconnectClient()
+{
+    m_client = 0;
+}
+
+void FileIconLoader::notifyFinished(PassRefPtr<Icon> icon)
+{
+    if (m_client)
+        m_client->updateRendering(icon);
+}
+
+FileIconLoader::FileIconLoader(FileIconLoaderClient* client)
+    : m_client(client)
+{
+}
+
+}
diff --git a/Source/WebCore/platform/FileIconLoader.h b/Source/WebCore/platform/FileIconLoader.h
new file mode 100644 (file)
index 0000000..dc394d1
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef FileIconLoader_h
+#define FileIconLoader_h
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class Icon;
+
+class FileIconLoaderClient {
+public:
+    virtual void updateRendering(PassRefPtr<Icon>) = 0;
+    virtual ~FileIconLoaderClient();
+};
+
+class FileIconLoader : public RefCounted<FileIconLoader> {
+public:
+    static PassRefPtr<FileIconLoader> create(FileIconLoaderClient*);
+
+    void disconnectClient();
+    void notifyFinished(PassRefPtr<Icon>);
+
+private:
+    explicit FileIconLoader(FileIconLoaderClient*);
+
+    FileIconLoaderClient* m_client;
+};
+
+} // namespace WebCore
+
+#endif
index dd7306e..0459510 100644 (file)
@@ -56,6 +56,7 @@ const int buttonShadowHeight = 2;
 
 RenderFileUploadControl::RenderFileUploadControl(HTMLInputElement* input)
     : RenderBlock(input)
+    , m_iconLoader(FileIconLoader::create(this))
 {
     FileList* list = input->files();
     Vector<String> filenames;
@@ -63,13 +64,24 @@ RenderFileUploadControl::RenderFileUploadControl(HTMLInputElement* input)
     for (unsigned i = 0; i < length; ++i)
         filenames.append(list->item(i)->path());
     m_fileChooser = FileChooser::create(this, filenames);
+    requestIcon(filenames);
 }
 
 RenderFileUploadControl::~RenderFileUploadControl()
 {
+    m_iconLoader->disconnectClient();
     m_fileChooser->disconnectClient();
 }
 
+void RenderFileUploadControl::requestIcon(const Vector<String>& filenames) const
+{
+    if (!filenames.size())
+        return;
+
+    if (Chrome* chrome = this->chrome())
+        chrome->loadIconForFiles(filenames, m_iconLoader.get());
+}
+
 void RenderFileUploadControl::valueChanged()
 {
     // dispatchFormControlChangeEvent may destroy this renderer
@@ -78,10 +90,11 @@ void RenderFileUploadControl::valueChanged()
     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(node());
     inputElement->setFileListFromRenderer(fileChooser->filenames());
     inputElement->dispatchFormControlChangeEvent();
-    // only repaint if it doesn't seem we have been destroyed
-    if (!fileChooser->disconnected())
-        repaint();
+    if (fileChooser->disconnected())
+        return;
+
+    requestIcon(fileChooser->filenames());
+    repaint();
 }
 
 bool RenderFileUploadControl::allowsMultipleFiles()
@@ -104,8 +117,8 @@ bool RenderFileUploadControl::allowsDirectoryUpload()
 
 void RenderFileUploadControl::receiveDropForDirectoryUpload(const Vector<String>& paths)
 {
-    if (Chrome* chromePointer = chrome())
-        chromePointer->enumerateChosenDirectory(paths[0], m_fileChooser.get());
+    if (Chrome* chrome = this->chrome())
+        chrome->enumerateChosenDirectory(paths[0], m_fileChooser.get());
 }
 #endif
 
@@ -114,18 +127,21 @@ String RenderFileUploadControl::acceptTypes()
     return static_cast<HTMLInputElement*>(node())->accept();
 }
 
-void RenderFileUploadControl::chooseIconForFiles(FileChooser* chooser, const Vector<String>& filenames)
+void RenderFileUploadControl::updateRendering(PassRefPtr<Icon> icon)
 {
-    if (Chrome* chromePointer = chrome())
-        chromePointer->chooseIconForFiles(filenames, chooser);
+    if (m_icon == icon)
+        return;
+
+    m_icon = icon;
+    repaint();
 }
 
 void RenderFileUploadControl::click()
 {
     if (!ScriptController::processingUserGesture())
         return;
-    if (Chrome* chromePointer = chrome())
-        chromePointer->runOpenPanel(frame(), m_fileChooser);
+    if (Chrome* chrome = this->chrome())
+        chrome->runOpenPanel(frame(), m_fileChooser);
 }
 
 Chrome* RenderFileUploadControl::chrome() const
@@ -154,6 +170,7 @@ void RenderFileUploadControl::updateFromElement()
     ASSERT(files);
     if (files && files->isEmpty() && !m_fileChooser->filenames().isEmpty()) {
         m_fileChooser->clear();
+        m_icon = 0;
         repaint();
     }
 }
@@ -166,14 +183,13 @@ static int nodeWidth(Node* node)
 int RenderFileUploadControl::maxFilenameWidth() const
 {
     return max(0, contentWidth() - nodeWidth(uploadButton()) - afterButtonSpacing
-        - (m_fileChooser->icon() ? iconWidth + iconFilenameSpacing : 0));
+        - (m_icon ? iconWidth + iconFilenameSpacing : 0));
 }
 
 void RenderFileUploadControl::paintObject(PaintInfo& paintInfo, const IntPoint& paintOffset)
 {
     if (style()->visibility() != VISIBLE)
         return;
-    ASSERT(m_fileChooser);
     
     // Push a clip.
     GraphicsContextStateSaver stateSaver(*paintInfo.context, false);
@@ -199,7 +215,7 @@ void RenderFileUploadControl::paintObject(PaintInfo& paintInfo, const IntPoint&
 
         int buttonWidth = nodeWidth(button);
         int buttonAndIconWidth = buttonWidth + afterButtonSpacing
-            + (m_fileChooser->icon() ? iconWidth + iconFilenameSpacing : 0);
+            + (m_icon ? iconWidth + iconFilenameSpacing : 0);
         int textX;
         if (style()->isLeftToRightDirection())
             textX = contentLeft + buttonAndIconWidth;
@@ -216,7 +232,7 @@ void RenderFileUploadControl::paintObject(PaintInfo& paintInfo, const IntPoint&
         // Draw the filename
         paintInfo.context->drawBidiText(font, textRun, IntPoint(textX, textY));
         
-        if (m_fileChooser->icon()) {
+        if (m_icon) {
             // Determine where the icon should be placed
             int iconY = paintOffset.y() + borderTop() + paddingTop() + (contentHeight() - iconHeight) / 2;
             int iconX;
@@ -226,7 +242,7 @@ void RenderFileUploadControl::paintObject(PaintInfo& paintInfo, const IntPoint&
                 iconX = contentLeft + contentWidth() - buttonWidth - afterButtonSpacing - iconWidth;
 
             // Draw the file icon
-            m_fileChooser->icon()->paint(paintInfo.context, IntRect(iconX, iconY, iconWidth, iconHeight));
+            m_icon->paint(paintInfo.context, IntRect(iconX, iconY, iconWidth, iconHeight));
         }
     }
 
@@ -315,6 +331,7 @@ String RenderFileUploadControl::buttonValue()
 
 String RenderFileUploadControl::fileTextValue() const
 {
+    ASSERT(m_fileChooser);
     return theme()->fileListNameForWidth(m_fileChooser->filenames(), style()->font(), maxFilenameWidth());
 }
     
index bc5aa5b..834ae85 100644 (file)
@@ -22,6 +22,7 @@
 #define RenderFileUploadControl_h
 
 #include "FileChooser.h"
+#include "FileIconLoader.h"
 #include "RenderBlock.h"
 
 namespace WebCore {
@@ -33,7 +34,7 @@ class HTMLInputElement;
 // sufficient space to draw a file icon and filename. The RenderButton has a shadow node
 // associated with it to receive click/hover events.
 
-class RenderFileUploadControl : public RenderBlock, private FileChooserClient {
+class RenderFileUploadControl : public RenderBlock, private FileChooserClient, private FileIconLoaderClient {
 public:
     RenderFileUploadControl(HTMLInputElement*);
     virtual ~RenderFileUploadControl();
@@ -56,26 +57,29 @@ private:
 
     virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
 
-    // FileChooserClient methods.
-    void valueChanged();
-    void repaint() { RenderBlock::repaint(); }
-    bool allowsMultipleFiles();
+    // FileChooserClient functions.
+    virtual void valueChanged();
+    virtual bool allowsMultipleFiles();
 #if ENABLE(DIRECTORY_UPLOAD)
-    bool allowsDirectoryUpload();
-    void receiveDropForDirectoryUpload(const Vector<String>&);
+    virtual bool allowsDirectoryUpload();
+    virtual void receiveDropForDirectoryUpload(const Vector<String>&);
 #endif
-    String acceptTypes();
-    void chooseIconForFiles(FileChooser*, const Vector<String>&);
+    virtual String acceptTypes();
+
+    // FileIconLoaderClient functions.
+    virtual void updateRendering(PassRefPtr<Icon>);
 
     Chrome* chrome() const;
     int maxFilenameWidth() const;
-    PassRefPtr<RenderStyle> createButtonStyle(const RenderStyle* parentStyle) const;
     
     virtual VisiblePosition positionForPoint(const IntPoint&);
 
     HTMLInputElement* uploadButton() const;
+    void requestIcon(const Vector<String>&) const;
 
     RefPtr<FileChooser> m_fileChooser;
+    RefPtr<FileIconLoader> m_iconLoader;
+    RefPtr<Icon> m_icon;
 };
 
 inline RenderFileUploadControl* toRenderFileUploadControl(RenderObject* object)
index e7faf25..291a1c7 100644 (file)
@@ -31,6 +31,7 @@
 #include "CachedPage.h"
 #include "DocumentLoader.h"
 #include "FileChooser.h"
+#include "FileIconLoader.h"
 #include "FloatRect.h"
 #include "Frame.h"
 #include "FrameLoader.h"
index f177637..0b777ca 100644 (file)
@@ -1,3 +1,18 @@
+2011-06-18  Dimitri Glazkov  <dglazkov@chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Separate concerns of loading file icons and choosing files.
+        https://bugs.webkit.org/show_bug.cgi?id=62931
+
+        * src/ChromeClientImpl.cpp:
+        (WebKit::ChromeClientImpl::loadIconForFiles): Renamed to better reflect the intent.
+        * src/ChromeClientImpl.h: Ditto.
+        * src/WebIconLoadingCompletionImpl.cpp:
+        (WebKit::WebIconLoadingCompletionImpl::WebIconLoadingCompletionImpl): Changed to use FileIconLoader.
+        (WebKit::WebIconLoadingCompletionImpl::didLoadIcon): Ditto.
+        * src/WebIconLoadingCompletionImpl.h: Dito.
+
 2011-06-18  Yufeng Shen  <miletus@chromium.org>
 
         Reviewed by Darin Fisher.
index f715ccc..3b0ada3 100644 (file)
@@ -41,6 +41,7 @@
 #include "DocumentLoader.h"
 #include "ExternalPopupMenu.h"
 #include "FileChooser.h"
+#include "FileIconLoader.h"
 #include "FloatRect.h"
 #include "FrameLoadRequest.h"
 #include "FrameView.h"
@@ -49,6 +50,7 @@
 #include "GraphicsLayer.h"
 #include "HTMLNames.h"
 #include "HitTestResult.h"
+#include "Icon.h"
 #include "IntRect.h"
 #include "NavigationAction.h"
 #include "Node.h"
@@ -686,11 +688,11 @@ void ChromeClientImpl::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> fileCh
     chooserCompletion->didChooseFile(WebVector<WebString>());
 }
 
-void ChromeClientImpl::chooseIconForFiles(const Vector<String>& filenames, FileChooser* fileChooser)
+void ChromeClientImpl::loadIconForFiles(const Vector<String>& filenames, FileIconLoader* loader)
 {
     if (!m_webView->client())
         return;
-    WebIconLoadingCompletionImpl* iconCompletion = new WebIconLoadingCompletionImpl(fileChooser);
+    WebIconLoadingCompletionImpl* iconCompletion = new WebIconLoadingCompletionImpl(loader);
     if (!m_webView->client()->queryIconForFiles(filenames, iconCompletion))
         iconCompletion->didLoadIcon(WebData());
 }
index 8d7252c..077363c 100644 (file)
@@ -139,7 +139,7 @@ public:
     virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*);
     virtual void cancelGeolocationPermissionRequestForFrame(WebCore::Frame*, WebCore::Geolocation*);
     virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>);
-    virtual void chooseIconForFiles(const Vector<WTF::String>&, WebCore::FileChooser*);
+    virtual void loadIconForFiles(const Vector<WTF::String>&, WebCore::FileIconLoader*);
 #if ENABLE(DIRECTORY_UPLOAD)
     virtual void enumerateChosenDirectory(const WTF::String&, WebCore::FileChooser*);
 #endif
index c1dd321..48682b4 100644 (file)
@@ -39,8 +39,8 @@ using namespace WebCore;
 
 namespace WebKit {
 
-WebIconLoadingCompletionImpl::WebIconLoadingCompletionImpl(FileChooser* chooser)
-    : m_fileChooser(chooser)
+WebIconLoadingCompletionImpl::WebIconLoadingCompletionImpl(FileIconLoader* fileIconLoader)
+    : m_fileIconLoader(fileIconLoader)
 {
 }
 
@@ -53,7 +53,7 @@ void WebIconLoadingCompletionImpl::didLoadIcon(const WebData& iconData)
     if (!iconData.isEmpty()) {
         RefPtr<Image> image = BitmapImage::create();
         image->setData(iconData, true);
-        m_fileChooser->iconLoaded(Icon::create(image));
+        m_fileIconLoader->notifyFinished(Icon::create(image));
     }
     // This object is no longer needed.
     delete this;
index 6e6f3a8..18cadd3 100644 (file)
 #ifndef WebIconLoadingCompletionImpl_h
 #define WebIconLoadingCompletionImpl_h
 
-#include "FileChooser.h"
+#include "FileIconLoader.h"
 #include "WebData.h"
 #include "WebIconLoadingCompletion.h"
 #include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
 
 using WebKit::WebIconLoadingCompletion;
 using WebKit::WebData;
@@ -43,13 +44,13 @@ namespace WebKit {
 
 class WebIconLoadingCompletionImpl : public WebIconLoadingCompletion {
 public:
-    WebIconLoadingCompletionImpl(WebCore::FileChooser*);
+    WebIconLoadingCompletionImpl(WebCore::FileIconLoader*);
     virtual void didLoadIcon(const WebData&);
 
 private:
     ~WebIconLoadingCompletionImpl();
 
-    RefPtr<WebCore::FileChooser> m_fileChooser;
+    RefPtr<WebCore::FileIconLoader> m_fileIconLoader;
 };
 
 } // namespace WebKit
index 1ee1453..378322b 100755 (executable)
@@ -1,3 +1,14 @@
+2011-06-18  Dimitri Glazkov  <dglazkov@chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Separate concerns of loading file icons and choosing files.
+        https://bugs.webkit.org/show_bug.cgi?id=62931
+
+        * WebCoreSupport/ChromeClientEfl.cpp:
+        (WebCore::ChromeClientEfl::loadIconForFiles): Renamed.
+        * WebCoreSupport/ChromeClientEfl.h:
+
 2011-06-15  Grzegorz Czajkowski  <g.czajkowski@samsung.com>
 
         Reviewed by Antonio Gomes.
index c16e590..6f4d814 100644 (file)
@@ -40,6 +40,7 @@
 #endif
 #include "EWebKit.h"
 #include "FileChooser.h"
+#include "FileIconLoader.h"
 #include "FloatRect.h"
 #include "FrameLoader.h"
 #include "FrameLoaderClientEfl.h"
@@ -527,7 +528,7 @@ void ChromeClientEfl::iconForFiles(const Vector<String, 0u>&, PassRefPtr<FileCho
     notImplemented();
 }
 
-void ChromeClientEfl::chooseIconForFiles(const Vector<String>&, FileChooser*)
+void ChromeClientEfl::loadIconForFiles(const Vector<String>&, FileIconLoader*)
 {
     notImplemented();
 }
index 6ed9507..9a49ed9 100644 (file)
@@ -133,7 +133,7 @@ public:
 #endif
 
     virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
-    virtual void chooseIconForFiles(const Vector<String>&, FileChooser*);
+    virtual void loadIconForFiles(const Vector<String>&, FileIconLoader*);
     virtual void formStateDidChange(const Node*);
 
     virtual void setCursor(const Cursor&);
index fe52da7..bc2a05f 100644 (file)
@@ -1,3 +1,14 @@
+2011-06-18  Dimitri Glazkov  <dglazkov@chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Separate concerns of loading file icons and choosing files.
+        https://bugs.webkit.org/show_bug.cgi?id=62931
+
+        * WebCoreSupport/ChromeClientGtk.cpp:
+        (WebKit::ChromeClient::loadIconForFiles): Renamed.
+        * WebCoreSupport/ChromeClientGtk.h:
+
 2011-06-17  Joone Hur  <joone.hur@collabora.co.uk>
 
         Reviewed by Martin Robinson.
index 79b958d..25a6a25 100644 (file)
@@ -29,6 +29,7 @@
 #include "DumpRenderTreeSupportGtk.h"
 #include "Element.h"
 #include "FileChooser.h"
+#include "FileIconLoader.h"
 #include "FileSystem.h"
 #include "FloatRect.h"
 #include "FrameLoadRequest.h"
@@ -642,9 +643,9 @@ void ChromeClient::runOpenPanel(Frame*, PassRefPtr<FileChooser> prpFileChooser)
     gtk_widget_destroy(dialog);
 }
 
-void ChromeClient::chooseIconForFiles(const Vector<WTF::String>& filenames, WebCore::FileChooser* chooser)
+void ChromeClient::loadIconForFiles(const Vector<WTF::String>& filenames, WebCore::FileIconLoader* loader)
 {
-    chooser->iconLoaded(Icon::createIconForFiles(filenames));
+    loader->notifyFinished(Icon::createIconForFiles(filenames));
 }
 
 void ChromeClient::dispatchViewportDataDidChange(const ViewportArguments& arguments) const
index 716327c..853b132 100644 (file)
@@ -128,7 +128,7 @@ namespace WebKit {
         virtual void showContextMenu() { }
 #endif
         virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>);
-        virtual void chooseIconForFiles(const Vector<WTF::String>&, WebCore::FileChooser*);
+        virtual void loadIconForFiles(const Vector<WTF::String>&, WebCore::FileIconLoader*);
 
         virtual void formStateDidChange(const WebCore::Node*) { }
 
index 240e511..18a649e 100644 (file)
@@ -1,3 +1,14 @@
+2011-06-18  Dimitri Glazkov  <dglazkov@chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Separate concerns of loading file icons and choosing files.
+        https://bugs.webkit.org/show_bug.cgi?id=62931
+
+        * WebCoreSupport/ChromeClientHaiku.cpp:
+        (WebCore::ChromeClientHaiku::loadIconForFiles): Renamed.
+        * WebCoreSupport/ChromeClientHaiku.h:
+
 2011-06-12  Adam Barth  <abarth@webkit.org>
 
         Reviewed by Alexey Proskuryakov.
index b16e08c..91581d4 100644 (file)
@@ -29,6 +29,7 @@
 #include "config.h"
 #include "ChromeClientHaiku.h"
 
+#include "FileIconLoader.h"
 #include "Frame.h"
 #include "FrameLoadRequest.h"
 #include "FrameView.h"
@@ -371,9 +372,9 @@ void ChromeClientHaiku::runOpenPanel(Frame*, PassRefPtr<FileChooser>)
     notImplemented();
 }
 
-void ChromeClientHaiku::chooseIconForFiles(const Vector<String>& filenames, FileChooser* chooser)
+void ChromeClientHaiku::loadIconForFiles(const Vector<String>& filenames, FileIconLoader* loader)
 {
-    chooser->iconLoaded(Icon::createIconForFiles(filenames));
+    loader->notifyFinished(Icon::createIconForFiles(filenames));
 }
 
 void ChromeClientHaiku::setCursor(const Cursor&)
index 322d0b2..da963b0 100644 (file)
@@ -152,7 +152,7 @@ namespace WebCore {
         virtual void cancelGeolocationPermissionRequestForFrame(Frame*, Geolocation*) { }
 
         virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
-        virtual void chooseIconForFiles(const Vector<String>&, FileChooser*);
+        virtual void loadIconForFiles(const Vector<String>&, FileIconLoader*);
 
         virtual void setCursor(const Cursor&);
 
index 6128abb..bc3ad5d 100644 (file)
@@ -1,3 +1,14 @@
+2011-06-18  Dimitri Glazkov  <dglazkov@chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Separate concerns of loading file icons and choosing files.
+        https://bugs.webkit.org/show_bug.cgi?id=62931
+
+        * WebCoreSupport/WebChromeClient.h:
+        * WebCoreSupport/WebChromeClient.mm:
+        (WebChromeClient::loadIconForFiles): Renamed.
+
 2011-06-18  Andrew Wellington  <andrew@webkit.org>
 
         Reviewed by Alexey Proskuryakov.
index 6f9f09c..d4d6eb6 100644 (file)
@@ -125,7 +125,7 @@ public:
 #endif
 
     virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>);
-    virtual void chooseIconForFiles(const Vector<WTF::String>&, WebCore::FileChooser*);
+    virtual void loadIconForFiles(const Vector<WTF::String>&, WebCore::FileIconLoader*);
 
     virtual void setCursor(const WebCore::Cursor&);
 
index 5b52990..f07dd47 100644 (file)
@@ -55,6 +55,7 @@
 #import <WebCore/ContextMenuController.h>
 #import <WebCore/Element.h>
 #import <WebCore/FileChooser.h>
+#import <WebCore/FileIconLoader.h>
 #import <WebCore/FloatRect.h>
 #import <WebCore/Frame.h>
 #import <WebCore/FrameLoadRequest.h>
@@ -784,9 +785,9 @@ void WebChromeClient::runOpenPanel(Frame*, PassRefPtr<FileChooser> chooser)
     END_BLOCK_OBJC_EXCEPTIONS;
 }
 
-void WebChromeClient::chooseIconForFiles(const Vector<String>& filenames, FileChooser* chooser)
+void WebChromeClient::loadIconForFiles(const Vector<String>& filenames, FileIconLoader* iconLoader)
 {
-    chooser->iconLoaded(Icon::createIconForFiles(filenames));
+    iconLoader->notifyFinished(Icon::createIconForFiles(filenames));
 }
 
 void WebChromeClient::setCursor(const WebCore::Cursor& cursor)
index b097cd0..c8c8bb3 100644 (file)
@@ -1,3 +1,14 @@
+2011-06-18  Dimitri Glazkov  <dglazkov@chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Separate concerns of loading file icons and choosing files.
+        https://bugs.webkit.org/show_bug.cgi?id=62931
+
+        * WebCoreSupport/ChromeClientQt.cpp:
+        (WebCore::ChromeClientQt::loadIconForFiles): Renamed.
+        * WebCoreSupport/ChromeClientQt.h:
+
 2011-06-17  Alexis Menard  <alexis.menard@openbossa.org>
 
         Reviewed by Andreas Kling.
index 655e872..ef52efa 100644 (file)
@@ -34,6 +34,7 @@
 #include "DatabaseTracker.h"
 #include "Document.h"
 #include "FileChooser.h"
+#include "FileIconLoader.h"
 #include "Frame.h"
 #include "FrameLoadRequest.h"
 #include "FrameLoader.h"
@@ -608,9 +609,9 @@ void ChromeClientQt::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> prpFileC
     }
 }
 
-void ChromeClientQt::chooseIconForFiles(const Vector<String>& filenames, FileChooser* chooser)
+void ChromeClientQt::loadIconForFiles(const Vector<String>& filenames, FileIconLoader* loader)
 {
-    chooser->iconLoaded(Icon::createIconForFiles(filenames));
+    loader->notifyFinished(Icon::createIconForFiles(filenames));
 }
 
 void ChromeClientQt::setCursor(const Cursor& cursor)
index 88e642c..647635a 100644 (file)
@@ -46,6 +46,7 @@ class QWebPage;
 namespace WebCore {
 
 class FileChooser;
+class FileIconLoader;
 class FloatRect;
 class Page;
 struct FrameLoadRequest;
@@ -174,7 +175,7 @@ public:
     FullScreenVideoQt* fullScreenVideo();
 #endif
      virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
-     virtual void chooseIconForFiles(const Vector<String>&, FileChooser*);
+     virtual void loadIconForFiles(const Vector<String>&, FileIconLoader*);
 
     virtual void formStateDidChange(const Node*) { }
 
index 9d8f79e..297ee4e 100644 (file)
@@ -1,3 +1,14 @@
+2011-06-18  Dimitri Glazkov  <dglazkov@chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Separate concerns of loading file icons and choosing files.
+        https://bugs.webkit.org/show_bug.cgi?id=62931
+
+        * WebCoreSupport/WebChromeClient.cpp:
+        (WebChromeClient::loadIconForFiles): Renamed.
+        * WebCoreSupport/WebChromeClient.h:
+
 2011-06-16  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r89026.
index 2a23748..f7938b3 100644 (file)
@@ -42,6 +42,7 @@
 #include <WebCore/ContextMenu.h>
 #include <WebCore/Cursor.h>
 #include <WebCore/FileChooser.h>
+#include <WebCore/FileIconLoader.h>
 #include <WebCore/FloatRect.h>
 #include <WebCore/Frame.h>
 #include <WebCore/FrameLoadRequest.h>
@@ -789,9 +790,9 @@ void WebChromeClient::runOpenPanel(Frame*, PassRefPtr<FileChooser> prpFileChoose
     // FIXME: Show some sort of error if too many files are selected and the buffer is too small.  For now, this will fail silently.
 }
 
-void WebChromeClient::chooseIconForFiles(const Vector<WTF::String>& filenames, WebCore::FileChooser* chooser)
+void WebChromeClient::loadIconForFiles(const Vector<WTF::String>& filenames, WebCore::FileIconLoader* loader)
 {
-    chooser->iconLoaded(Icon::createIconForFiles(filenames));
+    loader->notifyFinished(Icon::createIconForFiles(filenames));
 }
 
 void WebChromeClient::setCursor(const Cursor& cursor)
index 1529e1c..18cbb6b 100644 (file)
@@ -136,7 +136,7 @@ public:
     virtual bool paintCustomScrollCorner(WebCore::GraphicsContext*, const WebCore::FloatRect&);
 
     virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>);
-    virtual void chooseIconForFiles(const Vector<WTF::String>&, WebCore::FileChooser*);
+    virtual void loadIconForFiles(const Vector<WTF::String>&, WebCore::FileIconLoader*);
 
     virtual void setCursor(const WebCore::Cursor&);
     virtual void setLastSetCursorToCurrentCursor();
index 197996f..d794bdd 100644 (file)
@@ -1,3 +1,14 @@
+2011-06-18  Dimitri Glazkov  <dglazkov@chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Separate concerns of loading file icons and choosing files.
+        https://bugs.webkit.org/show_bug.cgi?id=62931
+
+        * WebCoreSupport/ChromeClientWinCE.cpp:
+        (WebKit::ChromeClientWinCE::loadIconForFiles): Renamed.
+        * WebCoreSupport/ChromeClientWinCE.h:
+
 2011-06-12  Adam Barth  <abarth@webkit.org>
 
         Reviewed by Alexey Proskuryakov.
index 4424c01..9c9d564 100644 (file)
@@ -26,6 +26,7 @@
 #include "ChromeClientWinCE.h"
 
 #include "FileChooser.h"
+#include "FileIconLoader.h"
 #include "Icon.h"
 #include "NotImplemented.h"
 #include "NavigationAction.h"
@@ -350,9 +351,9 @@ void ChromeClientWinCE::runOpenPanel(Frame*, PassRefPtr<FileChooser> prpFileChoo
     notImplemented();
 }
 
-void ChromeClientWinCE::chooseIconForFiles(const Vector<String>& filenames, FileChooser* chooser)
+void ChromeClientWinCE::loadIconForFiles(const Vector<String>& filenames, FileIconLoader* loader)
 {
-    chooser->iconLoaded(Icon::createIconForFiles(filenames));
+    loader->notifyFinished(Icon::createIconForFiles(filenames));
 }
 
 void ChromeClientWinCE::setCursor(const Cursor&)
index 13c9ec0..41db7cd 100644 (file)
@@ -149,7 +149,7 @@ public:
 
     virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>);
     // Asynchronous request to load an icon for specified filenames.
-    virtual void chooseIconForFiles(const Vector<WTF::String>&, WebCore::FileChooser*);
+    virtual void loadIconForFiles(const Vector<WTF::String>&, WebCore::FileIconLoader*);
 
     // Notification that the given form element has changed. This function
     // will be called frequently, so handling should be very fast.
index a399d20..75e3701 100644 (file)
@@ -1,3 +1,14 @@
+2011-06-18  Dimitri Glazkov  <dglazkov@chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Separate concerns of loading file icons and choosing files.
+        https://bugs.webkit.org/show_bug.cgi?id=62931
+
+        * WebKitSupport/ChromeClientWx.cpp:
+        (WebCore::ChromeClientWx::chooseIconForFiles): Renamed.
+        * WebKitSupport/ChromeClientWx.h:
+
 2011-06-18  Holger Hans Peter Freyther  <holger@moiji-mobile.com>
 
         Reviewed by Brent Fulgham.
index 19096de..12e1251 100644 (file)
@@ -33,6 +33,7 @@
 #include "DatabaseTracker.h"
 #endif
 #include "FileChooser.h"
+#include "FileIconLoader.h"
 #include "FloatRect.h"
 #include "Frame.h"
 #include "FrameLoadRequest.h"
@@ -455,9 +456,9 @@ void ChromeClientWx::runOpenPanel(Frame*, PassRefPtr<FileChooser>)
     notImplemented();
 }
 
-void ChromeClientWx::chooseIconForFiles(const Vector<String>& filenames, FileChooser* chooser)
+void ChromeClientWx::chooseIconForFiles(const Vector<String>& filenames, FileIconLoader* loader)
 {
-    chooser->iconLoaded(Icon::createIconForFiles(filenames));
+    loader->notifyFinished(Icon::createIconForFiles(filenames));
 }
 
 void ChromeClientWx::setCursor(const Cursor& cursor)
index 820c8ab..65587c7 100644 (file)
@@ -136,7 +136,7 @@ public:
 #endif
 
     virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
-    virtual void chooseIconForFiles(const Vector<String>&, FileChooser*);
+    virtual void loadIconForFiles(const Vector<String>&, FileIconLoader*);
 
     virtual void formStateDidChange(const Node*) { }
 
index 4ffbef5..3d76528 100644 (file)
@@ -1,3 +1,14 @@
+2011-06-18  Dimitri Glazkov  <dglazkov@chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Separate concerns of loading file icons and choosing files.
+        https://bugs.webkit.org/show_bug.cgi?id=62931
+
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::loadIconForFiles): Renamed.
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+
 2011-06-18  Eunmi Lee  <eunmi15.lee@samsung.com>
 
         Reviewed by Sam Weinig.
index ea004fc..a6f0cde 100644 (file)
@@ -46,6 +46,7 @@
 #include "WebSearchPopupMenu.h"
 #include <WebCore/DatabaseTracker.h>
 #include <WebCore/FileChooser.h>
+#include <WebCore/FileIconLoader.h>
 #include <WebCore/Frame.h>
 #include <WebCore/FrameLoader.h>
 #include <WebCore/FrameView.h>
@@ -636,9 +637,9 @@ void WebChromeClient::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> prpFile
     m_page->send(Messages::WebPageProxy::RunOpenPanel(static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame()->frameID(), parameters));
 }
 
-void WebChromeClient::chooseIconForFiles(const Vector<String>& filenames, FileChooser* chooser)
+void WebChromeClient::loadIconForFiles(const Vector<String>& filenames, FileIconLoader* loader)
 {
-    chooser->iconLoaded(Icon::createIconForFiles(filenames));
+    loader->notifyFinished(Icon::createIconForFiles(filenames));
 }
 
 void WebChromeClient::setCursor(const WebCore::Cursor& cursor)
index 73a122f..d28671f 100644 (file)
@@ -169,7 +169,7 @@ private:
     virtual void cancelGeolocationPermissionRequestForFrame(WebCore::Frame*, WebCore::Geolocation*);
 
     virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>);
-    virtual void chooseIconForFiles(const Vector<String>&, WebCore::FileChooser*);
+    virtual void loadIconForFiles(const Vector<String>&, WebCore::FileIconLoader*);
 
     virtual void setCursor(const WebCore::Cursor&);