[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Thu Apr 8 01:05:59 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 3af5ca2e2b38bc92419cc35e6f792499b2f80799
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 14 17:38:56 2010 +0000

    2010-01-14  Kent Tamura  <tkent at chromium.org>
    
            Reviewed by Darin Fisher.
    
            Introduce WebFileChooserParams to convey parameters for
            WebViewClient::runFileChooser(), and add new parameters to it.
            https://bugs.webkit.org/show_bug.cgi?id=32473
    
            The new parameters are
             - selected file names
             - "accept" attribute value
    
            * WebKit.gyp: Add WebFileChooserParams.h
            * public/WebFileChooserParams.h: Added.
            * public/WebViewClient.h:
            (WebKit::WebViewClient::runFileChooser):
              Add runFileChooser() with WebFileChooserParams, and mark the old one deprecated.
            * src/ChromeClientImpl.cpp:
            (WebKit::ChromeClientImpl::runOpenPanel):
              Call the new runFileChooser() first, then call the old
              runFileChooser() if the new one failed.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53269 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 132eee9..0e41096 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,25 @@
+2010-01-14  Kent Tamura  <tkent at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        Introduce WebFileChooserParams to convey parameters for
+        WebViewClient::runFileChooser(), and add new parameters to it.
+        https://bugs.webkit.org/show_bug.cgi?id=32473
+
+        The new parameters are
+         - selected file names
+         - "accept" attribute value
+
+        * WebKit.gyp: Add WebFileChooserParams.h
+        * public/WebFileChooserParams.h: Added.
+        * public/WebViewClient.h:
+        (WebKit::WebViewClient::runFileChooser):
+          Add runFileChooser() with WebFileChooserParams, and mark the old one deprecated.
+        * src/ChromeClientImpl.cpp:
+        (WebKit::ChromeClientImpl::runOpenPanel):
+          Call the new runFileChooser() first, then call the old
+          runFileChooser() if the new one failed.
+
 2010-01-13  Kenneth Russell  <kbr at google.com>
 
         Reviewed by Oliver Hunt.
diff --git a/WebKit/chromium/WebKit.gyp b/WebKit/chromium/WebKit.gyp
index f649846..0f84efe 100644
--- a/WebKit/chromium/WebKit.gyp
+++ b/WebKit/chromium/WebKit.gyp
@@ -108,6 +108,7 @@
                 'public/WebEditingAction.h',
                 'public/WebElement.h',
                 'public/WebFileChooserCompletion.h',
+                'public/WebFileChooserParams.h',
                 'public/WebFindOptions.h',
                 'public/WebFrame.h',
                 'public/WebFrameClient.h',
diff --git a/WebKit/chromium/public/WebFileChooserParams.h b/WebKit/chromium/public/WebFileChooserParams.h
new file mode 100644
index 0000000..6359f14
--- /dev/null
+++ b/WebKit/chromium/public/WebFileChooserParams.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2010 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 WebFileChooserParams_h
+#define WebFileChooserParams_h
+
+#include "WebFileChooserCompletion.h"
+#include "WebString.h"
+#include "WebVector.h"
+
+namespace WebKit {
+
+struct WebFileChooserParams {
+    // If |multiSelect| is true, the dialog allow to select multiple files.
+    bool multiSelect;
+    // |title| is a title of a file chooser dialog. It can be an empty string.
+    WebString title;
+    // |initialValue| is a filename which the dialog should select by default.
+    // It can be an empty string.
+    WebString initialValue;
+    // |acceptTypes| has a comma-separated MIME types such as "audio/*,text/plain".
+    // The dialog may restrict selectable files to the specified MIME types.
+    // This value comes from an 'accept' attribute value of an INPUT element.
+    // So it might be a wrong formatted string.
+    WebString acceptTypes;
+    // |selectedFiles| has filenames which a file upload control already select.
+    // A WebViewClient implementation may ask a user to select
+    //  - removing a file from the selected files,
+    //  - appending other files, or
+    //  - replacing with other files
+    // before opening a file chooser dialog.
+    WebVector<WebString> selectedFiles;
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/WebKit/chromium/public/WebViewClient.h b/WebKit/chromium/public/WebViewClient.h
index 1b0a61a..16a2fca 100644
--- a/WebKit/chromium/public/WebViewClient.h
+++ b/WebKit/chromium/public/WebViewClient.h
@@ -34,6 +34,7 @@
 #include "WebDragOperation.h"
 #include "WebEditingAction.h"
 #include "WebFileChooserCompletion.h"
+#include "WebFileChooserParams.h"
 #include "WebString.h"
 #include "WebTextAffinity.h"
 #include "WebTextDirection.h"
@@ -160,13 +161,17 @@ public:
 
     // Dialogs -------------------------------------------------------------
 
+    // Deprecated. Use another runFileChooser() below instead.
+    virtual bool runFileChooser(
+        bool multiSelect, const WebString& title,
+        const WebString& initialValue, WebFileChooserCompletion*) { return false; }
+
     // This method returns immediately after showing the dialog. When the
     // dialog is closed, it should call the WebFileChooserCompletion to
     // pass the results of the dialog. Returns false if
     // WebFileChooseCompletion will never be called.
-    virtual bool runFileChooser(
-        bool multiSelect, const WebString& title,
-        const WebString& initialValue, WebFileChooserCompletion*) { return false; }
+    virtual bool runFileChooser(const WebFileChooserParams&,
+                                WebFileChooserCompletion*) { return false; }
 
     // Displays a modal alert dialog containing the given message.  Returns
     // once the user dismisses the dialog.
diff --git a/WebKit/chromium/src/ChromeClientImpl.cpp b/WebKit/chromium/src/ChromeClientImpl.cpp
index 4e20124..7552997 100644
--- a/WebKit/chromium/src/ChromeClientImpl.cpp
+++ b/WebKit/chromium/src/ChromeClientImpl.cpp
@@ -560,22 +560,27 @@ void ChromeClientImpl::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> fileCh
     if (!client)
         return;
 
-    bool multipleFiles = fileChooser->allowsMultipleFiles();
-
-    WebString suggestion;
-    if (fileChooser->filenames().size() > 0)
-        suggestion = fileChooser->filenames()[0];
-
+    WebFileChooserParams params;
+    params.multiSelect = fileChooser->allowsMultipleFiles();
+    params.acceptTypes = fileChooser->acceptTypes();
+    params.selectedFiles = fileChooser->filenames();
+    if (params.selectedFiles.size() > 0)
+        params.initialValue = params.selectedFiles[0];
     WebFileChooserCompletionImpl* chooserCompletion =
         new WebFileChooserCompletionImpl(fileChooser);
-    bool ok = client->runFileChooser(multipleFiles,
-                                     WebString(),
-                                     suggestion,
-                                     chooserCompletion);
-    if (!ok) {
-        // Choosing failed, so do callback with an empty list.
-        chooserCompletion->didChooseFile(WebVector<WebString>());
-    }
+
+    if (client->runFileChooser(params, chooserCompletion))
+        return;
+
+    // Choosing with new function failed, so fallback to old function.
+    if (client->runFileChooser(params.multiSelect,
+                               params.title,
+                               params.initialValue,
+                               chooserCompletion))
+        return;
+
+    // Choosing with the old function failed, so do callback with an empty list.
+    chooserCompletion->didChooseFile(WebVector<WebString>());
 }
 
 void ChromeClientImpl::popupOpened(PopupContainer* popupContainer,

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list