[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

tkent at chromium.org tkent at chromium.org
Sun Feb 20 23:41:21 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit e562a5e7223afe9fc430d4f72c108526b41ceb10
Author: tkent at chromium.org <tkent at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jan 24 09:15:37 2011 +0000

    2010-01-24  Kent Tamura  <tkent at chromium.org>
    
            Reviewed by Darin Fisher.
    
            [Chromium] Support icon loading for <input type=file>
            https://bugs.webkit.org/show_bug.cgi?id=38982
    
            An icon data in Chromium port is represented as WebCore::Image. We
            don't need OS-specific code anymore.
    
            * WebCore.gypi:
            * platform/graphics/Icon.h:
            (WebCore::Icon::create): Add Chromium-specific factory.
            * platform/graphics/chromium/IconChromium.cpp: Added.
            * platform/graphics/chromium/IconChromiumLinux.cpp: Removed.
            * platform/graphics/chromium/IconChromiumMac.cpp: Removed.
            * platform/graphics/chromium/IconChromiumWin.cpp: Removed.
            * platform/graphics/chromium/PlatformIcon.h:
    
    2010-01-24  Kent Tamura  <tkent at chromium.org>
    
            Reviewed by Darin Fisher.
    
            [Chromium] Support icon loading for <input type=file>
            https://bugs.webkit.org/show_bug.cgi?id=38982
    
            Implement ChromeClientImpl::chooseIconForFiles(). It delegates loading
            to WebViewClient::queryIconForFiles(), and an implementation of
            WebViewClient::queryIconForFiles() loads an icon and passes it to a
            FileChooser through WebIconLoadingCompletion.
    
            * WebKit.gyp:
            * public/WebIconLoadingCompletion.h: Added.
            (WebKit::WebIconLoadingCompletion::~WebIconLoadingCompletion):
            * public/WebViewClient.h:
            (WebKit::WebViewClient::queryIconForFiles):
            * src/ChromeClientImpl.cpp:
            (WebKit::ChromeClientImpl::chooseIconForFiles):
            * src/WebIconLoadingCompletionImpl.cpp: Added.
            (WebKit::WebIconLoadingCompletionImpl::WebIconLoadingCompletionImpl):
            (WebKit::WebIconLoadingCompletionImpl::~WebIconLoadingCompletionImpl):
            (WebKit::WebIconLoadingCompletionImpl::didLoadIcon):
            * src/WebIconLoadingCompletionImpl.h: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76491 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 57bd594..fdba21f 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2010-01-24  Kent Tamura  <tkent at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        [Chromium] Support icon loading for <input type=file>
+        https://bugs.webkit.org/show_bug.cgi?id=38982
+
+        An icon data in Chromium port is represented as WebCore::Image. We
+        don't need OS-specific code anymore.
+
+        * WebCore.gypi:
+        * platform/graphics/Icon.h:
+        (WebCore::Icon::create): Add Chromium-specific factory.
+        * platform/graphics/chromium/IconChromium.cpp: Added.
+        * platform/graphics/chromium/IconChromiumLinux.cpp: Removed.
+        * platform/graphics/chromium/IconChromiumMac.cpp: Removed.
+        * platform/graphics/chromium/IconChromiumWin.cpp: Removed.
+        * platform/graphics/chromium/PlatformIcon.h:
+
 2011-01-21  Pavel Podivilov  <podivilov at chromium.org>
 
         Reviewed by Pavel Feldman.
diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi
index 3198bde..4c60372 100644
--- a/Source/WebCore/WebCore.gypi
+++ b/Source/WebCore/WebCore.gypi
@@ -2582,9 +2582,7 @@
             'platform/graphics/chromium/GraphicsLayerChromium.h',
             'platform/graphics/chromium/HarfbuzzSkia.cpp',
             'platform/graphics/chromium/HarfbuzzSkia.h',
-            'platform/graphics/chromium/IconChromiumLinux.cpp',
-            'platform/graphics/chromium/IconChromiumMac.cpp',
-            'platform/graphics/chromium/IconChromiumWin.cpp',
+            'platform/graphics/chromium/IconChromium.cpp',
             'platform/graphics/chromium/ImageBufferData.h',
             'platform/graphics/chromium/ImageChromium.cpp',
             'platform/graphics/chromium/ImageChromiumMac.mm',
diff --git a/Source/WebCore/platform/graphics/Icon.h b/Source/WebCore/platform/graphics/Icon.h
index c83685f..2797133 100644
--- a/Source/WebCore/platform/graphics/Icon.h
+++ b/Source/WebCore/platform/graphics/Icon.h
@@ -42,6 +42,7 @@ typedef struct _GdkPixbuf GdkPixbuf;
 #elif PLATFORM(EFL)
 typedef struct _Evas_Object Evas_Object;
 #elif PLATFORM(CHROMIUM)
+#include "Image.h"
 #include "PlatformIcon.h"
 #endif
 
@@ -60,6 +61,8 @@ public:
 
 #if PLATFORM(WIN)
     static PassRefPtr<Icon> create(HICON hIcon) { return adoptRef(new Icon(hIcon)); }
+#elif PLATFORM(CHROMIUM)
+    static PassRefPtr<Icon> create(PassRefPtr<PlatformIcon> icon) { return adoptRef(new Icon(icon)); }
 #endif
 
 private:
@@ -79,8 +82,8 @@ private:
     Icon();
     Evas_Object* m_icon;
 #elif PLATFORM(CHROMIUM)
-    Icon(const PlatformIcon&);
-    PlatformIcon m_icon;
+    Icon(PassRefPtr<PlatformIcon>);
+    RefPtr<PlatformIcon> m_icon;
 #endif
 };
 
