summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/renderer/print_web_view_helper.h6
-rw-r--r--chrome/renderer/render_view.cc58
-rw-r--r--chrome/renderer/render_view.h13
-rw-r--r--webkit/api/public/WebFileChooserCompletion.h51
-rw-r--r--webkit/api/public/WebViewClient.h18
-rw-r--r--webkit/api/src/WebFileChooserCompletionImpl.cpp60
-rw-r--r--webkit/api/src/WebFileChooserCompletionImpl.h59
-rw-r--r--webkit/glue/chrome_client_impl.cc65
-rw-r--r--webkit/glue/webview_delegate.h23
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.h4
-rw-r--r--webkit/webkit.gyp3
11 files changed, 260 insertions, 100 deletions
diff --git a/chrome/renderer/print_web_view_helper.h b/chrome/renderer/print_web_view_helper.h
index 6124257..5c14475 100644
--- a/chrome/renderer/print_web_view_helper.h
+++ b/chrome/renderer/print_web_view_helper.h
@@ -183,6 +183,12 @@ class PrintWebViewHelper : public WebViewDelegate {
WebKit::WebFrame* frame, const WebKit::WebString& message) {
return true;
}
+ virtual bool runFileChooser(
+ bool multi_select, const WebKit::WebString& title,
+ const WebKit::WebString& initial_value,
+ WebKit::WebFileChooserCompletion* chooser_completion) {
+ return false;
+ }
virtual void setStatusText(const WebKit::WebString& text) {}
virtual void setMouseOverURL(const WebKit::WebURL& url) {}
virtual void setToolTipText(
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 3cce3a9..7afabfe 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -70,6 +70,7 @@
#include "webkit/api/public/WebScriptSource.h"
#include "webkit/api/public/WebSecurityOrigin.h"
#include "webkit/api/public/WebSize.h"
+#include "webkit/api/public/WebString.h"
#include "webkit/api/public/WebURL.h"
#include "webkit/api/public/WebURLError.h"
#include "webkit/api/public/WebURLRequest.h"
@@ -213,6 +214,7 @@ RenderView::RenderView(RenderThreadBase* render_thread,
ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)),
devtools_agent_(NULL),
devtools_client_(NULL),
+ file_chooser_completion_(NULL),
history_back_list_count_(0),
history_forward_list_count_(0),
has_unload_listener_(false),
@@ -246,6 +248,10 @@ RenderView::~RenderView() {
delete *i;
}
+ // If file chooser is still waiting for answer, dispatch empty answer.
+ if (file_chooser_completion_)
+ file_chooser_completion_->didChooseFile(WebVector<WebString>());
+
#if defined(OS_MACOSX)
// Tell the spellchecker that the document is closed.
if (has_document_tag_)
@@ -1250,25 +1256,6 @@ uint32 RenderView::GetCPBrowsingContext() {
return context;
}
-void RenderView::RunFileChooser(bool multi_select,
- const string16& title,
- const FilePath& default_filename,
- WebFileChooserCallback* file_chooser) {
- if (file_chooser_.get()) {
- // TODO(brettw): bug 1235154: This should be a synchronous message to deal
- // with the fact that web pages can programatically trigger this. With the
- // asnychronous messages, we can get an additional call when one is pending,
- // which this test is for. For now, we just ignore the additional file
- // chooser request. WebKit doesn't do anything to expect the callback, so
- // we can just ignore calling it.
- delete file_chooser;
- return;
- }
- file_chooser_.reset(file_chooser);
- Send(new ViewHostMsg_RunFileChooser(routing_id_, multi_select, title,
- default_filename));
-}
-
void RenderView::AddSearchProvider(const std::string& url) {
AddGURLSearchProvider(GURL(url),
false); // not autodetected
@@ -1562,6 +1549,27 @@ void RenderView::updateSpellingUIWithMisspelledWord(const WebString& word) {
routing_id_, UTF16ToWideHack(word)));
}
+bool RenderView::runFileChooser(
+ bool multi_select,
+ const WebKit::WebString& title,
+ const WebKit::WebString& initial_value,
+ WebKit::WebFileChooserCompletion* chooser_completion) {
+ if (file_chooser_completion_) {
+ // TODO(brettw): bug 1235154: This should be a synchronous message to deal
+ // with the fact that web pages can programatically trigger this. With the
+ // asnychronous messages, we can get an additional call when one is pending,
+ // which this test is for. For now, we just ignore the additional file
+ // chooser request. WebKit doesn't do anything to expect the callback, so
+ // we can just ignore calling it.
+ return false;
+ }
+ file_chooser_completion_ = chooser_completion;
+ Send(new ViewHostMsg_RunFileChooser(
+ routing_id_, multi_select, title,
+ webkit_glue::WebStringToFilePath(initial_value)));
+ return true;
+}
+
void RenderView::runModalAlertDialog(
WebFrame* frame, const WebString& message) {
RunJavaScriptMessage(MessageBoxFlags::kIsJavascriptAlert,
@@ -2988,11 +2996,17 @@ void RenderView::OnFileChooserResponse(
const std::vector<FilePath>& file_names) {
// This could happen if we navigated to a different page before the user
// closed the chooser.
- if (!file_chooser_.get())
+ if (!file_chooser_completion_)
return;
- file_chooser_->OnFileChoose(file_names);
- file_chooser_.reset();
+ WebKit::WebVector<WebKit::WebString> ws_file_names(file_names.size());
+ for (size_t i = 0; i < file_names.size(); ++i) {
+ ws_file_names[i] = webkit_glue::FilePathToWebString(file_names[i]);
+ }
+
+ file_chooser_completion_->didChooseFile(ws_file_names);
+ // Reset the chooser pointer
+ file_chooser_completion_ = NULL;
}
void RenderView::OnEnableViewSourceMode() {
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index ddcc1a4..266a8ed 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -163,10 +163,6 @@ class RenderView : public RenderWidget,
int64 node_id);
virtual void RemoveStoredAutofillEntry(const std::wstring& field_name,
const std::wstring& text);
- virtual void RunFileChooser(bool multi_select,
- const string16& title,
- const FilePath& initial_filename,
- WebFileChooserCallback* file_chooser);
virtual void LoadNavigationErrorPage(
WebKit::WebFrame* frame,
const WebKit::WebURLRequest& failed_request,
@@ -244,6 +240,11 @@ class RenderView : public RenderWidget,
virtual bool isShowingSpellingUI();
virtual void updateSpellingUIWithMisspelledWord(
const WebKit::WebString& word);
+ virtual bool runFileChooser(
+ bool multi_select,
+ const WebKit::WebString& title,
+ const WebKit::WebString& initial_value,
+ WebKit::WebFileChooserCompletion* chooser_completion);
virtual void runModalAlertDialog(
WebKit::WebFrame* frame, const WebKit::WebString& message);
virtual bool runModalConfirmDialog(
@@ -841,7 +842,9 @@ class RenderView : public RenderWidget,
// render views.
scoped_ptr<DevToolsClient> devtools_client_;
- scoped_ptr<WebFileChooserCallback> file_chooser_;
+ // A pointer to a file chooser completion object. When not empty, file
+ // choosing operation is underway.
+ WebKit::WebFileChooserCompletion* file_chooser_completion_;
int history_back_list_count_;
int history_forward_list_count_;
diff --git a/webkit/api/public/WebFileChooserCompletion.h b/webkit/api/public/WebFileChooserCompletion.h
new file mode 100644
index 0000000..85c1f7e
--- /dev/null
+++ b/webkit/api/public/WebFileChooserCompletion.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 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.
+ */
+
+#ifndef WebFileChooserCompletion_h
+#define WebFileChooserCompletion_h
+
+namespace WebKit {
+ class WebString;
+ template <typename T> class WebVector;
+
+ // Gets called back when WebViewClient finished choosing a file.
+ class WebFileChooserCompletion {
+ public:
+ // Called with zero or more file names. Zero-lengthed vector means that
+ // the user cancelled or that file choosing failed. The callback instance
+ // is destroyed when this method is called.
+ virtual void didChooseFile(const WebVector<WebString>& fileNames) = 0;
+ protected:
+ virtual ~WebFileChooserCompletion() {}
+ };
+
+} // namespace WebKit
+
+#endif
diff --git a/webkit/api/public/WebViewClient.h b/webkit/api/public/WebViewClient.h
index 60691fa..7f9eb70 100644
--- a/webkit/api/public/WebViewClient.h
+++ b/webkit/api/public/WebViewClient.h
@@ -33,6 +33,7 @@
#include "WebDragOperation.h"
#include "WebEditingAction.h"
+#include "WebFileChooserCompletion.h"
#include "WebTextAffinity.h"
#include "WebWidgetClient.h"
@@ -153,6 +154,14 @@ namespace WebKit {
// Dialogs -------------------------------------------------------------
+ // 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*) = 0;
+
// Displays a modal alert dialog containing the given message. Returns
// once the user dismisses the dialog.
virtual void runModalAlertDialog(
@@ -180,15 +189,6 @@ namespace WebKit {
virtual bool runModalBeforeUnloadDialog(
WebFrame*, const WebString& message) = 0;
- // 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.
- // FIXME hook this up
- //virtual void runFileChooser(
- // bool multiSelect, const WebString& title,
- // const WebString& initialValue, WebFileChooserCompletion*) = 0;
-
-
// UI ------------------------------------------------------------------
// Called when script modifies window.status
diff --git a/webkit/api/src/WebFileChooserCompletionImpl.cpp b/webkit/api/src/WebFileChooserCompletionImpl.cpp
new file mode 100644
index 0000000..4152dc5
--- /dev/null
+++ b/webkit/api/src/WebFileChooserCompletionImpl.cpp
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 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 "WebFileChooserCompletionImpl.h"
+
+namespace WebKit {
+
+WebFileChooserCompletionImpl::WebFileChooserCompletionImpl(PassRefPtr<WebCore::FileChooser> chooser)
+ : m_fileChooser(chooser)
+{
+}
+
+WebFileChooserCompletionImpl::~WebFileChooserCompletionImpl()
+{
+}
+
+void WebFileChooserCompletionImpl::didChooseFile(const WebVector<WebString>& fileNames)
+{
+ if (fileNames.size() == 1)
+ m_fileChooser->chooseFile(fileNames[0]);
+ else {
+ // This clause handles a case of file_names.size()==0 too.
+ Vector<WebCore::String> paths;
+ for (size_t i = 0; i < fileNames.size(); ++i)
+ paths.append(fileNames[i]);
+ m_fileChooser->chooseFiles(paths);
+ }
+ // This object is no longer needed.
+ delete this;
+}
+
+} // namespace WebKit
diff --git a/webkit/api/src/WebFileChooserCompletionImpl.h b/webkit/api/src/WebFileChooserCompletionImpl.h
new file mode 100644
index 0000000..6c262a8
--- /dev/null
+++ b/webkit/api/src/WebFileChooserCompletionImpl.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 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.
+ */
+
+#ifndef WebFileChooserCompletionImpl_h
+#define WebFileChooserCompletionImpl_h
+
+#include "FileChooser.h"
+#include <wtf/PassRefPtr.h>
+// FIXME: This relative path is a temporary hack to support using this
+// header from webkit/glue.
+#include "../public/WebFileChooserCompletion.h"
+#include "../public/WebString.h"
+#include "../public/WebVector.h"
+
+using WebKit::WebFileChooserCompletion;
+using WebKit::WebString;
+using WebKit::WebVector;
+
+namespace WebKit {
+
+ class WebFileChooserCompletionImpl : public WebFileChooserCompletion {
+ public:
+ WebFileChooserCompletionImpl(PassRefPtr<WebCore::FileChooser> chooser);
+ ~WebFileChooserCompletionImpl();
+ virtual void didChooseFile(const WebVector<WebString>& fileNames);
+ private:
+ RefPtr<WebCore::FileChooser> m_fileChooser;
+ };
+
+} // namespace WebKit
+
+#endif
diff --git a/webkit/glue/chrome_client_impl.cc b/webkit/glue/chrome_client_impl.cc
index 4ea1f40..691340d 100644
--- a/webkit/glue/chrome_client_impl.cc
+++ b/webkit/glue/chrome_client_impl.cc
@@ -31,6 +31,7 @@
#include "googleurl/src/gurl.h"
#include "webkit/api/public/WebConsoleMessage.h"
#include "webkit/api/public/WebCursorInfo.h"
+#include "webkit/api/public/WebFileChooserCompletion.h"
#include "webkit/api/public/WebFrameClient.h"
#include "webkit/api/public/WebInputEvent.h"
#include "webkit/api/public/WebKit.h"
@@ -38,7 +39,9 @@
#include "webkit/api/public/WebRect.h"
#include "webkit/api/public/WebTextDirection.h"
#include "webkit/api/public/WebURLRequest.h"
+#include "webkit/api/public/WebViewClient.h"
#include "webkit/api/src/NotificationPresenterImpl.h"
+#include "webkit/api/src/WebFileChooserCompletionImpl.h"
#include "webkit/api/src/WrappedResourceRequest.h"
#include "webkit/glue/chrome_client_impl.h"
#include "webkit/glue/glue_util.h"
@@ -53,6 +56,7 @@ using WebCore::PopupItem;
using WebKit::WebConsoleMessage;
using WebKit::WebCursorInfo;
+using WebKit::WebFileChooserCompletionImpl;
using WebKit::WebInputEvent;
using WebKit::WebMouseEvent;
using WebKit::WebNavigationPolicy;
@@ -63,37 +67,10 @@ using WebKit::WebTextDirection;
using WebKit::WebURL;
using WebKit::WebURLRequest;
using WebKit::WebVector;
+using WebKit::WebViewClient;
using WebKit::WebWidget;
using WebKit::WrappedResourceRequest;
-// Callback class that's given to the WebViewDelegate during a file choose
-// operation.
-class WebFileChooserCallbackImpl : public WebFileChooserCallback {
- public:
- WebFileChooserCallbackImpl(PassRefPtr<WebCore::FileChooser> file_chooser)
- : file_chooser_(file_chooser) {
- }
-
- virtual void OnFileChoose(const std::vector<FilePath>& file_names) {
- if (file_names.size() == 1) {
- file_chooser_->chooseFile(
- webkit_glue::FilePathStringToString(file_names.front().value()));
- } else {
- // This clause handles a case of file_names.size()==0 too.
- Vector<WebCore::String> paths;
- for (std::vector<FilePath>::const_iterator filename =
- file_names.begin(); filename != file_names.end(); ++filename) {
- paths.append(webkit_glue::FilePathStringToString((*filename).value()));
- }
- file_chooser_->chooseFiles(paths);
- }
- }
-
- private:
- RefPtr<WebCore::FileChooser> file_chooser_;
- DISALLOW_COPY_AND_ASSIGN(WebFileChooserCallbackImpl);
-};
-
ChromeClientImpl::ChromeClientImpl(WebViewImpl* webview)
: webview_(webview),
toolbars_visible_(true),
@@ -543,21 +520,27 @@ void ChromeClientImpl::exceededDatabaseQuota(WebCore::Frame* frame,
}
void ChromeClientImpl::runOpenPanel(WebCore::Frame* frame,
- PassRefPtr<WebCore::FileChooser> fileChooser) {
- WebViewDelegate* delegate = webview_->delegate();
- if (!delegate)
+ PassRefPtr<WebCore::FileChooser> file_chooser) {
+ WebViewClient* client = webview_->client();
+ if (!client)
return;
- bool multiple_files = fileChooser->allowsMultipleFiles();
-
- FilePath suggestion;
- if (fileChooser->filenames().size() > 0)
- suggestion = FilePath(
- webkit_glue::StringToFilePathString(fileChooser->filenames()[0]));
-
- WebFileChooserCallbackImpl* chooser =
- new WebFileChooserCallbackImpl(fileChooser);
- delegate->RunFileChooser(multiple_files, string16(), suggestion, chooser);
+ bool multiple_files = file_chooser->allowsMultipleFiles();
+
+ WebString suggestion;
+ if (file_chooser->filenames().size() > 0)
+ suggestion = webkit_glue::StringToWebString(file_chooser->filenames()[0]);
+
+ WebFileChooserCompletionImpl* chooser_completion =
+ new WebFileChooserCompletionImpl(file_chooser);
+ bool ok = client->runFileChooser(multiple_files,
+ WebString(),
+ suggestion,
+ chooser_completion);
+ if (!ok) {
+ // Choosing failed, so do callback with an empty list.
+ chooser_completion->didChooseFile(WebVector<WebString>());
+ }
}
void ChromeClientImpl::popupOpened(PopupContainer* popup_container,
diff --git a/webkit/glue/webview_delegate.h b/webkit/glue/webview_delegate.h
index 72e1997..5ad7b09 100644
--- a/webkit/glue/webview_delegate.h
+++ b/webkit/glue/webview_delegate.h
@@ -53,18 +53,6 @@ class WebDevToolsAgentDelegate;
class WebView;
struct ContextMenuMediaParams;
-// Interface passed in to the WebViewDelegate to receive notification of the
-// result of an open file dialog.
-class WebFileChooserCallback {
- public:
- WebFileChooserCallback() {}
- virtual ~WebFileChooserCallback() {}
- virtual void OnFileChoose(const std::vector<FilePath>& file_names) { }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(WebFileChooserCallback);
-};
-
// TODO(darin): Eliminate WebViewDelegate in favor of WebViewClient.
class WebViewDelegate : public WebKit::WebViewClient {
public:
@@ -115,17 +103,6 @@ class WebViewDelegate : public WebKit::WebViewClient {
// UIDelegate --------------------------------------------------------------
- // Called to display a file chooser prompt. The prompt should be pre-
- // populated with the given initial_filename string. The WebViewDelegate
- // will own the WebFileChooserCallback object and is responsible for
- // freeing it.
- virtual void RunFileChooser(bool multi_select,
- const string16& title,
- const FilePath& initial_filename,
- WebFileChooserCallback* file_chooser) {
- delete file_chooser;
- }
-
// @abstract Shows a context menu with commands relevant to a specific
// element on the current page.
// @param webview The WebView sending the delegate method.
diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h
index ccf4404..68a6b46 100644
--- a/webkit/tools/test_shell/test_webview_delegate.h
+++ b/webkit/tools/test_shell/test_webview_delegate.h
@@ -126,6 +126,10 @@ class TestWebViewDelegate : public WebViewDelegate,
virtual bool isShowingSpellingUI() { return false; }
virtual void updateSpellingUIWithMisspelledWord(
const WebKit::WebString& word) {}
+ virtual bool runFileChooser(
+ bool multi_select, const WebKit::WebString& title,
+ const WebKit::WebString& initial_value,
+ WebKit::WebFileChooserCompletion* chooser_completion){ return false; }
virtual void runModalAlertDialog(
WebKit::WebFrame* frame, const WebKit::WebString& message);
virtual bool runModalConfirmDialog(
diff --git a/webkit/webkit.gyp b/webkit/webkit.gyp
index 7bb9705..f04c262 100644
--- a/webkit/webkit.gyp
+++ b/webkit/webkit.gyp
@@ -94,6 +94,7 @@
'api/public/WebDataSource.h',
'api/public/WebDragData.h',
'api/public/WebEditingAction.h',
+ 'api/public/WebFileChooserCompletion.h',
'api/public/WebFindOptions.h',
'api/public/WebFrame.h',
'api/public/WebFrameClient.h',
@@ -190,6 +191,8 @@
'api/src/WebDataSourceImpl.cpp',
'api/src/WebDataSourceImpl.h',
'api/src/WebDragData.cpp',
+ 'api/src/WebFileChooserCompletionImpl.cpp',
+ 'api/src/WebFileChooserCompletionImpl.h',
'api/src/WebFontCache.cpp',
'api/src/WebForm.cpp',
'api/src/WebHistoryItem.cpp',