diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-27 20:43:29 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-27 20:43:29 +0000 |
commit | 31f4c7e11012ba7364ce5f84f9943523312f82a5 (patch) | |
tree | d98755c8b3faed725b0ce25f8660ded518b46156 /webkit/glue | |
parent | aece2c7fcf3d899be29249220d79a8448f2e9e0e (diff) | |
download | chromium_src-31f4c7e11012ba7364ce5f84f9943523312f82a5.zip chromium_src-31f4c7e11012ba7364ce5f84f9943523312f82a5.tar.gz chromium_src-31f4c7e11012ba7364ce5f84f9943523312f82a5.tar.bz2 |
More refactoring for WebPlugin.
This CL eliminates direct calls to WebPluginDelegate::DidFinishLoadWithReason
from WebFrameLoaderClient.
This CL also moves WebDataSourceImpl into webkit/api/src. That change was
needed so that WebPluginContainerImpl can add a WebPluginLoadObserver to it,
which WebFrameLoaderClient uses to communicate back to the WebPlugin upon
completion of the frame load.
WebViewDelegate::DidFinishLoadWithReason is modified to include url and
notify_data parameters, eliminating the URLRequestRouted method. This is done
so that we can support overlapping NPN_GetURLNotify targetting different
frames.
WebPluginContainer grows an executeScriptURL method to deal with javascript:
URLs.
NOTE: I'm working on some UI tests to better cover the case of overlapping
NPN_GetURLNotify calls.
R=jam
BUG=10036
TEST=none yet
Review URL: http://codereview.chromium.org/174514
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24655 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
23 files changed, 188 insertions, 445 deletions
diff --git a/webkit/glue/context_menu_client_impl.cc b/webkit/glue/context_menu_client_impl.cc index ca2dee8..c3c6ff2 100644 --- a/webkit/glue/context_menu_client_impl.cc +++ b/webkit/glue/context_menu_client_impl.cc @@ -28,14 +28,15 @@ MSVC_POP_WARNING(); #include "base/string_util.h" #include "webkit/api/public/WebURL.h" #include "webkit/api/public/WebURLResponse.h" +#include "webkit/api/src/WebDataSourceImpl.h" #include "webkit/glue/context_menu.h" #include "webkit/glue/glue_util.h" -#include "webkit/glue/webdatasource_impl.h" #include "webkit/glue/webview_impl.h" #include "base/word_iterator.h" using WebKit::WebDataSource; +using WebKit::WebDataSourceImpl; namespace { @@ -135,7 +136,7 @@ static ContextNodeType GetTypeAndURLFromFrame( if (frame) { WebCore::DocumentLoader* dl = frame->loader()->documentLoader(); if (dl) { - WebDataSource* ds = WebDataSourceImpl::FromLoader(dl); + WebDataSource* ds = WebDataSourceImpl::fromDocumentLoader(dl); if (ds) { node_type = page_node_type; *url = ds->hasUnreachableURL() ? ds->unreachableURL() @@ -260,7 +261,7 @@ WebCore::PlatformMenuDescription // Now retrieve the security info. WebCore::DocumentLoader* dl = selected_frame->loader()->documentLoader(); - WebDataSource* ds = WebDataSourceImpl::FromLoader(dl); + WebDataSource* ds = WebDataSourceImpl::fromDocumentLoader(dl); if (ds) security_info = ds->response().securityInfo(); diff --git a/webkit/glue/iframe_redirect_unittest.cc b/webkit/glue/iframe_redirect_unittest.cc index 1a4fa03..2778c09 100644 --- a/webkit/glue/iframe_redirect_unittest.cc +++ b/webkit/glue/iframe_redirect_unittest.cc @@ -12,6 +12,7 @@ #include "base/string_util.h" #include "webkit/api/public/WebDataSource.h" #include "webkit/api/public/WebFrame.h" +#include "webkit/api/public/WebString.h" #include "webkit/api/public/WebURL.h" #include "webkit/api/public/WebVector.h" #include "webkit/glue/webkit_glue.h" @@ -20,6 +21,7 @@ using WebKit::WebDataSource; using WebKit::WebFrame; +using WebKit::WebString; using WebKit::WebURL; using WebKit::WebVector; @@ -38,7 +40,8 @@ TEST_F(IFrameRedirectTest, Test) { test_shell_->LoadURL(test_url.c_str()); test_shell_->WaitTestFinished(); - WebFrame* iframe = test_shell_->webView()->GetFrameWithName(L"ifr"); + WebFrame* iframe = + test_shell_->webView()->GetFrameWithName(WebString::fromUTF8("ifr")); ASSERT_TRUE(iframe != NULL); WebDataSource* iframe_ds = iframe->dataSource(); ASSERT_TRUE(iframe_ds != NULL); diff --git a/webkit/glue/plugins/plugin_instance.cc b/webkit/glue/plugins/plugin_instance.cc index a753004..ad8c9bf 100644 --- a/webkit/glue/plugins/plugin_instance.cc +++ b/webkit/glue/plugins/plugin_instance.cc @@ -41,7 +41,6 @@ PluginInstance::PluginInstance(PluginLib *plugin, const std::string &mime_type) transparent_(true), webplugin_(0), mime_type_(mime_type), - get_notify_data_(NULL), use_mozilla_user_agent_(false), message_loop_(MessageLoop::current()), load_manually_(false), @@ -158,21 +157,10 @@ NPObject *PluginInstance::GetPluginScriptableObject() { return value; } -void PluginInstance::SetURLLoadData(const GURL& url, - intptr_t notify_data) { - get_url_ = url; - get_notify_data_ = notify_data; -} - // WebPluginLoadDelegate methods -void PluginInstance::DidFinishLoadWithReason(NPReason reason) { - if (!get_url_.is_empty()) { - NPP_URLNotify(get_url_.spec().c_str(), reason, - reinterpret_cast<void*>(get_notify_data_)); - } - - get_url_ = GURL(); - get_notify_data_ = NULL; +void PluginInstance::DidFinishLoadWithReason(const GURL& url, NPReason reason, + void* notify_data) { + NPP_URLNotify(url.spec().c_str(), reason, notify_data); } // NPAPI methods @@ -340,8 +328,8 @@ bool PluginInstance::NPP_Print(NPPrint* platform_print) { return false; } -void PluginInstance::SendJavaScriptStream(const std::string& url, - const std::wstring& result, +void PluginInstance::SendJavaScriptStream(const GURL& url, + const std::string& result, bool success, bool notify_needed, intptr_t notify_data) { @@ -350,12 +338,12 @@ void PluginInstance::SendJavaScriptStream(const std::string& url, new PluginStringStream(this, url, notify_needed, reinterpret_cast<void*>(notify_data)); AddStream(stream); - stream->SendToPlugin(WideToUTF8(result), "text/html"); + stream->SendToPlugin(result, "text/html"); } else { // NOTE: Sending an empty stream here will crash MacroMedia // Flash 9. Just send the URL Notify. if (notify_needed) { - this->NPP_URLNotify(url.c_str(), NPRES_DONE, + this->NPP_URLNotify(url.spec().c_str(), NPRES_DONE, reinterpret_cast<void*>(notify_data)); } } diff --git a/webkit/glue/plugins/plugin_instance.h b/webkit/glue/plugins/plugin_instance.h index bed2a55..5639211 100644 --- a/webkit/glue/plugins/plugin_instance.h +++ b/webkit/glue/plugins/plugin_instance.h @@ -135,11 +135,8 @@ class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> { // WebViewDelegate methods that we implement. This is for handling // callbacks during getURLNotify. - virtual void DidFinishLoadWithReason(NPReason reason); - - // Helper method to set some persistent data for getURLNotify since - // resource fetches happen async. - void SetURLLoadData(const GURL& url, intptr_t notify_data); + virtual void DidFinishLoadWithReason(const GURL& url, NPReason reason, + void* notify_data); // If true, send the Mozilla user agent instead of Chrome's to the plugin. bool use_mozilla_user_agent() { return use_mozilla_user_agent_; } @@ -166,7 +163,7 @@ class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> { void NPP_Destroy(); bool NPP_Print(NPPrint* platform_print); - void SendJavaScriptStream(const std::string& url, const std::wstring& result, + void SendJavaScriptStream(const GURL& url, const std::string& result, bool success, bool notify_needed, intptr_t notify_data); diff --git a/webkit/glue/plugins/plugin_string_stream.cc b/webkit/glue/plugins/plugin_string_stream.cc index f1e2a1a..3997fba 100644 --- a/webkit/glue/plugins/plugin_string_stream.cc +++ b/webkit/glue/plugins/plugin_string_stream.cc @@ -4,14 +4,16 @@ #include "webkit/glue/plugins/plugin_string_stream.h" +#include "googleurl/src/gurl.h" + namespace NPAPI { PluginStringStream::PluginStringStream( - PluginInstance *instance, - const std::string &url, + PluginInstance* instance, + const GURL& url, bool notify_needed, - void *notify_data) - : PluginStream(instance, url.c_str(), notify_needed, notify_data) { + void* notify_data) + : PluginStream(instance, url.spec().c_str(), notify_needed, notify_data) { } PluginStringStream::~PluginStringStream() { diff --git a/webkit/glue/plugins/plugin_string_stream.h b/webkit/glue/plugins/plugin_string_stream.h index a8a25ad..0946934 100644 --- a/webkit/glue/plugins/plugin_string_stream.h +++ b/webkit/glue/plugins/plugin_string_stream.h @@ -2,11 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_GLUE_PLUGIN_PLUGIN_STRING_STREAM_H__ -#define WEBKIT_GLUE_PLUGIN_PLUGIN_STRING_STREAM_H__ +#ifndef WEBKIT_GLUE_PLUGIN_PLUGIN_STRING_STREAM_H_ +#define WEBKIT_GLUE_PLUGIN_PLUGIN_STRING_STREAM_H_ #include "webkit/glue/plugins/plugin_stream.h" +class GURL; + namespace NPAPI { class PluginInstance; @@ -17,21 +19,20 @@ class PluginStringStream : public PluginStream { // Create a new stream for sending to the plugin. // If notify_needed, will notify the plugin after the data has // all been sent. - PluginStringStream(PluginInstance *instance, - const std::string &url, + PluginStringStream(PluginInstance* instance, + const GURL& url, bool notify_needed, - void *notify_data); + void* notify_data); virtual ~PluginStringStream(); // Initiates the sending of data to the plugin. - void SendToPlugin(const std::string &data, - const std::string &mime_type); + void SendToPlugin(const std::string& data, + const std::string& mime_type); private: - - DISALLOW_EVIL_CONSTRUCTORS(PluginStringStream); + DISALLOW_COPY_AND_ASSIGN(PluginStringStream); }; } // namespace NPAPI -#endif // WEBKIT_GLUE_PLUGIN_PLUGIN_STRING_STREAM_H__ +#endif // WEBKIT_GLUE_PLUGIN_PLUGIN_STRING_STREAM_H_ diff --git a/webkit/glue/plugins/webplugin_delegate_impl.cc b/webkit/glue/plugins/webplugin_delegate_impl.cc index a76e5d9..89285b6 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl.cc @@ -130,8 +130,11 @@ NPObject* WebPluginDelegateImpl::GetPluginScriptableObject() { return instance_->GetPluginScriptableObject(); } -void WebPluginDelegateImpl::DidFinishLoadWithReason(NPReason reason) { - instance()->DidFinishLoadWithReason(reason); +void WebPluginDelegateImpl::DidFinishLoadWithReason(const GURL& url, + NPReason reason, + intptr_t notify_data) { + instance()->DidFinishLoadWithReason( + url, reason, reinterpret_cast<void*>(notify_data)); } int WebPluginDelegateImpl::GetProcessId() { @@ -139,8 +142,8 @@ int WebPluginDelegateImpl::GetProcessId() { return base::GetCurrentProcId(); } -void WebPluginDelegateImpl::SendJavaScriptStream(const std::string& url, - const std::wstring& result, +void WebPluginDelegateImpl::SendJavaScriptStream(const GURL& url, + const std::string& result, bool success, bool notify_needed, intptr_t notify_data) { @@ -200,20 +203,9 @@ WebPluginResourceClient* WebPluginDelegateImpl::CreateResourceClient( return plugin_stream->AsResourceClient(); } - if (notify_needed) { - instance()->SetURLLoadData(url, notify_data); - } std::string mime_type; NPAPI::PluginStreamUrl *stream = instance()->CreateStream( resource_id, url, mime_type, notify_needed, reinterpret_cast<void*>(notify_data)); return stream; } - -void WebPluginDelegateImpl::URLRequestRouted(const std::string&url, - bool notify_needed, - intptr_t notify_data) { - if (notify_needed) { - instance()->SetURLLoadData(GURL(url.c_str()), notify_data); - } -} diff --git a/webkit/glue/plugins/webplugin_delegate_impl.h b/webkit/glue/plugins/webplugin_delegate_impl.h index 6563003..9ecd733 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.h +++ b/webkit/glue/plugins/webplugin_delegate_impl.h @@ -58,11 +58,12 @@ class WebPluginDelegateImpl : public WebPluginDelegate { virtual bool HandleInputEvent(const WebKit::WebInputEvent& event, WebKit::WebCursorInfo* cursor); virtual NPObject* GetPluginScriptableObject(); - virtual void DidFinishLoadWithReason(NPReason reason); + virtual void DidFinishLoadWithReason(const GURL& url, NPReason reason, + intptr_t notify_data); virtual int GetProcessId(); - virtual void SendJavaScriptStream(const std::string& url, - const std::wstring& result, + virtual void SendJavaScriptStream(const GURL& url, + const std::string& result, bool success, bool notify_needed, intptr_t notify_data); virtual void DidReceiveManualResponse(const GURL& url, @@ -81,8 +82,6 @@ class WebPluginDelegateImpl : public WebPluginDelegate { intptr_t notify_data, intptr_t stream); - virtual void URLRequestRouted(const std::string&url, bool notify_needed, - intptr_t notify_data); virtual bool IsWindowless() const { return windowless_ ; } virtual const gfx::Rect& GetRect() const { return window_rect_; } virtual const gfx::Rect& GetClipRect() const { return clip_rect_; } diff --git a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc index d0afce8..ad93428b 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc @@ -708,4 +708,3 @@ bool WebPluginDelegateImpl::HandleInputEvent(const WebInputEvent& event, return ret; } - diff --git a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm index 62ea2de..485c6af 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm +++ b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm @@ -202,8 +202,10 @@ NPObject* WebPluginDelegateImpl::GetPluginScriptableObject() { return instance_->GetPluginScriptableObject(); } -void WebPluginDelegateImpl::DidFinishLoadWithReason(NPReason reason) { - instance()->DidFinishLoadWithReason(reason); +void WebPluginDelegateImpl::DidFinishLoadWithReason( + const GURL& url, NPReason reason, intptr_t notify_data) { + instance()->DidFinishLoadWithReason( + url, reason, reinterpret_cast<void*>(notify_data)); } int WebPluginDelegateImpl::GetProcessId() { @@ -211,8 +213,8 @@ int WebPluginDelegateImpl::GetProcessId() { return getpid(); } -void WebPluginDelegateImpl::SendJavaScriptStream(const std::string& url, - const std::wstring& result, +void WebPluginDelegateImpl::SendJavaScriptStream(const GURL& url, + const std::string& result, bool success, bool notify_needed, intptr_t notify_data) { @@ -532,9 +534,6 @@ WebPluginResourceClient* WebPluginDelegateImpl::CreateResourceClient( return plugin_stream->AsResourceClient(); } - if (notify_needed) { - instance()->SetURLLoadData(url, notify_data); - } std::string mime_type; NPAPI::PluginStreamUrl *stream = instance()->CreateStream( resource_id, url, mime_type, notify_needed, @@ -542,14 +541,6 @@ WebPluginResourceClient* WebPluginDelegateImpl::CreateResourceClient( return stream; } -void WebPluginDelegateImpl::URLRequestRouted(const std::string&url, - bool notify_needed, - intptr_t notify_data) { - if (notify_needed) { - instance()->SetURLLoadData(GURL(url.c_str()), notify_data); - } -} - void WebPluginDelegateImpl::OnNullEvent() { NPEvent np_event = {0}; np_event.what = nullEvent; diff --git a/webkit/glue/webdatasource_impl.cc b/webkit/glue/webdatasource_impl.cc deleted file mode 100644 index b67c57d..0000000 --- a/webkit/glue/webdatasource_impl.cc +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "config.h" -#include "webkit/glue/webdatasource_impl.h" - -#include "webkit/api/public/WebURL.h" -#include "webkit/api/public/WebVector.h" -#include "webkit/glue/glue_util.h" - -using WebCore::DocumentLoader; -using WebCore::ResourceRequest; -using WebCore::ResourceResponse; -using WebCore::SubstituteData; - -using WebKit::WebDataSource; -using WebKit::WebNavigationType; -using WebKit::WebString; -using WebKit::WebURL; -using WebKit::WebURLRequest; -using WebKit::WebURLResponse; -using WebKit::WebVector; - -// static -PassRefPtr<WebDataSourceImpl> WebDataSourceImpl::Create( - const ResourceRequest& request, - const SubstituteData& data) { - return adoptRef(new WebDataSourceImpl(request, data)); -} - -WebDataSourceImpl::WebDataSourceImpl(const ResourceRequest& request, - const SubstituteData& data) - : DocumentLoader(request, data) { -} - -WebDataSourceImpl::~WebDataSourceImpl() { -} - -const WebURLRequest& WebDataSourceImpl::originalRequest() const { - original_request_.bind(DocumentLoader::originalRequest()); - return original_request_; -} - -const WebURLRequest& WebDataSourceImpl::request() const { - request_.bind(DocumentLoader::request()); - return request_; -} - -const WebURLResponse& WebDataSourceImpl::response() const { - response_.bind(DocumentLoader::response()); - return response_; -} - -bool WebDataSourceImpl::hasUnreachableURL() const { - return !DocumentLoader::unreachableURL().isEmpty(); -} - -WebURL WebDataSourceImpl::unreachableURL() const { - return webkit_glue::KURLToWebURL(DocumentLoader::unreachableURL()); -} - -void WebDataSourceImpl::redirectChain(WebVector<WebURL>& result) const { - result.assign(redirect_chain_); -} - -WebString WebDataSourceImpl::pageTitle() const { - return webkit_glue::StringToWebString(title()); -} - -WebNavigationType WebDataSourceImpl::navigationType() const { - return NavigationTypeToWebNavigationType(triggeringAction().type()); -} - -double WebDataSourceImpl::triggeringEventTime() const { - if (!triggeringAction().event()) - return 0.0; - - // DOMTimeStamp uses units of milliseconds. - return triggeringAction().event()->timeStamp() / 1000.0; -} - -WebDataSource::ExtraData* WebDataSourceImpl::extraData() const { - return extra_data_.get(); -} - -void WebDataSourceImpl::setExtraData(ExtraData* extra_data) { - extra_data_.set(extra_data); -} - -WebNavigationType WebDataSourceImpl::NavigationTypeToWebNavigationType( - WebCore::NavigationType type) { - switch (type) { - case WebCore::NavigationTypeLinkClicked: - return WebKit::WebNavigationTypeLinkClicked; - case WebCore::NavigationTypeFormSubmitted: - return WebKit::WebNavigationTypeFormSubmitted; - case WebCore::NavigationTypeBackForward: - return WebKit::WebNavigationTypeBackForward; - case WebCore::NavigationTypeReload: - return WebKit::WebNavigationTypeReload; - case WebCore::NavigationTypeFormResubmitted: - return WebKit::WebNavigationTypeFormResubmitted; - case WebCore::NavigationTypeOther: - default: - return WebKit::WebNavigationTypeOther; - } -} - -GURL WebDataSourceImpl::GetEndOfRedirectChain() const { - ASSERT(!redirect_chain_.isEmpty()); - return redirect_chain_.last(); -} - -void WebDataSourceImpl::ClearRedirectChain() { - redirect_chain_.clear(); -} - -void WebDataSourceImpl::AppendRedirect(const GURL& url) { - redirect_chain_.append(url); -} diff --git a/webkit/glue/webdatasource_impl.h b/webkit/glue/webdatasource_impl.h deleted file mode 100644 index e1f9029..0000000 --- a/webkit/glue/webdatasource_impl.h +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef WEBKIT_GLUE_WEBDATASOURCE_IMPL_H_ -#define WEBKIT_GLUE_WEBDATASOURCE_IMPL_H_ - -#include "DocumentLoader.h" -#include <wtf/Vector.h> -#include <wtf/OwnPtr.h> - -#include "webkit/api/public/WebDataSource.h" -#include "webkit/api/src/WrappedResourceRequest.h" -#include "webkit/api/src/WrappedResourceResponse.h" - -class GURL; -class WebFrameImpl; -class WebDocumentLoaderImpl; - -class WebDataSourceImpl : public WebCore::DocumentLoader, - public WebKit::WebDataSource { - public: - static PassRefPtr<WebDataSourceImpl> Create(const WebCore::ResourceRequest&, - const WebCore::SubstituteData&); - - static WebDataSourceImpl* FromLoader(WebCore::DocumentLoader* loader) { - return static_cast<WebDataSourceImpl*>(loader); - } - - // WebDataSource methods: - virtual const WebKit::WebURLRequest& originalRequest() const; - virtual const WebKit::WebURLRequest& request() const; - virtual const WebKit::WebURLResponse& response() const; - virtual bool hasUnreachableURL() const; - virtual WebKit::WebURL unreachableURL() const; - virtual void redirectChain(WebKit::WebVector<WebKit::WebURL>&) const; - virtual WebKit::WebString pageTitle() const; - virtual WebKit::WebNavigationType navigationType() const; - virtual double triggeringEventTime() const; - virtual ExtraData* extraData() const; - virtual void setExtraData(ExtraData*); - - static WebKit::WebNavigationType NavigationTypeToWebNavigationType( - WebCore::NavigationType type); - - bool HasRedirectChain() const { return !redirect_chain_.isEmpty(); } - GURL GetEndOfRedirectChain() const; - void ClearRedirectChain(); - void AppendRedirect(const GURL& url); - - private: - WebDataSourceImpl(const WebCore::ResourceRequest&, - const WebCore::SubstituteData&); - ~WebDataSourceImpl(); - - // Mutable because the const getters will magically sync these to the - // latest version from WebKit. - mutable WebKit::WrappedResourceRequest original_request_; - mutable WebKit::WrappedResourceRequest request_; - mutable WebKit::WrappedResourceResponse response_; - - // Lists all intermediate URLs that have redirected for the current - // provisional load. See WebFrameLoaderClient:: - // dispatchDidReceiveServerRedirectForProvisionalLoad for a description of - // who modifies this when to keep it up to date. - Vector<WebKit::WebURL> redirect_chain_; - - OwnPtr<ExtraData> extra_data_; - - DISALLOW_COPY_AND_ASSIGN(WebDataSourceImpl); -}; - -#endif // WEBKIT_GLUE_WEBDATASOURCE_IMPL_H_ diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc index d58f5f0..1324e34 100644 --- a/webkit/glue/webframe_impl.cc +++ b/webkit/glue/webframe_impl.cc @@ -154,11 +154,11 @@ MSVC_POP_WARNING(); #include "webkit/api/public/WebSize.h" #include "webkit/api/public/WebURLError.h" #include "webkit/api/public/WebVector.h" +#include "webkit/api/src/WebDataSourceImpl.h" #include "webkit/glue/chrome_client_impl.h" #include "webkit/glue/dom_operations.h" #include "webkit/glue/dom_operations_private.h" #include "webkit/glue/glue_util.h" -#include "webkit/glue/webdatasource_impl.h" #include "webkit/glue/webframe_impl.h" #include "webkit/glue/webview_impl.h" @@ -214,6 +214,7 @@ using WebKit::WebCanvas; using WebKit::WebConsoleMessage; using WebKit::WebData; using WebKit::WebDataSource; +using WebKit::WebDataSourceImpl; using WebKit::WebFindOptions; using WebKit::WebFrame; using WebKit::WebHistoryItem; @@ -360,7 +361,7 @@ class ChromePrintContext : public WebCore::PrintContext { }; static WebDataSource* DataSourceForDocLoader(DocumentLoader* loader) { - return loader ? WebDataSourceImpl::FromLoader(loader) : NULL; + return loader ? WebDataSourceImpl::fromDocumentLoader(loader) : NULL; } // WebFrame ------------------------------------------------------------------- @@ -1454,7 +1455,6 @@ int WebFrameImpl::live_object_count_ = 0; WebFrameImpl::WebFrameImpl() : ALLOW_THIS_IN_INITIALIZER_LIST(frame_loader_client_(this)), ALLOW_THIS_IN_INITIALIZER_LIST(scope_matches_factory_(this)), - plugin_delegate_(NULL), active_match_frame_(NULL), active_match_index_(-1), locating_active_rect_(false), diff --git a/webkit/glue/webframe_impl.h b/webkit/glue/webframe_impl.h index 9fd788e..b1c1240 100644 --- a/webkit/glue/webframe_impl.h +++ b/webkit/glue/webframe_impl.h @@ -40,8 +40,6 @@ MSVC_PUSH_WARNING_LEVEL(0); MSVC_POP_WARNING(); class ChromePrintContext; -class WebDataSourceImpl; -class WebPluginDelegate; class WebView; class WebViewImpl; @@ -60,6 +58,10 @@ class SubstituteData; struct WindowFeatures; } +namespace WebKit { +class WebDataSourceImpl; +} + // Implementation of WebFrame, note that this is a reference counted object. class WebFrameImpl : public WebKit::WebFrame, public base::RefCounted<WebFrameImpl> { @@ -186,16 +188,6 @@ class WebFrameImpl : public WebKit::WebFrame, void CreateFrameView(); - // The plugin delegate is used to get notifications when downloads complete. - // This is used by the NPAPI method getURLNotify. plugin_delegate() may - // return NULL. TODO(darin): how come there is only one per frame?!? - WebPluginDelegate* plugin_delegate() const { - return plugin_delegate_; - } - void set_plugin_delegate(WebPluginDelegate* plugin_delegate) { - plugin_delegate_ = plugin_delegate; - } - WebCore::Frame* frame() const { return frame_; } @@ -210,8 +202,8 @@ class WebFrameImpl : public WebKit::WebFrame, // Getters for the impls corresponding to Get(Provisional)DataSource. They // may return NULL if there is no corresponding data source. - WebDataSourceImpl* GetDataSourceImpl() const; - WebDataSourceImpl* GetProvisionalDataSourceImpl() const; + WebKit::WebDataSourceImpl* GetDataSourceImpl() const; + WebKit::WebDataSourceImpl* GetProvisionalDataSourceImpl() const; // Returns which frame has an active match. This function should only be // called on the main frame, as it is the only frame keeping track. Returned @@ -270,10 +262,6 @@ class WebFrameImpl : public WebKit::WebFrame, // ourselves is held while frame_ is valid. See our Closing method. WebCore::Frame* frame_; - // Plugins sometimes need to be notified when loads are complete so we keep - // a pointer back to the appropriate plugin. - WebPluginDelegate* plugin_delegate_; - // A way for the main frame to keep track of which frame has an active // match. Should be NULL for all other frames. WebFrameImpl* active_match_frame_; diff --git a/webkit/glue/webframeloaderclient_impl.cc b/webkit/glue/webframeloaderclient_impl.cc index ed356d9..09e6bd3 100644 --- a/webkit/glue/webframeloaderclient_impl.cc +++ b/webkit/glue/webframeloaderclient_impl.cc @@ -38,12 +38,13 @@ #include "webkit/api/public/WebURL.h" #include "webkit/api/public/WebURLError.h" #include "webkit/api/public/WebVector.h" +#include "webkit/api/src/WebDataSourceImpl.h" #include "webkit/api/src/WebPluginContainerImpl.h" +#include "webkit/api/src/WebPluginLoadObserver.h" #include "webkit/api/src/WrappedResourceRequest.h" #include "webkit/api/src/WrappedResourceResponse.h" #include "webkit/glue/glue_util.h" #include "webkit/glue/plugins/plugin_list.h" -#include "webkit/glue/webdatasource_impl.h" #include "webkit/glue/webdevtoolsagent_impl.h" #include "webkit/glue/webframe_impl.h" #include "webkit/glue/webframeloaderclient_impl.h" @@ -59,9 +60,11 @@ using base::Time; using base::TimeDelta; using WebKit::WebData; +using WebKit::WebDataSourceImpl; using WebKit::WebNavigationType; using WebKit::WebNavigationPolicy; using WebKit::WebPluginContainerImpl; +using WebKit::WebPluginLoadObserver; using WebKit::WebString; using WebKit::WebURL; using WebKit::WebURLError; @@ -314,7 +317,7 @@ void WebFrameLoaderClient::dispatchDidFinishDocumentLoad() { DocumentLoader* documentLoader = webframe_->frame()->loader()->activeDocumentLoader(); WebDataSourceImpl* data_source = - WebDataSourceImpl::FromLoader(documentLoader); + WebDataSourceImpl::fromDocumentLoader(documentLoader); // A frame may be reused. This call ensures we don't hold on to our password // listeners and their associated HTMLInputElements. @@ -452,13 +455,13 @@ void WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad() // A provisional load should have started already, which should have put an // entry in our redirect chain. - DCHECK(ds->HasRedirectChain()); + DCHECK(ds->hasRedirectChain()); // The URL of the destination is on the provisional data source. We also need // to update the redirect chain to account for this addition (we do this // before the callback so the callback can look at the redirect chain to see // what happened). - ds->AppendRedirect(ds->request().url()); + ds->appendRedirect(ds->request().url()); // Dispatch callback WebViewImpl* webview = webframe_->GetWebViewImpl(); @@ -527,8 +530,8 @@ void WebFrameLoaderClient::dispatchDidChangeLocationWithinPage() { DCHECK(ds) << "DataSource NULL when navigating to reference fragment"; if (ds) { GURL url = ds->request().url(); - GURL chain_end = ds->GetEndOfRedirectChain(); - ds->ClearRedirectChain(); + GURL chain_end = ds->endOfRedirectChain(); + ds->clearRedirectChain(); // Figure out if this location change is because of a JS-initiated client // redirect (e.g onload/setTimeout document.location.href=). @@ -546,7 +549,7 @@ void WebFrameLoaderClient::dispatchDidChangeLocationWithinPage() { if (was_client_redirect) { if (d) d->DidCompleteClientRedirect(webview, webframe_, chain_end); - ds->AppendRedirect(chain_end); + ds->appendRedirect(chain_end); // Make sure we clear the expected redirect since we just effectively // completed it. expected_client_redirect_src_ = GURL(); @@ -555,7 +558,7 @@ void WebFrameLoaderClient::dispatchDidChangeLocationWithinPage() { // Regardless of how we got here, we are navigating to a URL so we need to // add it to the redirect chain. - ds->AppendRedirect(url); + ds->appendRedirect(url); } bool is_new_navigation; @@ -598,7 +601,7 @@ void WebFrameLoaderClient::dispatchDidStartProvisionalLoad() { // Since the provisional load just started, we should have not gotten // any redirects yet. - DCHECK(!ds->HasRedirectChain()); + DCHECK(!ds->hasRedirectChain()); WebViewImpl* webview = webframe_->GetWebViewImpl(); WebViewDelegate* d = webview->delegate(); @@ -612,10 +615,10 @@ void WebFrameLoaderClient::dispatchDidStartProvisionalLoad() { // "javascript:". See bug: 1080873 DCHECK(expected_client_redirect_dest_.SchemeIs("javascript") || expected_client_redirect_dest_ == url); - ds->AppendRedirect(expected_client_redirect_src_); + ds->appendRedirect(expected_client_redirect_src_); completing_client_redirect = true; } - ds->AppendRedirect(url); + ds->appendRedirect(url); if (d) { // As the comment for DidCompleteClientRedirect in webview_delegate.h @@ -658,23 +661,25 @@ void WebFrameLoaderClient::dispatchDidFailProvisionalLoad( const ResourceError& error) { // If a policy change occured, then we do not want to inform the plugin // delegate. See bug 907789 for details. + // TODO(darin): This means the plugin won't receive NPP_URLNotify, which + // seems like it could result in a memory leak in the plugin!! if (error.domain() == kInternalErrorDomain && error.errorCode() == ERR_POLICY_CHANGE) { webframe_->DidFail(cancelledError(error.failingURL()), true); - } else { - webframe_->DidFail(error, true); - WebPluginDelegate* plg_delegate = webframe_->plugin_delegate(); - if (plg_delegate) - plg_delegate->DidFinishLoadWithReason(NPRES_NETWORK_ERR); + return; } + + OwnPtr<WebPluginLoadObserver> plugin_load_observer = GetPluginLoadObserver(); + webframe_->DidFail(error, true); + if (plugin_load_observer) + plugin_load_observer->didFailLoading(error); } void WebFrameLoaderClient::dispatchDidFailLoad(const ResourceError& error) { + OwnPtr<WebPluginLoadObserver> plugin_load_observer = GetPluginLoadObserver(); webframe_->DidFail(error, false); - - WebPluginDelegate* plg_delegate = webframe_->plugin_delegate(); - if (plg_delegate) - plg_delegate->DidFinishLoadWithReason(NPRES_NETWORK_ERR); + if (plugin_load_observer) + plugin_load_observer->didFailLoading(error); // Don't clear the redirect chain, this will happen in the middle of client // redirects, and we need the context. The chain will be cleared when the @@ -682,17 +687,14 @@ void WebFrameLoaderClient::dispatchDidFailLoad(const ResourceError& error) { } void WebFrameLoaderClient::dispatchDidFinishLoad() { - DocumentLoader* documentLoader = - webframe_->frame()->loader()->activeDocumentLoader(); - WebDataSourceImpl* dataSource = - WebDataSourceImpl::FromLoader(documentLoader); + OwnPtr<WebPluginLoadObserver> plugin_load_observer = GetPluginLoadObserver(); + WebViewImpl* webview = webframe_->GetWebViewImpl(); WebViewDelegate* d = webview->delegate(); if (d) d->DidFinishLoadForFrame(webview, webframe_); - WebPluginDelegate* plg_delegate = webframe_->plugin_delegate(); - if (plg_delegate) - plg_delegate->DidFinishLoadWithReason(NPRES_DONE); + if (plugin_load_observer) + plugin_load_observer->didFinishLoading(); // Don't clear the redirect chain, this will happen in the middle of client // redirects, and we need the context. The chain will be cleared when the @@ -846,10 +848,10 @@ void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction( HandleBackForwardNavigation(url); navigation_policy = WebKit::WebNavigationPolicyIgnore; } else { - bool is_redirect = ds->HasRedirectChain(); + bool is_redirect = ds->hasRedirectChain(); WebNavigationType webnav_type = - WebDataSourceImpl::NavigationTypeToWebNavigationType(action.type()); + WebDataSourceImpl::toWebNavigationType(action.type()); navigation_policy = d->PolicyForNavigationAction( wv, webframe_, ds->request(), webnav_type, navigation_policy, @@ -1131,10 +1133,11 @@ void WebFrameLoaderClient::provisionalLoadStarted() { } void WebFrameLoaderClient::didFinishLoad() { - WebPluginDelegate* plg_delegate = webframe_->plugin_delegate(); - if (plg_delegate) - plg_delegate->DidFinishLoadWithReason(NPRES_DONE); + OwnPtr<WebPluginLoadObserver> plugin_load_observer = GetPluginLoadObserver(); + if (plugin_load_observer) + plugin_load_observer->didFinishLoading(); } + void WebFrameLoaderClient::prepareForDataSourceReplacement() { // FIXME } @@ -1142,7 +1145,7 @@ void WebFrameLoaderClient::prepareForDataSourceReplacement() { PassRefPtr<DocumentLoader> WebFrameLoaderClient::createDocumentLoader( const ResourceRequest& request, const SubstituteData& data) { - RefPtr<WebDataSourceImpl> ds = WebDataSourceImpl::Create(request, data); + RefPtr<WebDataSourceImpl> ds = WebDataSourceImpl::create(request, data); WebViewDelegate* d = webframe_->GetWebViewImpl()->delegate(); if (d) d->DidCreateDataSource(webframe_, ds.get()); @@ -1432,3 +1435,9 @@ void WebFrameLoaderClient::HandleBackForwardNavigation(const GURL& url) { if (d) d->NavigateBackForwardSoon(offset); } + +PassOwnPtr<WebPluginLoadObserver> WebFrameLoaderClient::GetPluginLoadObserver() { + WebDataSourceImpl* ds = WebDataSourceImpl::fromDocumentLoader( + webframe_->frame()->loader()->activeDocumentLoader()); + return ds->releasePluginLoadObserver(); +} diff --git a/webkit/glue/webframeloaderclient_impl.h b/webkit/glue/webframeloaderclient_impl.h index 95cef30..a623187 100644 --- a/webkit/glue/webframeloaderclient_impl.h +++ b/webkit/glue/webframeloaderclient_impl.h @@ -6,6 +6,7 @@ #define WEBKIT_GLUE_WEBFRAMELOADERCLIENT_IMPL_H_ #include "FrameLoaderClient.h" +#include <wtf/PassOwnPtr.h> #include <wtf/RefPtr.h> #include "googleurl/src/gurl.h" @@ -16,6 +17,7 @@ class WebFrameImpl; namespace WebKit { class WebPluginContainerImpl; +class WebPluginLoadObserver; } class WebFrameLoaderClient : public WebCore::FrameLoaderClient { @@ -186,8 +188,8 @@ class WebFrameLoaderClient : public WebCore::FrameLoaderClient { const WTF::Vector<WebCore::String>& paramNames, const WTF::Vector<WebCore::String>& paramValues); - virtual WebCore::ObjectContentType objectContentType(const WebCore::KURL& url, - const WebCore::String& mimeType); + virtual WebCore::ObjectContentType objectContentType( + const WebCore::KURL& url, const WebCore::String& mimeType); virtual WebCore::String overrideMediaType() const; virtual void didPerformFirstNavigation() const; @@ -210,6 +212,8 @@ class WebFrameLoaderClient : public WebCore::FrameLoaderClient { // Called when a dummy back-forward navigation is intercepted. void HandleBackForwardNavigation(const GURL&); + PassOwnPtr<WebKit::WebPluginLoadObserver> GetPluginLoadObserver(); + // The WebFrame that owns this object and manages its lifetime. Therefore, // the web frame object is guaranteed to exist. WebFrameImpl* webframe_; diff --git a/webkit/glue/webplugin_delegate.h b/webkit/glue/webplugin_delegate.h index ef24b03..c1427cd 100644 --- a/webkit/glue/webplugin_delegate.h +++ b/webkit/glue/webplugin_delegate.h @@ -8,7 +8,7 @@ #include <string> #include "base/gfx/native_widget_types.h" -#include "build/build_config.h" +#include "base/string16.h" #include "third_party/npapi/bindings/npapi.h" struct NPObject; @@ -96,14 +96,16 @@ class WebPluginDelegate { // Receives notification about a resource load that the plugin initiated // for a frame. - virtual void DidFinishLoadWithReason(NPReason reason) = 0; + virtual void DidFinishLoadWithReason(const GURL& url, NPReason reason, + intptr_t notify_data) = 0; // Returns the process id of the process that is running the plugin. virtual int GetProcessId() = 0; - // The result of the script execution is returned via this function. - virtual void SendJavaScriptStream(const std::string& url, - const std::wstring& result, + // The result, UTF-8 encoded, of the script execution is returned via this + // function. + virtual void SendJavaScriptStream(const GURL& url, + const std::string& result, bool success, bool notify_needed, intptr_t notify_data) = 0; @@ -136,10 +138,6 @@ class WebPluginDelegate { intptr_t notify_data, intptr_t stream) = 0; - // Notifies the delegate about a Get/Post URL request getting routed. - virtual void URLRequestRouted(const std::string&url, bool notify_needed, - intptr_t notify_data) = 0; - virtual bool IsWindowless() const; virtual const gfx::Rect& GetRect() const; diff --git a/webkit/glue/webplugin_impl.cc b/webkit/glue/webplugin_impl.cc index 0f2c9ae..09f2b3b 100644 --- a/webkit/glue/webplugin_impl.cc +++ b/webkit/glue/webplugin_impl.cc @@ -24,6 +24,7 @@ #include "base/message_loop.h" #include "base/string_util.h" #include "net/base/escape.h" +#include "webkit/api/public/WebConsoleMessage.h" #include "webkit/api/public/WebCursorInfo.h" #include "webkit/api/public/WebData.h" #include "webkit/api/public/WebHTTPBody.h" @@ -51,8 +52,11 @@ #include "googleurl/src/gurl.h" using WebKit::WebCanvas; +using WebKit::WebConsoleMessage; using WebKit::WebCursorInfo; using WebKit::WebData; +using WebKit::WebDataSource; +using WebKit::WebFrame; using WebKit::WebHTTPBody; using WebKit::WebHTTPHeaderVisitor; using WebKit::WebInputEvent; @@ -62,6 +66,7 @@ using WebKit::WebPluginContainer; using WebKit::WebPluginContainerImpl; using WebKit::WebRect; using WebKit::WebString; +using WebKit::WebURL; using WebKit::WebURLError; using WebKit::WebURLLoader; using WebKit::WebURLLoaderClient; @@ -391,6 +396,23 @@ void WebPluginImpl::didFailLoading(const WebURLError& error) { delegate_->DidManualLoadFail(); } +void WebPluginImpl::didFinishLoadingFrameRequest( + const WebURL& url, void* notify_data) { + if (delegate_) { + delegate_->DidFinishLoadWithReason( + url, NPRES_DONE, reinterpret_cast<intptr_t>(notify_data)); + } +} + +void WebPluginImpl::didFailLoadingFrameRequest( + const WebURL& url, void* notify_data, const WebURLError& error) { + // TODO(darin): Map net::ERR_ABORTED to NPRES_USER_BREAK? + if (delegate_) { + delegate_->DidFinishLoadWithReason( + url, NPRES_NETWORK_ERR, reinterpret_cast<intptr_t>(notify_data)); + } +} + // ----------------------------------------------------------------------------- WebPluginImpl::~WebPluginImpl() { @@ -431,45 +453,6 @@ GURL WebPluginImpl::CompleteURL(const char* url) { return webframe_->completeURL(WebString::fromUTF8(url)); } -bool WebPluginImpl::ExecuteScript(const std::string& url, - const std::wstring& script, - bool notify_needed, - intptr_t notify_data, - bool popups_allowed) { - // This could happen if the WebPluginContainer was already deleted. - if (!frame()) - return false; - - // Pending resource fetches should also not trigger a callback. - webframe_->set_plugin_delegate(NULL); - - WebCore::String script_str(webkit_glue::StdWStringToString(script)); - - // Note: the call to executeScript might result in the frame being - // deleted, so add an extra reference to it in this scope. - // For KJS, keeping a pointer to the JSBridge is enough, but for V8 - // we also need to addref the frame. - WTF::RefPtr<WebCore::Frame> cur_frame(frame()); - - WebCore::ScriptValue result = - frame()->loader()->executeScript(script_str, popups_allowed); - WebCore::String script_result; - std::wstring wresult; - bool succ = false; - if (result.getString(script_result)) { - succ = true; - wresult = webkit_glue::StringToStdWString(script_result); - } - - // delegate_ could be NULL because executeScript caused the container to be - // deleted. - if (delegate_) - delegate_->SendJavaScriptStream(url, wresult, succ, notify_needed, - notify_data); - - return succ; -} - void WebPluginImpl::CancelResource(int id) { for (size_t i = 0; i < clients_.size(); ++i) { if (clients_[i].id == id) { @@ -519,25 +502,31 @@ RoutingStatus WebPluginImpl::RouteToFrame(const char *method, bool is_javascript_url, const char* target, unsigned int len, const char* buf, bool is_file_data, - bool notify, const char* url, - GURL* unused) { + bool notify_needed, + intptr_t notify_data, + const char* url, GURL* unused) { // If there is no target, there is nothing to do if (!target) return NOT_ROUTED; // This could happen if the WebPluginContainer was already deleted. - if (!frame()) + if (!webframe_) return NOT_ROUTED; + WebString target_str = WebString::fromUTF8(target); + // Take special action for JavaScript URLs - WebCore::String str_target = target; if (is_javascript_url) { - WebCore::Frame *frameTarget = frame()->tree()->find(str_target); + WebFrame* target_frame = webframe_->view()->GetFrameWithName(target_str); // For security reasons, do not allow JavaScript on frames // other than this frame. - if (frameTarget != frame()) { - // FIXME - might be good to log this into a security - // log somewhere. + if (target_frame != webframe_) { + // TODO(darin): Localize this message. + const char kMessage[] = + "Ignoring cross-frame javascript URL load requested by plugin."; + webframe_->addMessageToConsole( + WebConsoleMessage(WebConsoleMessage::LevelError, + WebString::fromUTF8(kMessage))); return ROUTED; } @@ -574,33 +563,8 @@ RoutingStatus WebPluginImpl::RouteToFrame(const char *method, } } - // TODO(darin): Eliminate these WebCore dependencies. - - WebCore::FrameLoadRequest load_request( - *webkit_glue::WebURLRequestToResourceRequest(&request)); - load_request.setFrameName(str_target); - WebCore::FrameLoader *loader = frame()->loader(); - // we actually don't know whether usergesture is true or false, - // passing true since all we can do is assume it is okay. - loader->loadFrameRequest( - load_request, - false, // lock history - false, // lock back forward list - 0, // event - 0); // form state - - // loadFrameRequest() can cause the frame to go away. - if (webframe_) { - WebPluginDelegate* last_plugin = webframe_->plugin_delegate(); - if (last_plugin) { - last_plugin->DidFinishLoadWithReason(NPRES_USER_BREAK); - webframe_->set_plugin_delegate(NULL); - } - - if (notify) - webframe_->set_plugin_delegate(delegate_); - } - + container_->loadFrameRequest(request, target_str, notify_needed, + reinterpret_cast<void*>(notify_data)); return ROUTED; } @@ -874,27 +838,21 @@ void WebPluginImpl::HandleURLRequestInternal( // to the plugin's frame. GURL complete_url; int routing_status = RouteToFrame(method, is_javascript_url, target, len, - buf, is_file_data, notify, url, - &complete_url); - if (routing_status == ROUTED) { - // The delegate could have gone away because of this call. - if (delegate_) - delegate_->URLRequestRouted(url, notify, notify_data); + buf, is_file_data, notify, notify_data, + url, &complete_url); + if (routing_status == ROUTED) return; - } if (is_javascript_url) { - std::string original_url = url; - - // Convert the javascript: URL to javascript by unescaping. WebCore uses - // decode_string for this, so we do, too. - std::string escaped_script = original_url.substr(strlen("javascript:")); - WebCore::String script = WebCore::decodeURLEscapeSequences( - WebCore::String(escaped_script.data(), - static_cast<int>(escaped_script.length()))); - - ExecuteScript(original_url, webkit_glue::StringToStdWString(script), notify, - notify_data, popups_allowed); + GURL gurl(url); + WebString result = container_->executeScriptURL(gurl, popups_allowed); + + // delegate_ could be NULL because executeScript caused the container to + // be deleted. + if (delegate_) { + delegate_->SendJavaScriptStream( + gurl, result.utf8(), !result.isNull(), notify, notify_data); + } } else { GURL complete_url = CompleteURL(url); @@ -1147,7 +1105,6 @@ void WebPluginImpl::TearDownPluginInstance( // This needs to be called now and not in the destructor since the // webframe_ might not be valid anymore. - webframe_->set_plugin_delegate(NULL); webframe_ = NULL; method_factory_.RevokeAll(); } diff --git a/webkit/glue/webplugin_impl.h b/webkit/glue/webplugin_impl.h index b8cace4..09505af 100644 --- a/webkit/glue/webplugin_impl.h +++ b/webkit/glue/webplugin_impl.h @@ -98,6 +98,11 @@ class WebPluginImpl : public WebPlugin, virtual void didReceiveData(const char* data, int data_length); virtual void didFinishLoading(); virtual void didFailLoading(const WebKit::WebURLError& error); + virtual void didFinishLoadingFrameRequest( + const WebKit::WebURL& url, void* notify_data); + virtual void didFailLoadingFrameRequest( + const WebKit::WebURL& url, void* notify_data, + const WebKit::WebURLError& error); // WebPlugin implementation: void SetWindow(gfx::PluginWindowHandle window); @@ -112,17 +117,19 @@ class WebPluginImpl : public WebPlugin, // Executes the script passed in. The notify_needed and notify_data arguments // are passed in by the plugin process. These indicate whether the plugin // expects a notification on script execution. We pass them back to the - // plugin as is. This avoids having to track the notification arguments - // in the plugin process. + // plugin as is. This avoids having to track the notification arguments in + // the plugin process. bool ExecuteScript(const std::string& url, const std::wstring& script, - bool notify_needed, intptr_t notify_data, bool popups_allowed); + bool notify_needed, intptr_t notify_data, + bool popups_allowed); - // Given a download request, check if we need to route the output - // to a frame. Returns ROUTED if the load is done and routed to - // a frame, NOT_ROUTED or corresponding error codes otherwise. - RoutingStatus RouteToFrame(const char *method, bool is_javascript_url, + // Given a download request, check if we need to route the output to a frame. + // Returns ROUTED if the load is done and routed to a frame, NOT_ROUTED or + // corresponding error codes otherwise. + RoutingStatus RouteToFrame(const char* method, bool is_javascript_url, const char* target, unsigned int len, - const char* buf, bool is_file_data, bool notify, + const char* buf, bool is_file_data, + bool notify_needed, intptr_t notify_data, const char* url, GURL* completeURL); // Cancels a pending request. diff --git a/webkit/glue/webview.h b/webkit/glue/webview.h index 42334b1..d451a1e 100644 --- a/webkit/glue/webview.h +++ b/webkit/glue/webview.h @@ -108,7 +108,7 @@ class WebView : public WebKit::WebWidget { virtual void SetFocusedFrame(WebKit::WebFrame* frame) = 0; // Returns the frame with the given name, or NULL if not found. - virtual WebKit::WebFrame* GetFrameWithName(const std::wstring& name) = 0; + virtual WebKit::WebFrame* GetFrameWithName(const WebKit::WebString& name) = 0; // Returns the frame previous to the specified frame, by traversing the frame // tree, wrapping around if necessary. diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc index 2c6069e..2a387df 100644 --- a/webkit/glue/webview_impl.cc +++ b/webkit/glue/webview_impl.cc @@ -1294,8 +1294,8 @@ void WebViewImpl::SetFocusedFrame(WebFrame* frame) { webcore_frame->page()->focusController()->setFocusedFrame(webcore_frame); } -WebFrame* WebViewImpl::GetFrameWithName(const std::wstring& name) { - String name_str = webkit_glue::StdWStringToString(name); +WebFrame* WebViewImpl::GetFrameWithName(const WebString& name) { + String name_str = webkit_glue::WebStringToString(name); Frame* frame = page_->mainFrame()->tree()->find(name_str); return frame ? WebFrameImpl::FromFrame(frame) : NULL; } diff --git a/webkit/glue/webview_impl.h b/webkit/glue/webview_impl.h index 91e05b9..5cc3c29 100644 --- a/webkit/glue/webview_impl.h +++ b/webkit/glue/webview_impl.h @@ -82,7 +82,7 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { virtual WebKit::WebFrame* GetMainFrame(); virtual WebKit::WebFrame* GetFocusedFrame(); virtual void SetFocusedFrame(WebKit::WebFrame* frame); - virtual WebKit::WebFrame* GetFrameWithName(const std::wstring& name); + virtual WebKit::WebFrame* GetFrameWithName(const WebKit::WebString& name); virtual WebKit::WebFrame* GetPreviousFrameBefore(WebKit::WebFrame* frame, bool wrap); virtual WebKit::WebFrame* GetNextFrameAfter(WebKit::WebFrame* frame, bool wrap); virtual void ClearFocusedNode(); diff --git a/webkit/glue/webworker_impl.cc b/webkit/glue/webworker_impl.cc index 76f4400..f02668d 100644 --- a/webkit/glue/webworker_impl.cc +++ b/webkit/glue/webworker_impl.cc @@ -27,8 +27,8 @@ #include "webkit/api/public/WebURL.h" #include "webkit/api/public/WebWorkerClient.h" #include "webkit/api/src/PlatformMessagePortChannel.h" +#include "webkit/api/src/WebDataSourceImpl.h" #include "webkit/glue/glue_util.h" -#include "webkit/glue/webdatasource_impl.h" #include "webkit/glue/webframe_impl.h" #include "webkit/glue/webpreferences.h" #include "webkit/glue/webview.h" @@ -72,7 +72,8 @@ class WorkerWebViewDelegate : public WebViewDelegate { // Tell the loader to load the data into the 'shadow page' synchronously, // so we can grab the resulting Document right after load. virtual void DidCreateDataSource(WebFrame* frame, WebKit::WebDataSource* ds) { - static_cast<WebDataSourceImpl*>(ds)->setDeferMainResourceDataLoad(false); + static_cast<WebKit::WebDataSourceImpl*>(ds)-> + setDeferMainResourceDataLoad(false); } // Lazy allocate and leak this instance. |