| Differences between
and this patch
- a/WebKit/chromium/ChangeLog +22 lines
Lines 1-3 a/WebKit/chromium/ChangeLog_sec1
1
2010-01-13  Kent Tamura  <tkent@chromium.org>
2
3
        Reviewed by NOBODY (OOPS!).
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
1
2010-01-13  Jeremy Orlow  <jorlow@chromium.org>
23
2010-01-13  Jeremy Orlow  <jorlow@chromium.org>
2
24
3
        Reviewed by Darin Fisher.
25
        Reviewed by Darin Fisher.
- a/WebKit/chromium/WebKit.gyp +1 lines
Lines 108-113 a/WebKit/chromium/WebKit.gyp_sec1
108
                'public/WebEditingAction.h',
108
                'public/WebEditingAction.h',
109
                'public/WebElement.h',
109
                'public/WebElement.h',
110
                'public/WebFileChooserCompletion.h',
110
                'public/WebFileChooserCompletion.h',
111
                'public/WebFileChooserParams.h',
111
                'public/WebFindOptions.h',
112
                'public/WebFindOptions.h',
112
                'public/WebFrame.h',
113
                'public/WebFrame.h',
113
                'public/WebFrameClient.h',
114
                'public/WebFrameClient.h',
- a/WebKit/chromium/public/WebFileChooserParams.h +66 lines
Line 0 a/WebKit/chromium/public/WebFileChooserParams.h_sec1
1
/*
2
 * Copyright (C) 2010 Google Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions are
6
 * met:
7
 *
8
 *     * Redistributions of source code must retain the above copyright
9
 * notice, this list of conditions and the following disclaimer.
10
 *     * Redistributions in binary form must reproduce the above
11
 * copyright notice, this list of conditions and the following disclaimer
12
 * in the documentation and/or other materials provided with the
13
 * distribution.
14
 *     * Neither the name of Google Inc. nor the names of its
15
 * contributors may be used to endorse or promote products derived from
16
 * this software without specific prior written permission.
17
 *
18
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
 */
30
31
#ifndef WebFileChooserParams_h
32
#define WebFileChooserParams_h
33
34
#include "WebString.h"
35
#include "WebFileChooserCompletion.h"
36
#include "WebVector.h"
37
38
namespace WebKit {
39
40
struct WebFileChooserParams {
41
    // If |multiSelect| is true, the dialog allow to select multiple files.
42
    bool multiSelect;
43
    // |title| is a title of a file chooser dialog. It can be an empty string.
44
    WebString title;
45
    // |initialValue| is a filename which the dialog should select by default.
46
    // It can be an empty string.
47
    WebString initialValue;
48
    // |acceptTypes| has a comma-separated MIME types such as "audio/*,text/plain".
49
    // The dialog may restrict selectable files to the specified MIME types.
50
    // This value comes from an 'accept' attribute value of an INPUT element.
51
    // So it might be a wrong formatted string.
52
    WebString acceptTypes;
53
    // |selectedFiles| has filenames which a file upload control already select.
54
    // A WebViewClient implementation may ask a user to select
55
    //  - removing a file from the selected files,
56
    //  - appending other files, or
57
    //  - replacing with other files
58
    // before opening a file chooser dialog.
59
    WebVector<WebString> selectedFiles;
60
    // WebFileChooserCompletion::didChooseFile() will receive resultant filenames.
61
    WebFileChooserCompletion* chooserCompletion;
62
};
63
64
} // namespace WebKit
65
66
#endif
- a/WebKit/chromium/public/WebViewClient.h -4 / +8 lines
Lines 34-39 a/WebKit/chromium/public/WebViewClient.h_sec1
34
#include "WebDragOperation.h"
34
#include "WebDragOperation.h"
35
#include "WebEditingAction.h"
35
#include "WebEditingAction.h"
36
#include "WebFileChooserCompletion.h"
36
#include "WebFileChooserCompletion.h"
37
#include "WebFileChooserParams.h"
37
#include "WebString.h"
38
#include "WebString.h"
38
#include "WebTextAffinity.h"
39
#include "WebTextAffinity.h"
39
#include "WebTextDirection.h"
40
#include "WebTextDirection.h"
Lines 160-173 public: a/WebKit/chromium/public/WebViewClient.h_sec2
160
161
161
    // Dialogs -------------------------------------------------------------
