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

Side by Side Diff: extensions/shell/browser/shell_network_delegate.cc

Issue 2315673002: Revert of Adjust callers and networking delegates in extensions/ to modified APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@URLRequestRead
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « extensions/shell/browser/shell_network_delegate.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "extensions/shell/browser/shell_network_delegate.h" 5 #include "extensions/shell/browser/shell_network_delegate.h"
6 6
7 #include "content/public/browser/render_frame_host.h" 7 #include "content/public/browser/render_frame_host.h"
8 #include "content/public/browser/resource_request_info.h" 8 #include "content/public/browser/resource_request_info.h"
9 #include "extensions/browser/api/web_request/web_request_api.h" 9 #include "extensions/browser/api/web_request/web_request_api.h"
10 #include "extensions/browser/extension_system.h" 10 #include "extensions/browser/extension_system.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 allowed_unsafe_redirect_url); 69 allowed_unsafe_redirect_url);
70 } 70 }
71 71
72 void ShellNetworkDelegate::OnBeforeRedirect( 72 void ShellNetworkDelegate::OnBeforeRedirect(
73 net::URLRequest* request, 73 net::URLRequest* request,
74 const GURL& new_location) { 74 const GURL& new_location) {
75 ExtensionWebRequestEventRouter::GetInstance()->OnBeforeRedirect( 75 ExtensionWebRequestEventRouter::GetInstance()->OnBeforeRedirect(
76 browser_context_, extension_info_map_.get(), request, new_location); 76 browser_context_, extension_info_map_.get(), request, new_location);
77 } 77 }
78 78
79 void ShellNetworkDelegate::OnResponseStarted(net::URLRequest* request, 79
80 int net_error) { 80 void ShellNetworkDelegate::OnResponseStarted(
81 net::URLRequest* request) {
81 ExtensionWebRequestEventRouter::GetInstance()->OnResponseStarted( 82 ExtensionWebRequestEventRouter::GetInstance()->OnResponseStarted(
82 browser_context_, extension_info_map_.get(), request, net_error); 83 browser_context_, extension_info_map_.get(), request);
83 } 84 }
84 85
85 void ShellNetworkDelegate::OnCompleted(net::URLRequest* request, 86 void ShellNetworkDelegate::OnCompleted(
86 bool started, 87 net::URLRequest* request,
87 int net_error) { 88 bool started) {
88 DCHECK_NE(net::ERR_IO_PENDING, net_error); 89 if (request->status().status() == net::URLRequestStatus::SUCCESS) {
89
90 if (net_error == net::OK) {
91 bool is_redirect = request->response_headers() && 90 bool is_redirect = request->response_headers() &&
92 net::HttpResponseHeaders::IsRedirectResponseCode( 91 net::HttpResponseHeaders::IsRedirectResponseCode(
93 request->response_headers()->response_code()); 92 request->response_headers()->response_code());
94 if (!is_redirect) { 93 if (!is_redirect) {
95 ExtensionWebRequestEventRouter::GetInstance()->OnCompleted( 94 ExtensionWebRequestEventRouter::GetInstance()->OnCompleted(
96 browser_context_, extension_info_map_.get(), request, net_error); 95 browser_context_, extension_info_map_.get(), request);
97 } 96 }
98 } else { 97 return;
98 }
99
100 if (request->status().status() == net::URLRequestStatus::FAILED ||
101 request->status().status() == net::URLRequestStatus::CANCELED) {
99 ExtensionWebRequestEventRouter::GetInstance()->OnErrorOccurred( 102 ExtensionWebRequestEventRouter::GetInstance()->OnErrorOccurred(
100 browser_context_, extension_info_map_.get(), request, started, 103 browser_context_, extension_info_map_.get(), request, started);
101 net_error); 104 return;
102 } 105 }
106
107 NOTREACHED();
103 } 108 }
104 109
105 void ShellNetworkDelegate::OnURLRequestDestroyed( 110 void ShellNetworkDelegate::OnURLRequestDestroyed(
106 net::URLRequest* request) { 111 net::URLRequest* request) {
107 ExtensionWebRequestEventRouter::GetInstance()->OnURLRequestDestroyed( 112 ExtensionWebRequestEventRouter::GetInstance()->OnURLRequestDestroyed(
108 browser_context_, request); 113 browser_context_, request);
109 } 114 }
110 115
111 void ShellNetworkDelegate::OnPACScriptError( 116 void ShellNetworkDelegate::OnPACScriptError(
112 int line_number, 117 int line_number,
113 const base::string16& error) { 118 const base::string16& error) {
114 } 119 }
115 120
116 net::NetworkDelegate::AuthRequiredResponse 121 net::NetworkDelegate::AuthRequiredResponse
117 ShellNetworkDelegate::OnAuthRequired( 122 ShellNetworkDelegate::OnAuthRequired(
118 net::URLRequest* request, 123 net::URLRequest* request,
119 const net::AuthChallengeInfo& auth_info, 124 const net::AuthChallengeInfo& auth_info,
120 const AuthCallback& callback, 125 const AuthCallback& callback,
121 net::AuthCredentials* credentials) { 126 net::AuthCredentials* credentials) {
122 return ExtensionWebRequestEventRouter::GetInstance()->OnAuthRequired( 127 return ExtensionWebRequestEventRouter::GetInstance()->OnAuthRequired(
123 browser_context_, extension_info_map_.get(), request, auth_info, callback, 128 browser_context_, extension_info_map_.get(), request, auth_info, callback,
124 credentials); 129 credentials);
125 } 130 }
126 131
127 } // namespace extensions 132 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/shell/browser/shell_network_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698