summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorjaphet@chromium.org <japhet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-25 23:13:25 +0000
committerjaphet@chromium.org <japhet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-25 23:13:25 +0000
commit5f6776fa422c4b8c6b006e99341e644bccf413a6 (patch)
tree33320d5991f38f722544bd1d40620b7df20dba07 /webkit
parent0402ae10e57d173a354b4a52b0b8027c975655ae (diff)
downloadchromium_src-5f6776fa422c4b8c6b006e99341e644bccf413a6.zip
chromium_src-5f6776fa422c4b8c6b006e99341e644bccf413a6.tar.gz
chromium_src-5f6776fa422c4b8c6b006e99341e644bccf413a6.tar.bz2
Update Platform calls to create a cancellation error.
These are unused at the moment, they will become active with https://codereview.chromium.org/14264012 BUG=none TEST=none Review URL: https://chromiumcodereview.appspot.com/14297018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196530 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/webkitplatformsupport_impl.cc6
-rw-r--r--webkit/glue/webkitplatformsupport_impl.h3
-rw-r--r--webkit/glue/weburlloader_impl.cc27
-rw-r--r--webkit/glue/weburlloader_impl.h3
4 files changed, 25 insertions, 14 deletions
diff --git a/webkit/glue/webkitplatformsupport_impl.cc b/webkit/glue/webkitplatformsupport_impl.cc
index 24208b7..ab795a7 100644
--- a/webkit/glue/webkitplatformsupport_impl.cc
+++ b/webkit/glue/webkitplatformsupport_impl.cc
@@ -69,6 +69,7 @@ using WebKit::WebString;
using WebKit::WebSocketStreamHandle;
using WebKit::WebThemeEngine;
using WebKit::WebURL;
+using WebKit::WebURLError;
using WebKit::WebURLLoader;
using WebKit::WebVector;
@@ -399,8 +400,9 @@ WebString WebKitPlatformSupportImpl::userAgent(const WebURL& url) {
return WebString::fromUTF8(webkit_glue::GetUserAgent(url));
}
-int WebKitPlatformSupportImpl::cancelledErrorCode() const {
- return net::ERR_ABORTED;
+WebURLError WebKitPlatformSupportImpl::cancelledError(
+ const WebURL& unreachableURL) const {
+ return WebURLLoaderImpl::CreateError(unreachableURL, net::ERR_ABORTED);
}
void WebKitPlatformSupportImpl::getPluginList(bool refresh,
diff --git a/webkit/glue/webkitplatformsupport_impl.h b/webkit/glue/webkitplatformsupport_impl.h
index 1c3a097..c2c9778 100644
--- a/webkit/glue/webkitplatformsupport_impl.h
+++ b/webkit/glue/webkitplatformsupport_impl.h
@@ -11,6 +11,7 @@
#include "base/threading/thread_local_storage.h"
#include "base/timer.h"
#include "third_party/WebKit/Source/Platform/chromium/public/Platform.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebURLError.h"
#include "ui/base/layout.h"
#include "webkit/glue/resource_loader_bridge.h"
#include "webkit/glue/webkit_glue_export.h"
@@ -83,7 +84,7 @@ class WEBKIT_GLUE_EXPORT WebKitPlatformSupportImpl :
virtual WebKit::WebURLLoader* createURLLoader();
virtual WebKit::WebSocketStreamHandle* createSocketStreamHandle();
virtual WebKit::WebString userAgent(const WebKit::WebURL& url);
- virtual int cancelledErrorCode() const;
+ virtual WebKit::WebURLError cancelledError(const WebKit::WebURL& url) const;
virtual void getPluginList(bool refresh, WebKit::WebPluginListBuilder*);
virtual void decrementStatsCounter(const char* name);
virtual void incrementStatsCounter(const char* name);
diff --git a/webkit/glue/weburlloader_impl.cc b/webkit/glue/weburlloader_impl.cc
index 87483d1..64ebc46 100644
--- a/webkit/glue/weburlloader_impl.cc
+++ b/webkit/glue/weburlloader_impl.cc
@@ -735,17 +735,7 @@ void WebURLLoaderImpl::Context::OnCompletedRequest(
if (client_) {
if (error_code != net::OK) {
- WebURLError error;
- if (error_code == net::ERR_ABORTED) {
- error.isCancellation = true;
- } else if (error_code == net::ERR_TEMPORARILY_THROTTLED) {
- error.localizedDescription = WebString::fromUTF8(
- kThrottledErrorDescription);
- }
- error.domain = WebString::fromUTF8(net::kErrorDomain);
- error.reason = error_code;
- error.unreachableURL = request_.url();
- client_->didFail(loader_, error);
+ client_->didFail(loader_, CreateError(request_.url(), error_code));
} else {
client_->didFinishLoading(
loader_, (completion_time - TimeTicks()).InSecondsF());
@@ -814,6 +804,21 @@ WebURLLoaderImpl::~WebURLLoaderImpl() {
cancel();
}
+WebURLError WebURLLoaderImpl::CreateError(const WebURL& unreachable_url,
+ int reason) {
+ WebURLError error;
+ error.domain = WebString::fromUTF8(net::kErrorDomain);
+ error.reason = reason;
+ error.unreachableURL = unreachable_url;
+ if (reason == net::ERR_ABORTED) {
+ error.isCancellation = true;
+ } else if (reason == net::ERR_TEMPORARILY_THROTTLED) {
+ error.localizedDescription = WebString::fromUTF8(
+ kThrottledErrorDescription);
+ }
+ return error;
+}
+
void WebURLLoaderImpl::loadSynchronously(const WebURLRequest& request,
WebURLResponse& response,
WebURLError& error,
diff --git a/webkit/glue/weburlloader_impl.h b/webkit/glue/weburlloader_impl.h
index f32cc29..27c28d6 100644
--- a/webkit/glue/weburlloader_impl.h
+++ b/webkit/glue/weburlloader_impl.h
@@ -18,6 +18,9 @@ class WebURLLoaderImpl : public WebKit::WebURLLoader {
explicit WebURLLoaderImpl(WebKitPlatformSupportImpl* platform);
virtual ~WebURLLoaderImpl();
+ static WebKit::WebURLError CreateError(const WebKit::WebURL& unreachable_url,
+ int reason);
+
// WebURLLoader methods:
virtual void loadSynchronously(
const WebKit::WebURLRequest& request,