Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Unified Diff: sky/viewer/platform/weburlloader_impl.cc

Issue 935633003: Don't depend on /net for error codes in sky viewer. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/viewer/platform/platform_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/viewer/platform/weburlloader_impl.cc
diff --git a/sky/viewer/platform/weburlloader_impl.cc b/sky/viewer/platform/weburlloader_impl.cc
index 7dd9b0c456e08e440da45424acf38129f65cdc29..a6ce63d1cfd6c8821f356f267e97a16f6a955640 100644
--- a/sky/viewer/platform/weburlloader_impl.cc
+++ b/sky/viewer/platform/weburlloader_impl.cc
@@ -10,7 +10,6 @@
#include "base/thread_task_runner_handle.h"
#include "mojo/common/common_type_converters.h"
#include "mojo/services/network/public/interfaces/network_service.mojom.h"
-#include "net/base/net_errors.h"
#include "sky/engine/public/platform/WebURLError.h"
#include "sky/engine/public/platform/WebURLLoadTiming.h"
#include "sky/engine/public/platform/WebURLLoaderClient.h"
@@ -20,6 +19,13 @@
namespace sky {
namespace {
+// This corresponds to ERR_ABORTED in net/base/net_error_list.h.
+// TODO(ppi): declare an enum in the network service mojom so that the clients
+// don't need to hard-code these values.
+const int32_t kNetErrorAborted = -3;
+
+const char kErrorDomain[] = "net";
abarth-chromium 2015/02/17 17:58:50 Can we declare these values in a header that's sha
ppi 2015/02/17 18:08:02 Done.
+
static blink::WebURLResponse::HTTPVersion StatusLineToHTTPVersion(
const mojo::String& status_line) {
if (status_line.is_null())
@@ -97,7 +103,7 @@ void WebURLLoaderImpl::cancel() {
mojo::URLResponsePtr failed_response(mojo::URLResponse::New());
failed_response->url = mojo::String::From(url_);
failed_response->error = mojo::NetworkError::New();
- failed_response->error->code = net::ERR_ABORTED;
+ failed_response->error->code = kNetErrorAborted;
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
@@ -129,12 +135,12 @@ void WebURLLoaderImpl::OnReceivedResponse(mojo::URLResponsePtr url_response) {
void WebURLLoaderImpl::OnReceivedError(mojo::URLResponsePtr url_response) {
blink::WebURLError web_error;
- web_error.domain = blink::WebString::fromUTF8(net::kErrorDomain);
+ web_error.domain = blink::WebString::fromUTF8(kErrorDomain);
web_error.reason = url_response->error->code;
web_error.unreachableURL = GURL(url_response->url);
web_error.staleCopyInCache = false;
web_error.isCancellation =
- url_response->error->code == net::ERR_ABORTED ? true : false;
+ url_response->error->code == kNetErrorAborted ? true : false;
client_->didFail(this, web_error);
}
« no previous file with comments | « sky/viewer/platform/platform_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698