diff --git a/Source/WebCore/platform/graphics/chromium/IconChromium.cpp b/Source/WebCore/platform/graphics/chromium/IconChromium.cpp
new file mode 100644
index 0000000..398cc3b
--- /dev/null
+++ b/Source/WebCore/platform/graphics/chromium/IconChromium.cpp
@@ -0,0 +1,58 @@
+/*
+ * 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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 "Icon.h"
+
+#include "GraphicsContext.h"
+#include "PlatformString.h"
+
+namespace WebCore {
+
+Icon::Icon(PassRefPtr<PlatformIcon> icon)
+    : m_icon(icon)
+{
+}
+
+Icon::~Icon()
+{
+}
+
+void Icon::paint(GraphicsContext* context, const IntRect& rect)
+{
+    if (context->paintingDisabled())
+        return;
+
+    // An Icon doesn't know the color space of the file upload control.
+    // So use ColorSpaceDeviceRGB.
+    context->drawImage(m_icon.get(), ColorSpaceDeviceRGB, rect);
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/chromium/IconChromiumLinux.cpp b/Source/WebCore/platform/graphics/chromium/IconChromiumLinux.cpp
deleted file mode 100644
index 16f55e2..0000000
--- a/Source/WebCore/platform/graphics/chromium/IconChromiumLinux.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2008, 2009 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:
- * 
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * 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.
- *     * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
- * OWNER OR 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 "Icon.h"
-
-#include "GraphicsContext.h"
-#include "NotImplemented.h"
-#include "PlatformString.h"
-
-namespace WebCore {
-
-Icon::Icon(const PlatformIcon& icon)
-    : m_icon(icon)
-{
-}
-
-Icon::~Icon()
-{
-}
-
-void Icon::paint(GraphicsContext*, const IntRect&)
-{
-    notImplemented();
-}
-
-} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/chromium/IconChromiumMac.cpp b/Source/WebCore/platform/graphics/chromium/IconChromiumMac.cpp
deleted file mode 100644
index a24afb2..0000000
--- a/Source/WebCore/platform/graphics/chromium/IconChromiumMac.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2008, 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:
- * 
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * 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.
- *     * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
- * OWNER OR 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 "Icon.h"
-
-#include "PassRefPtr.h"
-
-// FIXME: These are temporary stubs, we need real implementations which
-// may come in the form of IconChromium.cpp.  The Windows Chromium
-// implementation is currently in IconWin.cpp.
- 
-namespace WebCore {
-
-Icon::~Icon()
-{
-}
-
-void Icon::paint(GraphicsContext*, const IntRect&)
-{
-}
-
-}
diff --git a/Source/WebCore/platform/graphics/chromium/IconChromiumWin.cpp b/Source/WebCore/platform/graphics/chromium/IconChromiumWin.cpp
deleted file mode 100644
index e958d4a..0000000
--- a/Source/WebCore/platform/graphics/chromium/IconChromiumWin.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, 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:
- * 
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * 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.
- *     * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
- * OWNER OR 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 "Icon.h"
-
-#include <windows.h>
-#include <shellapi.h>
-
-#include "GraphicsContext.h"
-#include "PlatformContextSkia.h"
-#include "PlatformString.h"
-#include "SkiaUtils.h"
-
-namespace WebCore {
-
-Icon::Icon(const PlatformIcon& icon)
-    : m_icon(icon)
-{
-}
-
-Icon::~Icon()
-{
-    if (m_icon)
-        DestroyIcon(m_icon);
-}
-
-void Icon::paint(GraphicsContext* context, const IntRect& rect)
-{
-    if (context->paintingDisabled())
-        return;
-
-    HDC hdc = context->platformContext()->canvas()->beginPlatformPaint();
-    DrawIconEx(hdc, rect.x(), rect.y(), m_icon, rect.width(), rect.height(), 0, 0, DI_NORMAL);
-    context->platformContext()->canvas()->endPlatformPaint();
-}
-
-} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/chromium/PlatformIcon.h b/Source/WebCore/platform/graphics/chromium/PlatformIcon.h
index 51613b8..b485917 100644
--- a/Source/WebCore/platform/graphics/chromium/PlatformIcon.h
+++ b/Source/WebCore/platform/graphics/chromium/PlatformIcon.h
@@ -31,11 +31,11 @@
 #ifndef PlatformIcon_h
 #define PlatformIcon_h
 
-typedef struct HICON__* HICON;
-
 namespace WebCore {
 
-typedef HICON PlatformIcon;
+class Image;
+
+typedef Image PlatformIcon;
 
 }  // namespace WebCore
 
diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog
index c529c12..6041a95 100644
--- a/Source/WebKit/chromium/ChangeLog
+++ b/Source/WebKit/chromium/ChangeLog
@@ -1,3 +1,28 @@
+2010-01-24  Kent Tamura  <tkent at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        [Chromium] Support icon loading for <input type=file>
+        https://bugs.webkit.org/show_bug.cgi?id=38982
+
+        Implement ChromeClientImpl::chooseIconForFiles(). It delegates loading
+        to WebViewClient::queryIconForFiles(), and an implementation of
+        WebViewClient::queryIconForFiles() loads an icon and passes it to a
+        FileChooser through WebIconLoadingCompletion.
+
+        * WebKit.gyp:
+        * public/WebIconLoadingCompletion.h: Added.
+        (WebKit::WebIconLoadingCompletion::~WebIconLoadingCompletion):
+        * public/WebViewClient.h:
+        (WebKit::WebViewClient::queryIconForFiles):
+        * src/ChromeClientImpl.cpp:
+        (WebKit::ChromeClientImpl::chooseIconForFiles):
+        * src/WebIconLoadingCompletionImpl.cpp: Added.
+        (WebKit::WebIconLoadingCompletionImpl::WebIconLoadingCompletionImpl):
+        (WebKit::WebIconLoadingCompletionImpl::~WebIconLoadingCompletionImpl):
+        (WebKit::WebIconLoadingCompletionImpl::didLoadIcon):
+        * src/WebIconLoadingCompletionImpl.h: Added.
+
 2011-01-22  John Abd-El-Malek  <jam at chromium.org>
 
         Reviewed by Adam Barth.
diff --git a/Source/WebKit/chromium/WebKit.gyp b/Source/WebKit/chromium/WebKit.gyp
index 3a3672c..41b29e1 100644
--- a/Source/WebKit/chromium/WebKit.gyp
+++ b/Source/WebKit/chromium/WebKit.gyp
@@ -188,6 +188,7 @@
                 'public/WebHistoryItem.h',
                 'public/WebHTTPBody.h',
                 'public/WebHTTPLoadInfo.h',
+                'public/WebIconLoadingCompletion.h',
                 'public/WebImage.h',
                 'public/WebImageDecoder.h',
                 'public/WebIDBCallbacks.h',
@@ -463,6 +464,8 @@
                 'src/WebHistoryItem.cpp',
                 'src/WebHTTPBody.cpp',
                 'src/WebHTTPLoadInfo.cpp',
+                'src/WebIconLoadingCompletionImpl.cpp',
+                'src/WebIconLoadingCompletionImpl.h',
                 'src/WebIDBCallbacksImpl.cpp',
                 'src/WebIDBCallbacksImpl.h',
                 'src/WebIDBCursorImpl.cpp',
diff --git a/Source/WebKit/chromium/public/WebIconLoadingCompletion.h b/Source/WebKit/chromium/public/WebIconLoadingCompletion.h
new file mode 100644
index 0000000..b6229aa
--- /dev/null
+++ b/Source/WebKit/chromium/public/WebIconLoadingCompletion.h
@@ -0,0 +1,53 @@
+/*
+ * 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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 WebIconLoadingCompletion_h
+#define WebIconLoadingCompletion_h
+
+namespace WebKit {
+
+class WebData;
+class WebString;
+
+// Gets called back when WebViewClient finished loading an icon.
+class WebIconLoadingCompletion {
+public:
+    // Called with the loaded icon data, which is an image data stream
+    // WebCore can decode, such as PNG. A null WebData means a failure of
+    // loading. The callback instance is destroyed when this method is called.
+    virtual void didLoadIcon(const WebData&) = 0;
+
+protected:
+    virtual ~WebIconLoadingCompletion() { }
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/Source/WebKit/chromium/public/WebViewClient.h b/Source/WebKit/chromium/public/WebViewClient.h
index 08fb942..fcc96e9 100644
--- a/Source/WebKit/chromium/public/WebViewClient.h
+++ b/Source/WebKit/chromium/public/WebViewClient.h
@@ -54,6 +54,7 @@ class WebFileChooserCompletion;
 class WebFrame;
 class WebGeolocationClient;
 class WebGeolocationService;
+class WebIconLoadingCompletion;
 class WebImage;
 class WebInputElement;
 class WebKeyboardEvent;
@@ -117,6 +118,10 @@ public:
     // Called to retrieve the provider of desktop notifications.
     virtual WebNotificationPresenter* notificationPresenter() { return 0; }
 
+    // Called to request an icon for the specified filenames.
+    // The icon is shown in a file upload control.
+    virtual bool queryIconForFiles(const WebVector<WebString>& filenames, WebIconLoadingCompletion*) { return false; }
+
 
     // Navigational --------------------------------------------------------
 
diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.cpp b/Source/WebKit/chromium/src/ChromeClientImpl.cpp
index a63a625..0e40f1d 100644
--- a/Source/WebKit/chromium/src/ChromeClientImpl.cpp
+++ b/Source/WebKit/chromium/src/ChromeClientImpl.cpp
@@ -70,6 +70,7 @@
 #include "WebFileChooserCompletionImpl.h"
 #include "WebFrameClient.h"
 #include "WebFrameImpl.h"
+#include "WebIconLoadingCompletionImpl.h"
 #include "WebInputEvent.h"
 #include "WebKit.h"
 #include "WebNode.h"
@@ -669,9 +670,13 @@ void ChromeClientImpl::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> fileCh
     chooserCompletion->didChooseFile(WebVector<WebString>());
 }
 
-void ChromeClientImpl::chooseIconForFiles(const Vector<WTF::String>&, WebCore::FileChooser*)
+void ChromeClientImpl::chooseIconForFiles(const Vector<String>& filenames, FileChooser* fileChooser)
 {
-    notImplemented();
+    if (!m_webView->client())
+        return;
+    WebIconLoadingCompletionImpl* iconCompletion = new WebIconLoadingCompletionImpl(fileChooser);
+    if (!m_webView->client()->queryIconForFiles(filenames, iconCompletion))
+        iconCompletion->didLoadIcon(WebData());
 }
 
 void ChromeClientImpl::popupOpened(PopupContainer* popupContainer,
diff --git a/Source/WebKit/chromium/src/WebIconLoadingCompletionImpl.cpp b/Source/WebKit/chromium/src/WebIconLoadingCompletionImpl.cpp
new file mode 100644
index 0000000..c1dd321
--- /dev/null
+++ b/Source/WebKit/chromium/src/WebIconLoadingCompletionImpl.cpp
@@ -0,0 +1,62 @@
+/*
+ * 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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 "WebIconLoadingCompletionImpl.h"
+
+#include "BitmapImage.h"
+#include "Icon.h"
+#include "SharedBuffer.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebIconLoadingCompletionImpl::WebIconLoadingCompletionImpl(FileChooser* chooser)
+    : m_fileChooser(chooser)
+{
+}
+
+WebIconLoadingCompletionImpl::~WebIconLoadingCompletionImpl()
+{
+}
+
+void WebIconLoadingCompletionImpl::didLoadIcon(const WebData& iconData)
+{
+    if (!iconData.isEmpty()) {
+        RefPtr<Image> image = BitmapImage::create();
+        image->setData(iconData, true);
+        m_fileChooser->iconLoaded(Icon::create(image));
+    }
+    // This object is no longer needed.
+    delete this;
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit/chromium/src/WebIconLoadingCompletionImpl.h b/Source/WebKit/chromium/src/WebIconLoadingCompletionImpl.h
new file mode 100644
index 0000000..6e6f3a8
--- /dev/null
+++ b/Source/WebKit/chromium/src/WebIconLoadingCompletionImpl.h
@@ -0,0 +1,57 @@
+/*
+ * 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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 WebIconLoadingCompletionImpl_h
+#define WebIconLoadingCompletionImpl_h
+
+#include "FileChooser.h"
+#include "WebData.h"
+#include "WebIconLoadingCompletion.h"
+#include <wtf/PassRefPtr.h>
+
+using WebKit::WebIconLoadingCompletion;
+using WebKit::WebData;
+
+namespace WebKit {
+
+class WebIconLoadingCompletionImpl : public WebIconLoadingCompletion {
+public:
+    WebIconLoadingCompletionImpl(WebCore::FileChooser*);
+    virtual void didLoadIcon(const WebData&);
+
+private:
+    ~WebIconLoadingCompletionImpl();
+
+    RefPtr<WebCore::FileChooser> m_fileChooser;
+};
+
+} // namespace WebKit
+
+#endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list