Changeset 53269 in webkit


Ignore:
Timestamp:
Jan 14, 2010 9:38:56 AM (14 years ago)
Author:
eric@webkit.org
Message:

2010-01-14 Kent Tamura <tkent@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.
Location:
trunk/WebKit/chromium
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/chromium/ChangeLog

    r53238 r53269  
     12010-01-14  Kent Tamura  <tkent@chromium.org>
     2
     3        Reviewed by Darin Fisher.
     4
     5        Introduce WebFileChooserParams to convey parameters for
     6        WebViewClient::runFileChooser(), and add new parameters to it.
     7        https://bugs.webkit.org/show_bug.cgi?id=32473
     8
     9        The new parameters are
     10         - selected file names
     11         - "accept" attribute value
     12
     13        * WebKit.gyp: Add WebFileChooserParams.h
     14        * public/WebFileChooserParams.h: Added.
     15        * public/WebViewClient.h:
     16        (WebKit::WebViewClient::runFileChooser):
     17          Add runFileChooser() with WebFileChooserParams, and mark the old one deprecated.
     18        * src/ChromeClientImpl.cpp:
     19        (WebKit::ChromeClientImpl::runOpenPanel):
     20          Call the new runFileChooser() first, then call the old
     21          runFileChooser() if the new one failed.
     22
    1232010-01-13  Kenneth Russell  <kbr@google.com>
    224
  • trunk/WebKit/chromium/WebKit.gyp

    r53144 r53269  
    109109                'public/WebElement.h',
    110110                'public/WebFileChooserCompletion.h',
     111                'public/WebFileChooserParams.h',
    111112                'public/WebFindOptions.h',
    112113                'public/WebFrame.h',
  • trunk/WebKit/chromium/public/WebViewClient.h

    r53210 r53269  
    3535#include "WebEditingAction.h"
    3636#include "WebFileChooserCompletion.h"
     37#include "WebFileChooserParams.h"
    3738#include "WebString.h"
    3839#include "WebTextAffinity.h"
     
    161162    // Dialogs -------------------------------------------------------------
    162163
     164    // Deprecated. Use another runFileChooser() below instead.
     165    virtual bool runFileChooser(
     166        bool multiSelect, const WebString& title,
     167        const WebString& initialValue, WebFileChooserCompletion*) { return false; }
     168
    163169    // This method returns immediately after showing the dialog. When the
    164170    // dialog is closed, it should call the WebFileChooserCompletion to
    165171    // pass the results of the dialog. Returns false if
    166172    // WebFileChooseCompletion will never be called.
    167     virtual bool runFileChooser(
    168         bool multiSelect, const WebString& title,
    169         const WebString& initialValue, WebFileChooserCompletion*) { return false; }
     173    virtual bool runFileChooser(const WebFileChooserParams&,
     174                                WebFileChooserCompletion*) { return false; }
    170175
    171176    // Displays a modal alert dialog containing the given message.  Returns
  • trunk/WebKit/chromium/src/ChromeClientImpl.cpp

    r50961 r53269  
    561561        return;
    562562
    563     bool multipleFiles = fileChooser->allowsMultipleFiles();
    564 
    565     WebString suggestion;
    566     if (fileChooser->filenames().size() > 0)
    567         suggestion = fileChooser->filenames()[0];
    568 
     563    WebFileChooserParams params;
     564    params.multiSelect = fileChooser->allowsMultipleFiles();
     565    params.acceptTypes = fileChooser->acceptTypes();
     566    params.selectedFiles = fileChooser->filenames();
     567    if (params.selectedFiles.size() > 0)
     568        params.initialValue = params.selectedFiles[0];
    569569    WebFileChooserCompletionImpl* chooserCompletion =
    570570        new WebFileChooserCompletionImpl(fileChooser);
    571     bool ok = client->runFileChooser(multipleFiles,
    572                                      WebString(),
    573                                      suggestion,
    574                                      chooserCompletion);
    575     if (!ok) {
    576         // Choosing failed, so do callback with an empty list.
    577         chooserCompletion->didChooseFile(WebVector<WebString>());
    578     }
     571
     572    if (client->runFileChooser(params, chooserCompletion))
     573        return;
     574
     575    // Choosing with new function failed, so fallback to old function.
     576    if (client->runFileChooser(params.multiSelect,
     577                               params.title,
     578                               params.initialValue,
     579                               chooserCompletion))
     580        return;
     581
     582    // Choosing with the old function failed, so do callback with an empty list.
     583    chooserCompletion->didChooseFile(WebVector<WebString>());
    579584}
    580585
Note: See TracChangeset for help on using the changeset viewer.