diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-18 21:09:28 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-18 21:09:28 +0000 |
commit | 726985e24233bdfd13d2fcee05100ce19fb85525 (patch) | |
tree | 7e16dc159f929577c80f0cf993b5ec51ffc3217d /webkit/glue | |
parent | a3f0c997f88517619709282f70fbf5e27942cdae (diff) | |
download | chromium_src-726985e24233bdfd13d2fcee05100ce19fb85525.zip chromium_src-726985e24233bdfd13d2fcee05100ce19fb85525.tar.gz chromium_src-726985e24233bdfd13d2fcee05100ce19fb85525.tar.bz2 |
Delete files from webkit/glue that have been made obsolete by corresponding
files in webkit/api.
Here's the mapping:
webkit/glue/webdatasource.h -> webkit/api/public/WebDataSource.h
webkit/glue/weberror.h -> webkit/api/public/WebURLError.h
webkit/glue/weburlrequest.h -> webkit/api/public/WebURLRequest.h
webkit/glue/webresponse.h -> webkit/api/public/WebURLResponse.h
I kept the implementation of WebDataSource in webkit/glue for now because it
helps to have it close to WebFrameImpl and WebFrameLoaderClient.
To facilitate this change, I needed to make use of WrappedResourceRequest and
WrappedResourceResponse from webkit/api/src within the implementation files of
webkit/glue. This is only a temporary usage of webkit/api/src from the
outside. It will go away when WebFrame, etc. get moved into webkit/api.
I modified these wrapper classes to expose the 'bind' function so that I can
re-bind a wrapper. This is used in WebDataSourceImpl::request() and related
methods to allow the interface to return a const reference to a WebURLRequest
and WebURLResponse.
The changes here are fairly mechanical. I'm not too happy about the way
WebDataSource::redirectChain now works. I would prefer a solution that didn't
involve so much copying, but I'm not going to worry about optimizing that now.
R=brettw
BUG=10041
TEST=none
Review URL: http://codereview.chromium.org/126286
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18747 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
27 files changed, 290 insertions, 863 deletions
diff --git a/webkit/glue/alt_error_page_resource_fetcher.cc b/webkit/glue/alt_error_page_resource_fetcher.cc index 53f7a26..139b7cd 100644 --- a/webkit/glue/alt_error_page_resource_fetcher.cc +++ b/webkit/glue/alt_error_page_resource_fetcher.cc @@ -13,27 +13,28 @@ MSVC_POP_WARNING(); #include "webkit/glue/alt_error_page_resource_fetcher.h" +#include "webkit/api/public/WebDataSource.h" +#include "webkit/api/public/WebURLRequest.h" #include "webkit/glue/glue_util.h" -#include "webkit/glue/webdatasource.h" #include "webkit/glue/webframe_impl.h" -#include "webkit/glue/weburlrequest.h" #include "webkit/glue/webview_delegate.h" #include "webkit/glue/webview.h" +using WebKit::WebURLError; + // Number of seconds to wait for the alternate error page server. If it takes // too long, just use the local error page. static const double kDownloadTimeoutSec = 3.0; AltErrorPageResourceFetcher::AltErrorPageResourceFetcher( WebView* web_view, - const WebErrorImpl& web_error, + const WebURLError& web_error, WebFrameImpl* web_frame, const GURL& url) : web_view_(web_view), web_error_(web_error), web_frame_(web_frame) { - failed_request_.reset(web_frame_->GetProvisionalDataSource()-> - GetRequest().Clone()); + failed_request_ = web_frame_->GetProvisionalDataSource()->request(); fetcher_.reset(new ResourceFetcherWithTimeout(url, web_frame->frame(), kDownloadTimeoutSec, this)); } @@ -51,10 +52,10 @@ void AltErrorPageResourceFetcher::OnURLFetchComplete( if (response.httpStatusCode() == 200) { // We successfully got a response from the alternate error page server, so // load it. - delegate->LoadNavigationErrorPage(web_frame_, failed_request_.get(), + delegate->LoadNavigationErrorPage(web_frame_, failed_request_, web_error_, data, true); } else { - delegate->LoadNavigationErrorPage(web_frame_, failed_request_.get(), + delegate->LoadNavigationErrorPage(web_frame_, failed_request_, web_error_, std::string(), true); } } diff --git a/webkit/glue/alt_error_page_resource_fetcher.h b/webkit/glue/alt_error_page_resource_fetcher.h index e729d5a..1f42892 100644 --- a/webkit/glue/alt_error_page_resource_fetcher.h +++ b/webkit/glue/alt_error_page_resource_fetcher.h @@ -14,12 +14,12 @@ MSVC_PUSH_WARNING_LEVEL(0); MSVC_POP_WARNING(); #include "base/scoped_ptr.h" +#include "webkit/api/public/WebURLError.h" +#include "webkit/api/public/WebURLRequest.h" #include "webkit/glue/resource_fetcher.h" -#include "webkit/glue/weberror_impl.h" class ResourceFetcherWithTimeout; class WebFrameImpl; -class WebRequest; class WebView; // Used for downloading alternate dns error pages. Once downloading is done @@ -27,7 +27,7 @@ class WebView; class AltErrorPageResourceFetcher : public ResourceFetcher::Delegate { public: AltErrorPageResourceFetcher(WebView* web_view, - const WebErrorImpl& web_error, + const WebKit::WebURLError& web_error, WebFrameImpl* web_frame, const GURL& url); ~AltErrorPageResourceFetcher(); @@ -38,9 +38,9 @@ class AltErrorPageResourceFetcher : public ResourceFetcher::Delegate { private: // References to our owners WebView* web_view_; - WebErrorImpl web_error_; + WebKit::WebURLError web_error_; WebFrameImpl* web_frame_; - scoped_ptr<WebRequest> failed_request_; + WebKit::WebURLRequest failed_request_; // Does the actual fetching. scoped_ptr<ResourceFetcherWithTimeout> fetcher_; diff --git a/webkit/glue/chrome_client_impl.cc b/webkit/glue/chrome_client_impl.cc index 160833e..ff8aeb5 100644 --- a/webkit/glue/chrome_client_impl.cc +++ b/webkit/glue/chrome_client_impl.cc @@ -39,10 +39,11 @@ MSVC_POP_WARNING(); #include "webkit/api/public/WebInputEvent.h" #include "webkit/api/public/WebKit.h" #include "webkit/api/public/WebRect.h" +#include "webkit/api/public/WebURLRequest.h" +#include "webkit/api/src/WrappedResourceRequest.h" #include "webkit/glue/glue_util.h" #include "webkit/glue/webframe_impl.h" #include "webkit/glue/webkit_glue.h" -#include "webkit/glue/weburlrequest_impl.h" #include "webkit/glue/webview_delegate.h" #include "webkit/glue/webview_impl.h" #include "webkit/glue/webwidget_impl.h" @@ -50,6 +51,8 @@ MSVC_POP_WARNING(); using WebKit::WebInputEvent; using WebKit::WebMouseEvent; using WebKit::WebRect; +using WebKit::WebURLRequest; +using WebKit::WrappedResourceRequest; // Callback class that's given to the WebViewDelegate during a file choose // operation. @@ -210,8 +213,8 @@ WebCore::Page* ChromeClientImpl::createWindow( // The request is empty when we are just being asked to open a blank window. // This corresponds to window.open(""), for example. if (!r.resourceRequest().isEmpty()) { - WebRequestImpl request(r.resourceRequest()); - new_view->main_frame()->LoadRequest(&request); + WrappedResourceRequest request(r.resourceRequest()); + new_view->main_frame()->LoadRequest(request); } WebViewImpl* new_view_impl = static_cast<WebViewImpl*>(new_view); diff --git a/webkit/glue/context_menu_client_impl.cc b/webkit/glue/context_menu_client_impl.cc index 8fca4a6..26bb558 100644 --- a/webkit/glue/context_menu_client_impl.cc +++ b/webkit/glue/context_menu_client_impl.cc @@ -23,15 +23,17 @@ MSVC_POP_WARNING(); #include "webkit/glue/context_menu_client_impl.h" #include "base/string_util.h" +#include "webkit/api/public/WebURL.h" +#include "webkit/api/public/WebURLResponse.h" #include "webkit/glue/context_menu.h" #include "webkit/glue/glue_util.h" #include "webkit/glue/webdatasource_impl.h" -#include "webkit/glue/webresponse.h" -#include "webkit/glue/weburlrequest_impl.h" #include "webkit/glue/webview_impl.h" #include "base/word_iterator.h" +using WebKit::WebDataSource; + namespace { // Helper function to determine whether text is a single word or a sentence. @@ -132,8 +134,8 @@ static ContextNode GetTypeAndURLFromFrame(WebCore::Frame* frame, WebDataSource* ds = WebDataSourceImpl::FromLoader(dl); if (ds) { node = page_node; - *url = ds->HasUnreachableURL() ? ds->GetUnreachableURL() - : ds->GetRequest().GetURL(); + *url = ds->hasUnreachableURL() ? ds->unreachableURL() + : ds->request().url(); } } } @@ -218,10 +220,8 @@ WebCore::PlatformMenuDescription // Now retrieve the security info. WebCore::DocumentLoader* dl = selected_frame->loader()->documentLoader(); WebDataSource* ds = WebDataSourceImpl::FromLoader(dl); - if (ds) { - const WebResponse& response = ds->GetResponse(); - security_info = response.GetSecurityInfo(); - } + if (ds) + security_info = ds->response().securityInfo(); int edit_flags = ContextNode::CAN_DO_NONE; if (webview_->GetFocusedWebCoreFrame()->editor()->canUndo()) diff --git a/webkit/glue/glue_util.cc b/webkit/glue/glue_util.cc index 34bd0fe..ffe9623 100644 --- a/webkit/glue/glue_util.cc +++ b/webkit/glue/glue_util.cc @@ -20,8 +20,9 @@ #include "HTMLFormElement.h" #include "IntPoint.h" #include "IntRect.h" -#include "PlatformString.h" #include "KURL.h" +#include "PlatformString.h" +#include "ResourceError.h" #undef LOG #include "base/compiler_specific.h" @@ -37,6 +38,7 @@ #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" #include "webkit/api/public/WebURLResponse.h" @@ -240,6 +242,18 @@ WTF::PassRefPtr<WebCore::HTMLFormElement> WebFormToHTMLFormElement( return form; } +// WebURLError conversions ----------------------------------------------------- + +WebKit::WebURLError ResourceErrorToWebURLError( + const WebCore::ResourceError& error) { + return error; +} + +WebCore::ResourceError WebURLErrorToResourceError( + const WebKit::WebURLError& error) { + return error; +} + // WebURLRequest conversions --------------------------------------------------- WebCore::ResourceRequest* WebURLRequestToMutableResourceRequest( diff --git a/webkit/glue/glue_util.h b/webkit/glue/glue_util.h index 776dc7e..8d2f5cd 100644 --- a/webkit/glue/glue_util.h +++ b/webkit/glue/glue_util.h @@ -18,6 +18,7 @@ class IntPoint; class IntRect; class IntSize; class KURL; +class ResourceError; class ResourceResponse; class String; struct ResourceRequest; @@ -34,6 +35,7 @@ class WebURLResponse; struct WebPoint; struct WebRect; struct WebSize; +struct WebURLError; } namespace WTF { @@ -115,6 +117,12 @@ WebKit::WebForm HTMLFormElementToWebForm( WTF::PassRefPtr<WebCore::HTMLFormElement> WebFormToHTMLFormElement( const WebKit::WebForm&); +// WebURLError <-> ResourceError +WebKit::WebURLError ResourceErrorToWebURLError( + const WebCore::ResourceError& error); +WebCore::ResourceError WebURLErrorToResourceError( + const WebKit::WebURLError& error); + // Exposes the ResourceRequest contained by a WebURLRequest WebCore::ResourceRequest* WebURLRequestToMutableResourceRequest( WebKit::WebURLRequest* req); diff --git a/webkit/glue/iframe_redirect_unittest.cc b/webkit/glue/iframe_redirect_unittest.cc index dc280e2..dfa6e08 100644 --- a/webkit/glue/iframe_redirect_unittest.cc +++ b/webkit/glue/iframe_redirect_unittest.cc @@ -10,12 +10,18 @@ #include "base/file_util.h" #include "base/string_util.h" -#include "webkit/glue/webdatasource.h" +#include "webkit/api/public/WebDataSource.h" +#include "webkit/api/public/WebURL.h" +#include "webkit/api/public/WebVector.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/webframe.h" #include "webkit/glue/webview.h" #include "webkit/tools/test_shell/test_shell_test.h" +using WebKit::WebDataSource; +using WebKit::WebURL; +using WebKit::WebVector; + typedef TestShellTest IFrameRedirectTest; // Tests that loading a page in an iframe from javascript results in @@ -35,7 +41,8 @@ TEST_F(IFrameRedirectTest, Test) { ASSERT_TRUE(iframe != NULL); WebDataSource* iframe_ds = iframe->GetDataSource(); ASSERT_TRUE(iframe_ds != NULL); - const std::vector<GURL>& redirects = iframe_ds->GetRedirectChain(); - ASSERT_FALSE(redirects.empty()); - ASSERT_TRUE(redirects[0] == GURL("about:blank")); + WebVector<WebURL> redirects; + iframe_ds->redirectChain(redirects); + ASSERT_FALSE(redirects.isEmpty()); + ASSERT_TRUE(GURL(redirects[0]) == GURL("about:blank")); } diff --git a/webkit/glue/inspector_client_impl.cc b/webkit/glue/inspector_client_impl.cc index b208190..b7be8b5 100644 --- a/webkit/glue/inspector_client_impl.cc +++ b/webkit/glue/inspector_client_impl.cc @@ -20,11 +20,12 @@ MSVC_POP_WARNING(); #include "base/gfx/rect.h" #include "base/string_util.h" #include "webkit/api/public/WebRect.h" +#include "webkit/api/public/WebURL.h" +#include "webkit/api/public/WebURLRequest.h" #include "webkit/glue/glue_util.h" #include "webkit/glue/inspector_client_impl.h" #include "webkit/glue/webdevtoolsagent_impl.h" #include "webkit/glue/webkit_glue.h" -#include "webkit/glue/weburlrequest.h" #include "webkit/glue/webview_impl.h" #include "googleurl/src/gurl.h" #include "net/base/net_util.h" @@ -33,6 +34,7 @@ using namespace WebCore; using WebKit::WebRect; using WebKit::WebSize; +using WebKit::WebURLRequest; static const float kDefaultInspectorXPos = 10; static const float kDefaultInspectorYPos = 50; @@ -73,9 +75,8 @@ Page* WebInspectorClient::createPage() { if (!inspector_web_view_) return NULL; - GURL inspector_url(webkit_glue::GetInspectorURL()); - scoped_ptr<WebRequest> request(WebRequest::Create(inspector_url)); - inspector_web_view_->main_frame()->LoadRequest(request.get()); + inspector_web_view_->main_frame()->LoadRequest( + WebURLRequest(webkit_glue::GetInspectorURL())); page = inspector_web_view_->page(); diff --git a/webkit/glue/webdatasource.h b/webkit/glue/webdatasource.h deleted file mode 100644 index 4625508..0000000 --- a/webkit/glue/webdatasource.h +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) 2006-2008 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_H_ -#define WEBKIT_GLUE_WEBDATASOURCE_H_ - -#include <vector> - -#include "base/string16.h" - -class GURL; -class WebFrame; -class WebRequest; -class WebResponse; - -namespace base { -class Time; -} - -enum WebNavigationType { - WebNavigationTypeLinkClicked, - WebNavigationTypeFormSubmitted, - WebNavigationTypeBackForward, - WebNavigationTypeReload, - WebNavigationTypeFormResubmitted, - WebNavigationTypeOther -}; - -class WebDataSource { - public: - // A base class for extra data that may be associated with this datasource. - // See Set/GetExtraData below. - class ExtraData { - public: - virtual ~ExtraData() {} - }; - - virtual ~WebDataSource() {} - - // Returns a reference to the original request data that created the - // datasource. This request will be unmodified by WebKit. - // - // Note that this will be a different physical object than the WebRequest - // that was specified in the load request initiated by the embedder, but the - // data members will be copied. - // - // This call will update the request with the latest information from WebKit, - // so it is important that the caller not cache the result or keep the - // reference across entries into WebKit. - virtual const WebRequest& GetInitialRequest() const = 0; - - // Returns the request that was used to create this datasource. This may - // be modified by WebKit. This is the same as what GetInitialRequest - // returns unless there was a redirect. - // - // Note that this will be a different physical object than the WebRequest - // that was specified in the load request initiated by the embedder. - // - // This call will update the request with the latest information from WebKit, - // so it is important that the caller not cache the result or keep the - // reference across entries into WebKit. - virtual const WebRequest& GetRequest() const = 0; - - // Returns the response associated to this datasource. - virtual const WebResponse& GetResponse() const = 0; - - // Returns the unreachable URL for which this datasource is showing alternate - // content. See WebFrame::LoadAlternateHTML{ErrorPage,String}. - virtual GURL GetUnreachableURL() const = 0; - - // Returns true if there is a non-null unreachable URL. - virtual bool HasUnreachableURL() const = 0; - - // Returns all redirects that occurred (both client and server) before at - // last committing the current page. This will contain one entry for each - // intermediate URL, and one entry for the last URL (so if there are no - // redirects, it will contain exactly the current URL, and if there is one - // redirect, it will contain the source and destination URL). - virtual const std::vector<GURL>& GetRedirectChain() const = 0; - - // Returns the page title. - virtual string16 GetPageTitle() const = 0; - - // The time in seconds (since the epoch) of the event if any that triggered - // this navigation. Returns 0 if unknown. - virtual double GetTriggeringEventTime() const = 0; - - // Returns the reason the document was loaded. - virtual WebNavigationType GetNavigationType() const = 0; - - // Extra data associated with this datasource. If non-null, the extra data - // pointer will be deleted when the datasource is destroyed. Setting the - // extra data pointer will cause any existing non-null extra data pointer to - // be deleted. - virtual ExtraData* GetExtraData() const = 0; - virtual void SetExtraData(ExtraData* extra_data) = 0; -}; - -#endif // #ifndef WEBKIT_GLUE_WEBDATASOURCE_H_ diff --git a/webkit/glue/webdatasource_impl.cc b/webkit/glue/webdatasource_impl.cc index 01e174b..b67c57d 100644 --- a/webkit/glue/webdatasource_impl.cc +++ b/webkit/glue/webdatasource_impl.cc @@ -5,79 +5,74 @@ #include "config.h" #include "webkit/glue/webdatasource_impl.h" -#include "FrameLoaderTypes.h" -#include "FrameLoadRequest.h" -#include "KURL.h" -#include "ResourceRequest.h" - -#undef LOG +#include "webkit/api/public/WebURL.h" +#include "webkit/api/public/WebVector.h" #include "webkit/glue/glue_util.h" -#include "webkit/glue/password_form.h" -#include "webkit/glue/webdatasource_impl.h" -#include "webkit/glue/webframe_impl.h" -#include "webkit/glue/weburlrequest_impl.h" -#include "webkit/glue/webview_delegate.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 WebCore::ResourceRequest& request, - const WebCore::SubstituteData& data) { + const ResourceRequest& request, + const SubstituteData& data) { return adoptRef(new WebDataSourceImpl(request, data)); } -WebDataSourceImpl::WebDataSourceImpl(const WebCore::ResourceRequest& request, - const WebCore::SubstituteData& data) - : WebCore::DocumentLoader(request, data) { +WebDataSourceImpl::WebDataSourceImpl(const ResourceRequest& request, + const SubstituteData& data) + : DocumentLoader(request, data) { } WebDataSourceImpl::~WebDataSourceImpl() { } -const WebRequest& WebDataSourceImpl::GetInitialRequest() const { - // WebKit may change the frame load request as it sees fit, so we must sync - // our request object. - initial_request_.set_resource_request(originalRequest()); - return initial_request_; +const WebURLRequest& WebDataSourceImpl::originalRequest() const { + original_request_.bind(DocumentLoader::originalRequest()); + return original_request_; } -const WebRequest& WebDataSourceImpl::GetRequest() const { - // WebKit may change the frame load request as it sees fit, so we must sync - // our request object. - request_.set_resource_request(request()); +const WebURLRequest& WebDataSourceImpl::request() const { + request_.bind(DocumentLoader::request()); return request_; } -const WebResponse& WebDataSourceImpl::GetResponse() const { - response_.set_resource_response(response()); +const WebURLResponse& WebDataSourceImpl::response() const { + response_.bind(DocumentLoader::response()); return response_; } -GURL WebDataSourceImpl::GetUnreachableURL() const { - const WebCore::KURL& url = unreachableURL(); - return url.isEmpty() ? GURL() : webkit_glue::KURLToGURL(url); +bool WebDataSourceImpl::hasUnreachableURL() const { + return !DocumentLoader::unreachableURL().isEmpty(); } -bool WebDataSourceImpl::HasUnreachableURL() const { - return !unreachableURL().isEmpty(); +WebURL WebDataSourceImpl::unreachableURL() const { + return webkit_glue::KURLToWebURL(DocumentLoader::unreachableURL()); } -const std::vector<GURL>& WebDataSourceImpl::GetRedirectChain() const { - return redirect_chain_; +void WebDataSourceImpl::redirectChain(WebVector<WebURL>& result) const { + result.assign(redirect_chain_); } -void WebDataSourceImpl::ClearRedirectChain() { - redirect_chain_.clear(); +WebString WebDataSourceImpl::pageTitle() const { + return webkit_glue::StringToWebString(title()); } -void WebDataSourceImpl::AppendRedirect(const GURL& url) { - redirect_chain_.push_back(url); -} - -string16 WebDataSourceImpl::GetPageTitle() const { - return webkit_glue::StringToString16(title()); +WebNavigationType WebDataSourceImpl::navigationType() const { + return NavigationTypeToWebNavigationType(triggeringAction().type()); } -double WebDataSourceImpl::GetTriggeringEventTime() const { +double WebDataSourceImpl::triggeringEventTime() const { if (!triggeringAction().event()) return 0.0; @@ -85,15 +80,11 @@ double WebDataSourceImpl::GetTriggeringEventTime() const { return triggeringAction().event()->timeStamp() / 1000.0; } -WebNavigationType WebDataSourceImpl::GetNavigationType() const { - return NavigationTypeToWebNavigationType(triggeringAction().type()); -} - -WebDataSource::ExtraData* WebDataSourceImpl::GetExtraData() const { +WebDataSource::ExtraData* WebDataSourceImpl::extraData() const { return extra_data_.get(); } -void WebDataSourceImpl::SetExtraData(ExtraData* extra_data) { +void WebDataSourceImpl::setExtraData(ExtraData* extra_data) { extra_data_.set(extra_data); } @@ -101,17 +92,30 @@ WebNavigationType WebDataSourceImpl::NavigationTypeToWebNavigationType( WebCore::NavigationType type) { switch (type) { case WebCore::NavigationTypeLinkClicked: - return WebNavigationTypeLinkClicked; + return WebKit::WebNavigationTypeLinkClicked; case WebCore::NavigationTypeFormSubmitted: - return WebNavigationTypeFormSubmitted; + return WebKit::WebNavigationTypeFormSubmitted; case WebCore::NavigationTypeBackForward: - return WebNavigationTypeBackForward; + return WebKit::WebNavigationTypeBackForward; case WebCore::NavigationTypeReload: - return WebNavigationTypeReload; + return WebKit::WebNavigationTypeReload; case WebCore::NavigationTypeFormResubmitted: - return WebNavigationTypeFormResubmitted; + return WebKit::WebNavigationTypeFormResubmitted; case WebCore::NavigationTypeOther: default: - return WebNavigationTypeOther; + 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 index deecf64..e1f9029 100644 --- a/webkit/glue/webdatasource_impl.h +++ b/webkit/glue/webdatasource_impl.h @@ -6,15 +6,19 @@ #define WEBKIT_GLUE_WEBDATASOURCE_IMPL_H_ #include "DocumentLoader.h" +#include <wtf/Vector.h> +#include <wtf/OwnPtr.h> -#include "webkit/glue/webdatasource.h" -#include "webkit/glue/webresponse_impl.h" -#include "webkit/glue/weburlrequest_impl.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 WebDataSource { +class WebDataSourceImpl : public WebCore::DocumentLoader, + public WebKit::WebDataSource { public: static PassRefPtr<WebDataSourceImpl> Create(const WebCore::ResourceRequest&, const WebCore::SubstituteData&); @@ -24,21 +28,23 @@ class WebDataSourceImpl : public WebCore::DocumentLoader, public WebDataSource { } // WebDataSource methods: - virtual const WebRequest& GetInitialRequest() const; - virtual const WebRequest& GetRequest() const; - virtual const WebResponse& GetResponse() const; - virtual GURL GetUnreachableURL() const; - virtual bool HasUnreachableURL() const; - virtual const std::vector<GURL>& GetRedirectChain() const; - virtual string16 GetPageTitle() const; - virtual double GetTriggeringEventTime() const; - virtual WebNavigationType GetNavigationType() const; - virtual ExtraData* GetExtraData() const; - virtual void SetExtraData(ExtraData*); + 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 WebNavigationType NavigationTypeToWebNavigationType( + static WebKit::WebNavigationType NavigationTypeToWebNavigationType( WebCore::NavigationType type); + bool HasRedirectChain() const { return !redirect_chain_.isEmpty(); } + GURL GetEndOfRedirectChain() const; void ClearRedirectChain(); void AppendRedirect(const GURL& url); @@ -49,15 +55,15 @@ class WebDataSourceImpl : public WebCore::DocumentLoader, public WebDataSource { // Mutable because the const getters will magically sync these to the // latest version from WebKit. - mutable WebRequestImpl initial_request_; - mutable WebRequestImpl request_; - mutable WebResponseImpl response_; + 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. - std::vector<GURL> redirect_chain_; + Vector<WebKit::WebURL> redirect_chain_; OwnPtr<ExtraData> extra_data_; diff --git a/webkit/glue/webdevtoolsagent_impl.cc b/webkit/glue/webdevtoolsagent_impl.cc index d885b01..ac50d37 100644 --- a/webkit/glue/webdevtoolsagent_impl.cc +++ b/webkit/glue/webdevtoolsagent_impl.cc @@ -23,15 +23,16 @@ #include "V8Binding.h" #include "base/values.h" +#include "webkit/api/public/WebDataSource.h" +#include "webkit/api/public/WebURL.h" +#include "webkit/api/public/WebURLRequest.h" #include "webkit/glue/devtools/bound_object.h" #include "webkit/glue/devtools/debugger_agent_impl.h" #include "webkit/glue/devtools/debugger_agent_manager.h" #include "webkit/glue/devtools/dom_agent_impl.h" #include "webkit/glue/glue_util.h" -#include "webkit/glue/webdatasource.h" #include "webkit/glue/webdevtoolsagent_delegate.h" #include "webkit/glue/webdevtoolsagent_impl.h" -#include "webkit/glue/weburlrequest.h" #include "webkit/glue/webview_impl.h" using WebCore::Document; @@ -44,6 +45,8 @@ using WebCore::ScriptValue; using WebCore::String; using WebCore::V8ClassIndex; using WebCore::V8Proxy; +using WebKit::WebDataSource; +using WebKit::WebURLRequest; WebDevToolsAgentImpl::WebDevToolsAgentImpl( WebViewImpl* web_view_impl, @@ -148,10 +151,10 @@ void WebDevToolsAgentImpl::DidCommitLoadForFrame( return; } WebDataSource* ds = frame->GetDataSource(); - const WebRequest& request = ds->GetRequest(); - GURL url = ds->HasUnreachableURL() ? - ds->GetUnreachableURL() : - request.GetURL(); + const WebURLRequest& request = ds->request(); + GURL url = ds->hasUnreachableURL() ? + ds->unreachableURL() : + request.url(); tools_agent_delegate_stub_->FrameNavigate( url.possibly_invalid_spec(), webview->GetMainFrame() == frame); diff --git a/webkit/glue/weberror.h b/webkit/glue/weberror.h deleted file mode 100644 index c7ad644..0000000 --- a/webkit/glue/weberror.h +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2006-2008 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_WEBERROR_H__ -#define WEBKIT_GLUE_WEBERROR_H__ - -class GURL; - -class WebError { - public: - // The network error code. - virtual int GetErrorCode() const = 0; - - // The URL that failed. - virtual const GURL& GetFailedURL() const = 0; -}; - -#endif // WEBKIT_GLUE_WEBERROR_H__ diff --git a/webkit/glue/weberror_impl.cc b/webkit/glue/weberror_impl.cc deleted file mode 100644 index 0950624..0000000 --- a/webkit/glue/weberror_impl.cc +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2006-2008 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 "ResourceError.h" - -#undef LOG -#include "webkit/glue/weberror_impl.h" - -#include "webkit/glue/glue_util.h" -#include "webkit/glue/webkit_glue.h" - -WebErrorImpl::WebErrorImpl(const WebCore::ResourceError& e) - : error_code_(e.errorCode()), - failed_url_(webkit_glue::StringToStdString(e.failingURL())) { -} - -WebErrorImpl::WebErrorImpl(const WebError& e) - : error_code_(e.GetErrorCode()), - failed_url_(e.GetFailedURL()) { -} - -int WebErrorImpl::GetErrorCode() const { - return error_code_; -} - -const GURL& WebErrorImpl::GetFailedURL() const { - return failed_url_; -} diff --git a/webkit/glue/weberror_impl.h b/webkit/glue/weberror_impl.h deleted file mode 100644 index 210f402..0000000 --- a/webkit/glue/weberror_impl.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2006-2008 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_WEBERROR_IMPL_H__ -#define WEBKIT_GLUE_WEBERROR_IMPL_H__ - -#include "base/basictypes.h" -#include "webkit/glue/weberror.h" -#include "googleurl/src/gurl.h" - -namespace WebCore { -class ResourceError; -}; - -class WebErrorImpl : public WebError { - public: - explicit WebErrorImpl(const WebCore::ResourceError& error); - explicit WebErrorImpl(const WebError& error); - ~WebErrorImpl() {} - - // WebError implementation: - virtual int GetErrorCode() const; - virtual const GURL& GetFailedURL() const; - - private: - int error_code_; - GURL failed_url_; - - // Disallow assignment operator - void operator=(const WebErrorImpl&); -}; - -#endif // WEBKIT_GLUE_WEBERROR_IMPL_H__ diff --git a/webkit/glue/webframe.h b/webkit/glue/webframe.h index ad80a0d..1789bfb 100644 --- a/webkit/glue/webframe.h +++ b/webkit/glue/webframe.h @@ -14,20 +14,20 @@ class GURL; class WebAppCacheContext; -class WebDataSource; -class WebError; -class WebRequest; class WebView; class WebTextInput; struct NPObject; namespace WebKit { +class WebDataSource; class WebForm; +class WebURLRequest; struct WebConsoleMessage; struct WebFindOptions; struct WebRect; struct WebScriptSource; struct WebSize; +struct WebURLError; } // Every frame in a web page is represented by one WebFrame, including the @@ -69,8 +69,8 @@ class WebFrame { virtual NPObject* GetWindowNPObject() = 0; - // Loads the given WebRequest. - virtual void LoadRequest(WebRequest* request) = 0; + // Loads the given WebURLRequest. + virtual void LoadRequest(const WebKit::WebURLRequest& request) = 0; // Loads the given history state. This corresponds to a back/forward // navigation. @@ -96,7 +96,7 @@ class WebFrame { // it is the given request /w the |display_url| substituted for the request's // URL, which is repeated. The |html_text| is not stored in session history. // - virtual void LoadAlternateHTMLString(const WebRequest* request, + virtual void LoadAlternateHTMLString(const WebKit::WebURLRequest& request, const std::string& html_text, const GURL& display_url, bool replace) = 0; @@ -105,8 +105,8 @@ class WebFrame { // the WebViewDelegate of the results so it can decide whether or not to show // something to the user (e.g., a local error page or the alternate error // page). - virtual void LoadAlternateHTMLErrorPage(const WebRequest* request, - const WebError& error, + virtual void LoadAlternateHTMLErrorPage(const WebKit::WebURLRequest& request, + const WebKit::WebURLError& error, const GURL& error_page_url, bool replace, const GURL& fake_url) = 0; @@ -164,14 +164,14 @@ class WebFrame { // Returns the committed data source, which is the last data source that has // successfully started loading. Will return NULL if no provisional data // has been committed. - virtual WebDataSource* GetDataSource() const = 0; + virtual WebKit::WebDataSource* GetDataSource() const = 0; // Returns the provisional data source, which is a data source where a // request has been made, but we are not sure if we will use data from it // (for example, it may be an invalid URL). When the provisional load is // "committed," it will become the "real" data source (see GetDataSource // above) and the provisional data source will be NULL. - virtual WebDataSource* GetProvisionalDataSource() const = 0; + virtual WebKit::WebDataSource* GetProvisionalDataSource() const = 0; // // @method stopLoading diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc index f573dcb..24d1e4b 100644 --- a/webkit/glue/webframe_impl.cc +++ b/webkit/glue/webframe_impl.cc @@ -154,9 +154,7 @@ MSVC_POP_WARNING(); #include "webkit/glue/glue_util.h" #include "webkit/glue/webappcachecontext.h" #include "webkit/glue/webdatasource_impl.h" -#include "webkit/glue/weberror_impl.h" #include "webkit/glue/webframe_impl.h" -#include "webkit/glue/weburlrequest_impl.h" #include "webkit/glue/webtextinput_impl.h" #include "webkit/glue/webview_impl.h" @@ -205,11 +203,16 @@ using WebCore::VisiblePosition; using WebCore::XPathResult; using WebKit::WebConsoleMessage; +using WebKit::WebDataSource; using WebKit::WebFindOptions; using WebKit::WebForm; using WebKit::WebRect; using WebKit::WebScriptSource; using WebKit::WebSize; +using WebKit::WebURL; +using WebKit::WebURLError; +using WebKit::WebURLRequest; +using WebKit::WebURLResponse; // Key for a StatsCounter tracking how many WebFrames are active. static const char* const kWebFrameActiveCount = "WebFrameActiveCount"; @@ -410,8 +413,8 @@ void WebFrameImpl::InitMainFrame(WebViewImpl* webview_impl) { app_cache_context_->Initialize(WebAppCacheContext::MAIN_FRAME, NULL); } -void WebFrameImpl::LoadRequest(WebRequest* request) { - InternalLoadRequest(request, SubstituteData(), NULL, false); +void WebFrameImpl::LoadRequest(const WebURLRequest& request) { + InternalLoadRequest(request, SubstituteData(), false); } void WebFrameImpl::LoadHistoryState(const std::string& history_state) { @@ -419,35 +422,46 @@ void WebFrameImpl::LoadHistoryState(const std::string& history_state) { webkit_glue::HistoryItemFromString(history_state); DCHECK(history_item.get()); - WebRequestImpl dummy_request; - InternalLoadRequest(&dummy_request, SubstituteData(), history_item, false); + StopLoading(); // make sure existing activity stops + + // If there is no current_item, which happens when we are navigating in + // session history after a crash, we need to manufacture one otherwise WebKit + // hoarks. This is probably the wrong thing to do, but it seems to work. + RefPtr<HistoryItem> current_item = frame_->loader()->currentHistoryItem(); + if (!current_item) { + current_item = HistoryItem::create(); + current_item->setLastVisitWasFailure(true); + frame_->loader()->setCurrentHistoryItem(current_item); + GetWebViewImpl()->SetCurrentHistoryItem(current_item.get()); + } + + frame_->loader()->goToItem(history_item.get(), + WebCore::FrameLoadTypeIndexedBackForward); } -void WebFrameImpl::InternalLoadRequest(const WebRequest* request, +void WebFrameImpl::InternalLoadRequest(const WebURLRequest& request, const SubstituteData& data, - PassRefPtr<HistoryItem> history_item, bool replace) { - const WebRequestImpl* request_impl = - static_cast<const WebRequestImpl*>(request); - - const ResourceRequest& resource_request = request_impl->resource_request(); + const ResourceRequest* resource_request = + webkit_glue::WebURLRequestToResourceRequest(&request); + DCHECK(resource_request); // Special-case javascript URLs. Do not interrupt the existing load when - // asked to load a javascript URL unless the script generates a result. - // We can't just use FrameLoader::executeIfJavaScriptURL because it doesn't + // asked to load a javascript URL unless the script generates a result. We + // can't just use FrameLoader::executeIfJavaScriptURL because it doesn't // handle redirects properly. - const KURL& kurl = resource_request.url(); + const KURL& kurl = resource_request->url(); if (!data.isValid() && kurl.protocol() == "javascript") { // Don't attempt to reload javascript URLs. - if (resource_request.cachePolicy() == ReloadIgnoringCacheData) + if (resource_request->cachePolicy() == ReloadIgnoringCacheData) return; // We can't load a javascript: URL if there is no Document! if (!frame_->document()) return; - // TODO(darin): Is this the best API to use here? It works and seems good, - // but will it change out from under us? + // TODO(darin): Is this the best API to use here? It works and seems + // good, but will it change out from under us? String script = decodeURLEscapeSequences( kurl.string().substring(sizeof("javascript:")-1)); WebCore::ScriptValue result = frame_->loader()->executeScript(script, true); @@ -455,8 +469,8 @@ void WebFrameImpl::InternalLoadRequest(const WebRequest* request, if (result.getString(scriptResult) && !frame_->loader()->isScheduledLocationChangePending()) { // TODO(darin): We need to figure out how to represent this in session - // history. Hint: don't re-eval script when the user or script navigates - // back-n-forth (instead store the script result somewhere). + // history. Hint: don't re-eval script when the user or script + // navigates back-n-forth (instead store the script result somewhere). LoadDocumentData(kurl, scriptResult, String("text/html"), String()); } return; @@ -465,44 +479,26 @@ void WebFrameImpl::InternalLoadRequest(const WebRequest* request, StopLoading(); // make sure existing activity stops if (data.isValid()) { - frame_->loader()->load(resource_request, data, false); + DCHECK(resource_request); + frame_->loader()->load(*resource_request, data, false); if (replace) { // Do this to force WebKit to treat the load as replacing the currently // loaded page. frame_->loader()->setReplacing(); } - } else if (history_item.get()) { - // Use the history item if we have one, otherwise fall back to standard - // load. - RefPtr<HistoryItem> current_item = frame_->loader()->currentHistoryItem(); - - // If there is no current_item, which happens when we are navigating in - // session history after a crash, we need to manufacture one otherwise - // WebKit hoarks. This is probably the wrong thing to do, but it seems to - // work. - if (!current_item) { - current_item = HistoryItem::create(); - current_item->setLastVisitWasFailure(true); - frame_->loader()->setCurrentHistoryItem(current_item); - GetWebViewImpl()->SetCurrentHistoryItem(current_item.get()); - } - - frame_->loader()->goToItem(history_item.get(), - WebCore::FrameLoadTypeIndexedBackForward); - } else if (resource_request.cachePolicy() == ReloadIgnoringCacheData) { + } else if (resource_request->cachePolicy() == ReloadIgnoringCacheData) { frame_->loader()->reload(); } else { - frame_->loader()->load(resource_request, false); + frame_->loader()->load(*resource_request, false); } } void WebFrameImpl::LoadHTMLString(const std::string& html_text, const GURL& base_url) { - WebRequestImpl request(base_url); - LoadAlternateHTMLString(&request, html_text, GURL(), false); + LoadAlternateHTMLString(WebURLRequest(base_url), html_text, GURL(), false); } -void WebFrameImpl::LoadAlternateHTMLString(const WebRequest* request, +void WebFrameImpl::LoadAlternateHTMLString(const WebURLRequest& request, const std::string& html_text, const GURL& display_url, bool replace) { @@ -514,14 +510,14 @@ void WebFrameImpl::LoadAlternateHTMLString(const WebRequest* request, webkit_glue::GURLToKURL(display_url)); DCHECK(subst_data.isValid()); - InternalLoadRequest(request, subst_data, NULL, replace); + InternalLoadRequest(request, subst_data, replace); } GURL WebFrameImpl::GetURL() const { const WebDataSource* ds = GetDataSource(); if (!ds) return GURL(); - return ds->GetRequest().GetURL(); + return ds->request().url(); } GURL WebFrameImpl::GetFavIconURL() const { @@ -1632,7 +1628,8 @@ void WebFrameImpl::DidFail(const ResourceError& error, bool was_provisional) { WebViewImpl* web_view = GetWebViewImpl(); WebViewDelegate* delegate = web_view->delegate(); if (delegate) { - WebErrorImpl web_error(error); + const WebURLError& web_error = + webkit_glue::ResourceErrorToWebURLError(error); if (was_provisional) { delegate->DidFailProvisionalLoadWithError(web_view, web_error, this); } else { @@ -1641,8 +1638,8 @@ void WebFrameImpl::DidFail(const ResourceError& error, bool was_provisional) { } } -void WebFrameImpl::LoadAlternateHTMLErrorPage(const WebRequest* request, - const WebError& error, +void WebFrameImpl::LoadAlternateHTMLErrorPage(const WebURLRequest& request, + const WebURLError& error, const GURL& error_page_url, bool replace, const GURL& fake_url) { @@ -1650,16 +1647,14 @@ void WebFrameImpl::LoadAlternateHTMLErrorPage(const WebRequest* request, // the original request so we can replace its URL with a dummy URL. That // prevents other web content from the same origin as the failed URL to // script the error page. - scoped_ptr<WebRequest> failed_request(request->Clone()); - failed_request->SetURL(fake_url); + WebURLRequest failed_request(request); + failed_request.setURL(fake_url); - LoadAlternateHTMLString(failed_request.get(), std::string(), - error.GetFailedURL(), replace); + LoadAlternateHTMLString(failed_request, std::string(), + error.unreachableURL, replace); - WebErrorImpl weberror_impl(error); - alt_error_page_fetcher_.reset( - new AltErrorPageResourceFetcher(GetWebViewImpl(), weberror_impl, this, - error_page_url)); + alt_error_page_fetcher_.reset(new AltErrorPageResourceFetcher( + GetWebViewImpl(), error, this, error_page_url)); } void WebFrameImpl::ExecuteScript(const WebScriptSource& source) { @@ -1877,26 +1872,26 @@ float WebFrameImpl::PrintPage(int page, skia::PlatformCanvas* canvas) { void WebFrameImpl::SelectAppCacheWithoutManifest() { WebDataSource* ds = GetDataSource(); DCHECK(ds); - if (ds->HasUnreachableURL()) { + if (ds->hasUnreachableURL()) { app_cache_context_->SelectAppCacheWithoutManifest( - ds->GetUnreachableURL(), + ds->unreachableURL(), WebAppCacheContext::kNoAppCacheId); } else { - const WebResponse& response = ds->GetResponse(); + const WebURLResponse& response = ds->response(); app_cache_context_->SelectAppCacheWithoutManifest( GetURL(), - response.GetAppCacheID()); + response.appCacheID()); } } void WebFrameImpl::SelectAppCacheWithManifest(const GURL &manifest_url) { WebDataSource* ds = GetDataSource(); DCHECK(ds); - DCHECK(!ds->HasUnreachableURL()); - const WebResponse& response = ds->GetResponse(); + DCHECK(!ds->hasUnreachableURL()); + const WebURLResponse& response = ds->response(); app_cache_context_->SelectAppCacheWithManifest( GetURL(), - response.GetAppCacheID(), + response.appCacheID(), manifest_url); } diff --git a/webkit/glue/webframe_impl.h b/webkit/glue/webframe_impl.h index 54da684..6db3aa0 100644 --- a/webkit/glue/webframe_impl.h +++ b/webkit/glue/webframe_impl.h @@ -42,9 +42,7 @@ MSVC_POP_WARNING(); class AltErrorPageResourceFetcher; class ChromePrintContext; class WebDataSourceImpl; -class WebErrorImpl; class WebPluginDelegate; -class WebRequest; class WebView; class WebViewImpl; class WebTextInput; @@ -78,16 +76,16 @@ class WebFrameImpl : public WebFrame, public base::RefCounted<WebFrameImpl> { void InitMainFrame(WebViewImpl* webview_impl); // WebFrame - virtual void LoadRequest(WebRequest* request); + virtual void LoadRequest(const WebKit::WebURLRequest& request); virtual void LoadHistoryState(const std::string& history_state); virtual void LoadHTMLString(const std::string& html_text, const GURL& base_url); - virtual void LoadAlternateHTMLString(const WebRequest* request, + virtual void LoadAlternateHTMLString(const WebKit::WebURLRequest& request, const std::string& html_text, const GURL& display_url, bool replace); - virtual void LoadAlternateHTMLErrorPage(const WebRequest* request, - const WebError& error, + virtual void LoadAlternateHTMLErrorPage(const WebKit::WebURLRequest& request, + const WebKit::WebURLError& error, const GURL& error_page_url, bool replace, const GURL& fake_url); @@ -102,8 +100,8 @@ class WebFrameImpl : public WebFrame, public base::RefCounted<WebFrameImpl> { virtual GURL GetFavIconURL() const; virtual GURL GetOSDDURL() const; virtual int GetContentsPreferredWidth() const; - virtual WebDataSource* GetDataSource() const; - virtual WebDataSource* GetProvisionalDataSource() const; + virtual WebKit::WebDataSource* GetDataSource() const; + virtual WebKit::WebDataSource* GetProvisionalDataSource() const; virtual void StopLoading(); virtual WebFrame* GetOpener() const; virtual WebFrame* GetParent() const; @@ -393,9 +391,8 @@ class WebFrameImpl : public WebFrame, public base::RefCounted<WebFrameImpl> { // Determines whether to invalidate the content area and scrollbar. void InvalidateIfNecessary(); - void InternalLoadRequest(const WebRequest* request, + void InternalLoadRequest(const WebKit::WebURLRequest& request, const WebCore::SubstituteData& data, - PassRefPtr<WebCore::HistoryItem> history_item, bool replace); // Clears the map of password listeners. diff --git a/webkit/glue/webframeloaderclient_impl.cc b/webkit/glue/webframeloaderclient_impl.cc index 5a31352..d5e950f 100644 --- a/webkit/glue/webframeloaderclient_impl.cc +++ b/webkit/glue/webframeloaderclient_impl.cc @@ -45,6 +45,11 @@ MSVC_POP_WARNING(); #include "webkit/activex_shim/activex_shared.h" #endif #include "webkit/api/public/WebForm.h" +#include "webkit/api/public/WebURL.h" +#include "webkit/api/public/WebURLError.h" +#include "webkit/api/public/WebVector.h" +#include "webkit/api/src/WrappedResourceRequest.h" +#include "webkit/api/src/WrappedResourceResponse.h" #include "webkit/glue/autofill_form.h" #include "webkit/glue/alt_404_page_resource_fetcher.h" #include "webkit/glue/glue_util.h" @@ -54,20 +59,21 @@ MSVC_POP_WARNING(); #include "webkit/glue/webappcachecontext.h" #include "webkit/glue/webdatasource_impl.h" #include "webkit/glue/webdevtoolsagent_impl.h" -#include "webkit/glue/weberror_impl.h" #include "webkit/glue/webframeloaderclient_impl.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/webplugin_delegate.h" #include "webkit/glue/webplugin_impl.h" -#include "webkit/glue/webresponse_impl.h" #include "webkit/glue/webview_delegate.h" #include "webkit/glue/webview_impl.h" -#include "webkit/glue/weburlrequest.h" -#include "webkit/glue/weburlrequest_impl.h" using namespace WebCore; using base::Time; using base::TimeDelta; +using WebKit::WebNavigationType; +using WebKit::WebURL; +using WebKit::WebVector; +using WebKit::WrappedResourceRequest; +using WebKit::WrappedResourceResponse; // Domain for internal error codes. static const char kInternalErrorDomain[] = "webkit_glue"; @@ -179,7 +185,7 @@ void WebFrameLoaderClient::assignIdentifierToInitialRequest( WebViewImpl* webview = webframe_->GetWebViewImpl(); WebViewDelegate* d = webview->delegate(); if (d) { - WebRequestImpl webreq(request); + WrappedResourceRequest webreq(request); d->AssignIdentifierToRequest(webview, identifier, webreq); } } @@ -226,9 +232,8 @@ void WebFrameLoaderClient::dispatchWillSendRequest( WebViewImpl* webview = webframe_->GetWebViewImpl(); WebViewDelegate* d = webview->delegate(); if (d) { - WebRequestImpl webreq(request); + WrappedResourceRequest webreq(request); d->WillSendRequest(webview, identifier, &webreq); - request = webreq.resource_request(); } request.setAppCacheContextID( @@ -360,8 +365,8 @@ void WebFrameLoaderClient::dispatchDidFailLoading(DocumentLoader* loader, const ResourceError& error) { WebViewImpl* webview = webframe_->GetWebViewImpl(); if (webview && webview->delegate()) { - webview->delegate()->DidFailLoadingWithError(webview, identifier, - WebErrorImpl(error)); + webview->delegate()->DidFailLoadingWithError( + webview, identifier, webkit_glue::ResourceErrorToWebURLError(error)); } } @@ -391,8 +396,8 @@ bool WebFrameLoaderClient::dispatchDidLoadResourceFromMemoryCache( bool result = false; if (d) { - WebRequestImpl webreq(request); - WebResponseImpl webresp(response); + WrappedResourceRequest webreq(request); + WrappedResourceResponse webresp(response); result = d->DidLoadResourceFromMemoryCache(webview, webreq, webresp, webframe_); } @@ -505,13 +510,13 @@ void WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad() // A provisional load should have started already, which should have put an // entry in our redirect chain. - DCHECK(!ds->GetRedirectChain().empty()); + 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->GetRequest().GetURL()); + ds->AppendRedirect(ds->request().url()); // Dispatch callback WebViewImpl* webview = webframe_->GetWebViewImpl(); @@ -579,8 +584,8 @@ void WebFrameLoaderClient::dispatchDidChangeLocationWithinPage() { WebDataSourceImpl* ds = webframe_->GetDataSourceImpl(); DCHECK(ds) << "DataSource NULL when navigating to reference fragment"; if (ds) { - GURL url = ds->GetRequest().GetURL(); - GURL chain_end = ds->GetRedirectChain().back(); + GURL url = ds->request().url(); + GURL chain_end = ds->GetEndOfRedirectChain(); ds->ClearRedirectChain(); // Figure out if this location change is because of a JS-initiated client @@ -651,11 +656,11 @@ void WebFrameLoaderClient::dispatchDidStartProvisionalLoad() { NOTREACHED() << "Attempting to provisional load but there isn't one"; return; } - const GURL& url = ds->GetRequest().GetURL(); + GURL url = ds->request().url(); // Since the provisional load just started, we should have not gotten // any redirects yet. - DCHECK(ds->GetRedirectChain().empty()); + DCHECK(!ds->HasRedirectChain()); WebViewImpl* webview = webframe_->GetWebViewImpl(); WebViewDelegate* d = webview->delegate(); @@ -910,18 +915,18 @@ void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction( // such navigations. const WebDataSourceImpl* ds = webframe_->GetProvisionalDataSourceImpl(); if (ds) { - const GURL& url = ds->GetRequest().GetURL(); + GURL url = ds->request().url(); if (url.SchemeIs(webkit_glue::kBackForwardNavigationScheme)) { HandleBackForwardNavigation(url); disposition = IGNORE_ACTION; } else { - bool is_redirect = !ds->GetRedirectChain().empty(); + bool is_redirect = ds->HasRedirectChain(); WebNavigationType webnav_type = WebDataSourceImpl::NavigationTypeToWebNavigationType(action.type()); disposition = d->DispositionForNavigationAction( - wv, webframe_, &ds->GetRequest(), webnav_type, disposition, is_redirect); + wv, webframe_, ds->request(), webnav_type, disposition, is_redirect); } if (disposition != IGNORE_ACTION) { diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc index 6d5a0c3..80e97f8 100644 --- a/webkit/glue/webkit_glue.cc +++ b/webkit/glue/webkit_glue.cc @@ -42,7 +42,6 @@ #include "webkit/glue/event_conversion.h" #include "webkit/glue/glue_serialize.h" #include "webkit/glue/glue_util.h" -#include "webkit/glue/weburlrequest_impl.h" #include "webkit/glue/webframe_impl.h" #include "webkit/glue/webview_impl.h" diff --git a/webkit/glue/webresponse.h b/webkit/glue/webresponse.h deleted file mode 100644 index 3ee4ed5..0000000 --- a/webkit/glue/webresponse.h +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) 2006-2008 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_WEBURLRESPONSE_H_ -#define WEBKIT_GLUE_WEBURLRESPONSE_H_ - -#include <string> - -#include "base/basictypes.h" - -class GURL; - -class WebResponse { - public: - // Get the URL. - virtual GURL GetURL() const = 0; - - // Get the http status code. - virtual int GetHttpStatusCode() const = 0; - - // Returns the mime type of the response. - virtual std::string GetMimeType() const = 0; - - // Returns an opaque value containing the state of the SSL connection that - // the resource was loaded on, or an empty string if no SSL connection was - // used. - virtual std::string GetSecurityInfo() const = 0; - - // Returns whether the content of this resource was filtered (usually for - // security reasons). - virtual bool IsContentFiltered() const = 0; - - // Returns the appcacheId this response was loaded from, or kNoAppCacheId. - virtual int64 GetAppCacheID() const = 0; - - virtual ~WebResponse() {} -}; - -#endif // #ifndef WEBKIT_GLUE_WEBURLRESPONSE_H_ diff --git a/webkit/glue/webresponse_impl.h b/webkit/glue/webresponse_impl.h deleted file mode 100644 index 47f097c..0000000 --- a/webkit/glue/webresponse_impl.h +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2006-2008 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_WEBRESPONSEIMPL_H_ -#define WEBKIT_GLUE_WEBRESPONSEIMPL_H_ - -#include "googleurl/src/gurl.h" -#include "webkit/glue/glue_util.h" -#include "webkit/glue/webresponse.h" - -#include "ResourceResponse.h" - -class WebResponseImpl : public WebResponse { - public: - WebResponseImpl() { } - explicit WebResponseImpl(const WebCore::ResourceResponse& response) - : response_(response) { } - - virtual ~WebResponseImpl() { } - - // Get the URL. - virtual GURL GetURL() const { - return webkit_glue::KURLToGURL(response_.url()); - } - - // Get the http status code. - virtual int GetHttpStatusCode() const { return response_.httpStatusCode(); } - - virtual std::string GetMimeType() const { - return webkit_glue::StringToStdString(response_.mimeType()); - } - - // Get the security info (state of the SSL connection). - virtual std::string GetSecurityInfo() const { - return webkit_glue::CStringToStdString(response_.getSecurityInfo()); - } - - void set_resource_response(const WebCore::ResourceResponse& response) { - response_ = response; - } - - virtual bool IsContentFiltered() const { - return response_.isContentFiltered(); - } - - virtual int64 GetAppCacheID() const { - return response_.getAppCacheID(); - } - - private: - WebCore::ResourceResponse response_; - - DISALLOW_EVIL_CONSTRUCTORS(WebResponseImpl); -}; - -#endif // #ifndef WEBKIT_GLUE_WEBRESPONSEIMPL_H_ diff --git a/webkit/glue/weburlrequest.h b/webkit/glue/weburlrequest.h deleted file mode 100644 index d26886a..0000000 --- a/webkit/glue/weburlrequest.h +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) 2006-2008 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_WEBURLREQUEST_H_ -#define WEBKIT_GLUE_WEBURLREQUEST_H_ - -#include <map> -#include <string> - -enum WebRequestCachePolicy { - WebRequestUseProtocolCachePolicy, - WebRequestReloadIgnoringCacheData, - WebRequestReturnCacheDataElseLoad, - WebRequestReturnCacheDataDontLoad -}; - -namespace net { -class UploadData; -} - -class GURL; - -class WebRequest { - public: - typedef std::map<std::string, std::string> HeaderMap; - - // Creates a WebRequest. - static WebRequest* Create(const GURL& url); - - // Creates a copy of this WebRequest. - virtual WebRequest* Clone() const = 0; - - // Get/set the URL. - virtual GURL GetURL() const = 0; - virtual void SetURL(const GURL& url) = 0; - - // Get/set the URL of the first party for cookies, which may be different - // from the URL for a subframe load. - virtual GURL GetFirstPartyForCookies() const = 0; - virtual void SetFirstPartyForCookies(const GURL& url) = 0; - - // Get/set the cache policy. - virtual WebRequestCachePolicy GetCachePolicy() const = 0; - virtual void SetCachePolicy(WebRequestCachePolicy policy) = 0; - - // Get/set the HTTP request method. - virtual std::string GetHttpMethod() const = 0; - virtual void SetHttpMethod(const std::string& method) = 0; - - // Returns the string corresponding to a header set in the request. If the - // given header was not set in the request, the empty string is returned. - virtual std::string GetHttpHeaderValue(const std::string& field) const = 0; - - // Set a value for a header in the request. - virtual void SetHttpHeaderValue(const std::string& field, - const std::string& value) = 0; - - // Fills a map with all header name/value pairs set in the request. - virtual void GetHttpHeaders(HeaderMap* headers) const = 0; - - // Sets the header name/value pairs for the request from a map. Values set - // using this method replace any pre-existing values with the same name. - // Passing in a blank value will result in a header with a blank value being - // sent as part of the request. - virtual void SetHttpHeaders(const HeaderMap& headers) = 0; - - // Helper function for GetHeaderValue to retrieve the referrer. This - // referrer is generated automatically by WebKit when navigation events - // occur. If there was no referrer (for example, the browser instructed - // WebKit to navigate), the returned string will be empty. - // - // It is preferred to call this instead of GetHttpHeaderValue, because the - // way referrers are stored may change in the future. - // - virtual std::string GetHttpReferrer() const = 0; - - // Get/set an opaque value containing the security info (including SSL - // connection state) that should be reported as used in the response for that - // request, or an empty string if no security info should be reported. This - // is usually used to simulate security errors on a page (typically an error - // page that should contain the errors of the actual page that has the - // errors). - virtual std::string GetSecurityInfo() const = 0; - virtual void SetSecurityInfo(const std::string& info) = 0; - - // Returns true if the request has upload data. - virtual bool HasUploadData() const = 0; - - // Returns the request upload data. This object is temporary and should be - // deleted after use. - virtual void GetUploadData(net::UploadData* data) const = 0; - - // Set the request upload data. - virtual void SetUploadData(const net::UploadData& data) = 0; - - // Sets the requestor id. - virtual void SetRequestorID(int requestor_id) = 0; - - virtual ~WebRequest() { } -}; - -#endif // #ifndef WEBKIT_GLUE_WEBURLREQUEST_H_ diff --git a/webkit/glue/weburlrequest_impl.cc b/webkit/glue/weburlrequest_impl.cc deleted file mode 100644 index 7e82ba9..0000000 --- a/webkit/glue/weburlrequest_impl.cc +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright (c) 2006-2008 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 "FormData.h" -#include "HTTPHeaderMap.h" -#include "ResourceRequest.h" - -#undef LOG -#include "base/logging.h" -#include "googleurl/src/gurl.h" -#include "net/base/upload_data.h" -#include "webkit/glue/weburlrequest_impl.h" -#include "webkit/glue/glue_serialize.h" -#include "webkit/glue/glue_util.h" - -using WebCore::FormData; -using WebCore::FormDataElement; -using WebCore::HTTPHeaderMap; -using WebCore::ResourceRequest; -using WebCore::ResourceRequestCachePolicy; -using WebCore::String; - -// WebRequest ----------------------------------------------------------------- - -WebRequestImpl::WebRequestImpl() { -} - -WebRequestImpl::WebRequestImpl(const GURL& url) - : request_(ResourceRequest(webkit_glue::GURLToKURL(url))) { -} - -WebRequestImpl::WebRequestImpl(const ResourceRequest& request) - : request_(request) { -} - -WebRequest* WebRequestImpl::Clone() const { - return new WebRequestImpl(*this); -} - -GURL WebRequestImpl::GetURL() const { - return webkit_glue::KURLToGURL(request_.url()); -} - -void WebRequestImpl::SetURL(const GURL& url) { - request_.setURL(webkit_glue::GURLToKURL(url)); -} - -GURL WebRequestImpl::GetFirstPartyForCookies() const { - return webkit_glue::KURLToGURL(request_.firstPartyForCookies()); -} - -void WebRequestImpl::SetFirstPartyForCookies(const GURL& url) { - request_.setFirstPartyForCookies(webkit_glue::GURLToKURL(url)); -} - -WebRequestCachePolicy WebRequestImpl::GetCachePolicy() const { - // WebRequestCachePolicy mirrors ResourceRequestCachePolicy - return static_cast<WebRequestCachePolicy>(request_.cachePolicy()); -} - -void WebRequestImpl::SetCachePolicy(WebRequestCachePolicy policy) { - // WebRequestCachePolicy mirrors ResourceRequestCachePolicy - request_.setCachePolicy( - static_cast<ResourceRequestCachePolicy>(policy)); -} - -std::string WebRequestImpl::GetHttpMethod() const { - return webkit_glue::StringToStdString(request_.httpMethod()); -} - -void WebRequestImpl::SetHttpMethod(const std::string& method) { - request_.setHTTPMethod(webkit_glue::StdStringToString(method)); -} - -std::string WebRequestImpl::GetHttpHeaderValue(const std::string& field) const { - return webkit_glue::StringToStdString( - request_.httpHeaderField(webkit_glue::StdStringToString(field))); -} - -void WebRequestImpl::SetHttpHeaderValue(const std::string& field, - const std::string& value) { - request_.setHTTPHeaderField( - webkit_glue::StdStringToString(field), - webkit_glue::StdStringToString(value)); -} - -void WebRequestImpl::GetHttpHeaders(HeaderMap* headers) const { - headers->clear(); - - const HTTPHeaderMap& map = request_.httpHeaderFields(); - HTTPHeaderMap::const_iterator end = map.end(); - HTTPHeaderMap::const_iterator it = map.begin(); - for (; it != end; ++it) { - headers->insert(std::make_pair( - webkit_glue::StringToStdString(it->first), - webkit_glue::StringToStdString(it->second))); - } -} - -void WebRequestImpl::SetHttpHeaders(const HeaderMap& headers) { - HeaderMap::const_iterator end = headers.end(); - HeaderMap::const_iterator it = headers.begin(); - for (; it != end; ++it) { - request_.setHTTPHeaderField( - webkit_glue::StdStringToString(it->first), - webkit_glue::StdStringToString(it->second)); - } -} - -std::string WebRequestImpl::GetHttpReferrer() const { - return webkit_glue::StringToStdString(request_.httpReferrer()); -} - -std::string WebRequestImpl::GetSecurityInfo() const { - return webkit_glue::CStringToStdString(request_.securityInfo()); -} - -void WebRequestImpl::SetSecurityInfo(const std::string& value) { - request_.setSecurityInfo(webkit_glue::StdStringToCString(value)); -} - -bool WebRequestImpl::HasUploadData() const { - FormData* formdata = request_.httpBody(); - return formdata && !formdata->isEmpty(); -} - -void WebRequestImpl::GetUploadData(net::UploadData* data) const { - FormData* formdata = request_.httpBody(); - if (!formdata) - return; - - const Vector<FormDataElement>& elements = formdata->elements(); - Vector<FormDataElement>::const_iterator it = elements.begin(); - for (; it != elements.end(); ++it) { - const FormDataElement& element = (*it); - if (element.m_type == FormDataElement::data) { - data->AppendBytes(element.m_data.data(), element.m_data.size()); - } else if (element.m_type == FormDataElement::encodedFile) { - data->AppendFile( - FilePath(webkit_glue::StringToFilePathString(element.m_filename))); - } else { - NOTREACHED(); - } - } - - data->set_identifier(formdata->identifier()); -} - -void WebRequestImpl::SetUploadData(const net::UploadData& data) -{ - RefPtr<FormData> formdata = FormData::create(); - - const std::vector<net::UploadData::Element>& elements = data.elements(); - std::vector<net::UploadData::Element>::const_iterator it = elements.begin(); - for (; it != elements.end(); ++it) { - const net::UploadData::Element& element = (*it); - if (element.type() == net::UploadData::TYPE_BYTES) { - formdata->appendData( - std::string(element.bytes().begin(), element.bytes().end()).c_str(), - element.bytes().size()); - } else if (element.type() == net::UploadData::TYPE_FILE) { - formdata->appendFile( - webkit_glue::FilePathStringToString(element.file_path().value())); - } else { - NOTREACHED(); - } - } - - formdata->setIdentifier(data.identifier()); - - request_.setHTTPBody(formdata); -} - -void WebRequestImpl::SetRequestorID(int requestor_id) { - request_.setRequestorID(requestor_id); -} - -// static -WebRequest* WebRequest::Create(const GURL& url) { - return new WebRequestImpl(url); -} diff --git a/webkit/glue/weburlrequest_impl.h b/webkit/glue/weburlrequest_impl.h deleted file mode 100644 index 5758504..0000000 --- a/webkit/glue/weburlrequest_impl.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2006-2008 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_WEBURLREQUEST_IMPL_H_ -#define WEBKIT_GLUE_WEBURLREQUEST_IMPL_H_ - -#include "webkit/glue/weburlrequest.h" - -#include "ResourceRequest.h" - -class WebRequestImpl : public WebRequest { - public: - WebRequestImpl(); - - explicit WebRequestImpl(const GURL& url); - explicit WebRequestImpl(const WebCore::ResourceRequest& request); - - // WebRequest - virtual WebRequest* Clone() const; - virtual void SetURL(const GURL& url); - virtual GURL GetURL() const; - virtual void SetFirstPartyForCookies(const GURL& url); - virtual GURL GetFirstPartyForCookies() const; - virtual WebRequestCachePolicy GetCachePolicy() const; - virtual void SetCachePolicy(WebRequestCachePolicy policy); - virtual std::string GetHttpMethod() const; - virtual void SetHttpMethod(const std::string& method); - virtual std::string GetHttpHeaderValue(const std::string& field) const; - virtual void SetHttpHeaderValue(const std::string& field, - const std::string& value); - virtual void GetHttpHeaders(HeaderMap* headers) const; - virtual void SetHttpHeaders(const HeaderMap& headers); - virtual std::string GetHttpReferrer() const; - virtual std::string GetSecurityInfo() const; - virtual void SetSecurityInfo(const std::string& value); - virtual bool HasUploadData() const; - virtual void GetUploadData(net::UploadData* data) const; - virtual void SetUploadData(const net::UploadData& data); - virtual void SetRequestorID(int requestor_id); - - // WebRequestImpl - const WebCore::ResourceRequest& resource_request() const { - return request_; - } - void set_resource_request(const WebCore::ResourceRequest& request) { - request_ = request; - } - - protected: - WebCore::ResourceRequest request_; -}; - -#endif // #ifndef WEBKIT_GLUE_WEBURLREQUEST_IMPL_H_ diff --git a/webkit/glue/webview_delegate.h b/webkit/glue/webview_delegate.h index 2736103..1002d03 100644 --- a/webkit/glue/webview_delegate.h +++ b/webkit/glue/webview_delegate.h @@ -28,8 +28,8 @@ #include <vector> +#include "webkit/api/public/WebNavigationType.h" #include "webkit/glue/context_menu.h" -#include "webkit/glue/webdatasource.h" #include "webkit/glue/webwidget_delegate.h" namespace webkit_glue { @@ -41,26 +41,27 @@ class AccessibilityObject; } namespace WebKit { +class WebDataSource; class WebDragData; class WebForm; class WebWorker; class WebWorkerClient; class WebMediaPlayer; class WebMediaPlayerClient; +class WebURLRequest; +class WebURLResponse; struct WebPoint; struct WebRect; +struct WebURLError; } struct WebPreferences; class FilePath; class SkBitmap; class WebDevToolsAgentDelegate; -class WebError; class WebFrame; class WebMediaPlayerDelegate; class WebPluginDelegate; -class WebRequest; -class WebResponse; class WebView; class WebWidget; @@ -224,8 +225,8 @@ class WebViewDelegate : virtual public WebWidgetDelegate { virtual WindowOpenDisposition DispositionForNavigationAction( WebView* webview, WebFrame* frame, - const WebRequest* request, - WebNavigationType type, + const WebKit::WebURLRequest& request, + WebKit::WebNavigationType type, WindowOpenDisposition disposition, bool is_redirect) { return disposition; @@ -235,7 +236,8 @@ class WebViewDelegate : virtual public WebWidgetDelegate { // A datasource has been created for a new navigation. The given datasource // will become the provisional datasource for the frame. - virtual void DidCreateDataSource(WebFrame* frame, WebDataSource* ds) { + virtual void DidCreateDataSource(WebFrame* frame, + WebKit::WebDataSource* ds) { } // Notifies the delegate that the provisional load of a specified frame in a @@ -273,18 +275,19 @@ class WebViewDelegate : virtual public WebWidgetDelegate { // committed data source if there is one. // This notification is only received for errors like network errors. virtual void DidFailProvisionalLoadWithError(WebView* webview, - const WebError& error, + const WebKit::WebURLError& error, WebFrame* frame) { } // If the provisional load fails, we try to load a an error page describing // the user about the load failure. |html| is the UTF8 text to display. If // |html| is empty, we will fall back on a local error page. - virtual void LoadNavigationErrorPage(WebFrame* frame, - const WebRequest* failed_request, - const WebError& error, - const std::string& html, - bool replace) { + virtual void LoadNavigationErrorPage( + WebFrame* frame, + const WebKit::WebURLRequest& failed_request, + const WebKit::WebURLError& error, + const std::string& html, + bool replace) { } // Notifies the delegate that the load has changed from provisional to @@ -339,7 +342,7 @@ class WebViewDelegate : virtual public WebWidgetDelegate { // @discussion This method is called after a data source has committed but failed to completely load. // - (void)webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame; virtual void DidFailLoadWithError(WebView* webview, - const WebError& error, + const WebKit::WebURLError& error, WebFrame* forFrame) { } @@ -358,10 +361,11 @@ class WebViewDelegate : virtual public WebWidgetDelegate { // This method is called when we load a resource from an in-memory cache. // A return value of |false| indicates the load should proceed, but WebCore // appears to largely ignore the return value. - virtual bool DidLoadResourceFromMemoryCache(WebView* webview, - const WebRequest& request, - const WebResponse& response, - WebFrame* frame) { + virtual bool DidLoadResourceFromMemoryCache( + WebView* webview, + const WebKit::WebURLRequest& request, + const WebKit::WebURLResponse& response, + WebFrame* frame) { return false; } @@ -444,9 +448,10 @@ class WebViewDelegate : virtual public WebWidgetDelegate { // Associates the given identifier with the initial resource request. // Resource load callbacks will use the identifier throughout the life of the // request. - virtual void AssignIdentifierToRequest(WebView* webview, - uint32 identifier, - const WebRequest& request) { + virtual void AssignIdentifierToRequest( + WebView* webview, + uint32 identifier, + const WebKit::WebURLRequest& request) { } // Notifies the delegate that a request is about to be sent out, giving the @@ -455,7 +460,7 @@ class WebViewDelegate : virtual public WebWidgetDelegate { // to be made. virtual void WillSendRequest(WebView* webview, uint32 identifier, - WebRequest* request) { + WebKit::WebURLRequest* request) { } // Notifies the delegate that a subresource load has succeeded. @@ -465,7 +470,7 @@ class WebViewDelegate : virtual public WebWidgetDelegate { // Notifies the delegate that a subresource load has failed, and why. virtual void DidFailLoadingWithError(WebView* webview, uint32 identifier, - const WebError& error) { + const WebKit::WebURLError& error) { } // ChromeClient ------------------------------------------------------------ diff --git a/webkit/glue/webworker_impl.cc b/webkit/glue/webworker_impl.cc index 4b3ba67..6cd3bd0 100644 --- a/webkit/glue/webworker_impl.cc +++ b/webkit/glue/webworker_impl.cc @@ -78,7 +78,7 @@ class WorkerWebViewDelegate : public WebViewDelegate { const std::vector<WebMenuItem> &items) { } // 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, WebDataSource* ds) { + virtual void DidCreateDataSource(WebFrame* frame, WebKit::WebDataSource* ds) { static_cast<WebDataSourceImpl*>(ds)->setDeferMainResourceDataLoad(false); } // Lazy allocate and leak this instance. |