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

Unified Diff: chrome/browser/net/chrome_network_delegate.cc

Issue 6541021: Send fatal proxy errors to the network delegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 9 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 | « chrome/browser/net/chrome_network_delegate.h ('k') | net/http/http_network_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/chrome_network_delegate.cc
diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc
index 0c9272148c20c888c9b767246b50207a0db3a2e5..ce79045d8e39d92415395c84b89860f79d10e965 100644
--- a/chrome/browser/net/chrome_network_delegate.cc
+++ b/chrome/browser/net/chrome_network_delegate.cc
@@ -1,12 +1,14 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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 "chrome/browser/net/chrome_network_delegate.h"
#include "base/logging.h"
+#include "chrome/browser/extensions/extension_proxy_api.h"
#include "chrome/browser/extensions/extension_webrequest_api.h"
#include "chrome/browser/net/chrome_url_request_context.h"
+#include "net/base/net_errors.h"
#include "net/http/http_request_headers.h"
#include "net/url_request/url_request.h"
@@ -21,6 +23,21 @@ const ExtensionIOEventRouter* GetIOEventRouter(
extension_io_event_router();
}
+// If the |request| failed due to problems with a proxy, forward the error to
+// the proxy extension API.
+void ForwardProxyErrors(net::URLRequest* request) {
+ if (request->status().status() == net::URLRequestStatus::FAILED) {
+ switch (request->status().os_error()) {
+ case net::ERR_PROXY_AUTH_UNSUPPORTED:
+ case net::ERR_PROXY_CONNECTION_FAILED:
+ case net::ERR_TUNNEL_CONNECTION_FAILED:
+ ExtensionProxyEventRouter::GetInstance()->OnProxyError(
+ GetIOEventRouter(request->context()),
+ request->status().os_error());
+ }
+ }
+}
+
} // namespace
ChromeNetworkDelegate::ChromeNetworkDelegate() {}
@@ -37,3 +54,12 @@ void ChromeNetworkDelegate::OnSendHttpRequest(
// TODO(willchan): Add Chrome-side hooks to listen / mutate requests here.
}
+
+void ChromeNetworkDelegate::OnResponseStarted(net::URLRequest* request) {
+ ForwardProxyErrors(request);
+}
+
+void ChromeNetworkDelegate::OnReadCompleted(net::URLRequest* request,
+ int bytes_read) {
+ ForwardProxyErrors(request);
+}
« no previous file with comments | « chrome/browser/net/chrome_network_delegate.h ('k') | net/http/http_network_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698