162
    // Dialogs -------------------------------------------------------------
162
163
163
    // This method returns immediately after showing the dialog. When the
164
    // Deprecated. Use runFileChooser(const WebFileChooserParams&) instead.
164
    // dialog is closed, it should call the WebFileChooserCompletion to
165
    // pass the results of the dialog. Returns false if
166
    // WebFileChooseCompletion will never be called.
167
    virtual bool runFileChooser(
165
    virtual bool runFileChooser(
168
        bool multiSelect, const WebString& title,
166
        bool multiSelect, const WebString& title,
169
        const WebString& initialValue, WebFileChooserCompletion*) { return false; }
167
        const WebString& initialValue, WebFileChooserCompletion*) { return false; }
170
168
169
    // This method returns immediately after showing the dialog. When the
170
    // dialog is closed, it should call the WebFileChooserCompletion to
171
    // pass the results of the dialog. Returns false if
172
    // WebFileChooseCompletion in WebFileChooserParams will never be called.
173
    virtual bool runFileChooser(const WebFileChooserParams&) { return false; }
174
171
    // Displays a modal alert dialog containing the given message.  Returns
175
    // Displays a modal alert dialog containing the given message.  Returns
172
    // once the user dismisses the dialog.
176
    // once the user dismisses the dialog.
173
    virtual void runModalAlertDialog(
177
    virtual void runModalAlertDialog(
- a/WebKit/chromium/src/ChromeClientImpl.cpp -16 / +21 lines
Lines 560-581 void ChromeClientImpl::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> fileCh a/WebKit/chromium/src/ChromeClientImpl.cpp_sec1
560
    if (!client)
560
    if (!client)
561
        return;
561
        return;
562
562
563
    bool multipleFiles = fileChooser->allowsMultipleFiles();
563
    WebFileChooserParams params;
564
564
    params.multiSelect = fileChooser->allowsMultipleFiles();
565
    WebString suggestion;
565
    params.acceptTypes = fileChooser->acceptTypes();
566
    if (fileChooser->filenames().size() > 0)
566
    const Vector<String>& selectedFiles = fileChooser->filenames();
567
        suggestion = fileChooser->filenames()[0];
567
    params.selectedFiles = WebVector<WebString>(selectedFiles);
568
568
    if (selectedFiles.size() > 0)
569
    WebFileChooserCompletionImpl* chooserCompletion =
569
        params.initialValue = selectedFiles[0];
570
        new WebFileChooserCompletionImpl(fileChooser);
570
    params.chooserCompletion = new WebFileChooserCompletionImpl(fileChooser);
571
    bool ok = client->runFileChooser(multipleFiles,
571
572
                                     WebString(),
572
    if (client->runFileChooser(params))
573
                                     suggestion,
573
        return;
574
                                     chooserCompletion);
574
575
    if (!ok) {
575
    // Choosing with new function failed, so fallback to old function.
576
        // Choosing failed, so do callback with an empty list.
576
    if (client->runFileChooser(params.multiSelect,
577
        chooserCompletion->didChooseFile(WebVector<WebString>());
577
                               params.title,
578
    }
578
                               params.initialValue,
579
                               params.chooserCompletion))
580
        return;
581
582
    // Choosing with the old function failed, so do callback with an empty list.
583
    params.chooserCompletion->didChooseFile(WebVector<WebString>());
579
}
584
}
580
585
581
void ChromeClientImpl::popupOpened(PopupContainer* popupContainer,
586
void ChromeClientImpl::popupOpened(PopupContainer* popupContainer,

Return to Bug 32473