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

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

Issue 2264973002: 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
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 79 void ShellNetworkDelegate::OnResponseStarted(net::URLRequest* request,
80 void ShellNetworkDelegate::OnResponseStarted( 80 int net_error) {
81 net::URLRequest* request) {
82 ExtensionWebRequestEventRouter::GetInstance()->OnResponseStarted( 81 ExtensionWebRequestEventRouter::GetInstance()->OnResponseStarted(
83 browser_context_, extension_info_map_.get(), request); 82 browser_context_, extension_info_map_.get(), request, net_error);
84 } 83 }
85 84
86 void ShellNetworkDelegate::OnCompleted( 85 void ShellNetworkDelegate::OnCompleted(net::URLRequest* request,
87 net::URLRequest* request, 86 bool started,
88 bool started) { 87 int net_error) {
89 if (request->status().status() == net::URLRequestStatus::SUCCESS) { 88 DCHECK_NE(net::ERR_IO_PENDING, net_error);
89
90 if (net_error == net::OK) {
90 bool is_redirect = request->response_headers() && 91 bool is_redirect = request->response_headers() &&
91 net::HttpResponseHeaders::IsRedirectResponseCode( 92 net::HttpResponseHeaders::IsRedirectResponseCode(
92 request->response_headers()->response_code()); 93 request->response_headers()->response_code());
93 if (!is_redirect) { 94 if (!is_redirect) {
94 ExtensionWebRequestEventRouter::GetInstance()->OnCompleted( 95 ExtensionWebRequestEventRouter::GetInstance()->OnCompleted(
95 browser_context_, extension_info_map_.get(), request); 96 browser_context_, extension_info_map_.get(), request, net_error);
96 } 97 }
97 return; 98 } else {
99 ExtensionWebRequestEventRouter::GetInstance()->OnErrorOccurred(
100 browser_context_, extension_info_map_.get(), request, started,
101 net_error);
98 } 102 }
99
100 if (request->status().status() == net::URLRequestStatus::FAILED ||
101 request->status().status() == net::URLRequestStatus::CANCELED) {
102 ExtensionWebRequestEventRouter::GetInstance()->OnErrorOccurred(
103 browser_context_, extension_info_map_.get(), request, started);
104 return;
105 }
106
107 NOTREACHED();
108 } 103 }
109 104
110 void ShellNetworkDelegate::OnURLRequestDestroyed( 105 void ShellNetworkDelegate::OnURLRequestDestroyed(
111 net::URLRequest* request) { 106 net::URLRequest* request) {
112 ExtensionWebRequestEventRouter::GetInstance()->OnURLRequestDestroyed( 107 ExtensionWebRequestEventRouter::GetInstance()->OnURLRequestDestroyed(
113 browser_context_, request); 108 browser_context_, request);
114 } 109 }
115 110
116 void ShellNetworkDelegate::OnPACScriptError( 111 void ShellNetworkDelegate::OnPACScriptError(
117 int line_number, 112 int line_number,
118 const base::string16& error) { 113 const base::string16& error) {
119 } 114 }
120 115
121 net::NetworkDelegate::AuthRequiredResponse 116 net::NetworkDelegate::AuthRequiredResponse
122 ShellNetworkDelegate::OnAuthRequired( 117 ShellNetworkDelegate::OnAuthRequired(
123 net::URLRequest* request, 118 net::URLRequest* request,
124 const net::AuthChallengeInfo& auth_info, 119 const net::AuthChallengeInfo& auth_info,
125 const AuthCallback& callback, 120 const AuthCallback& callback,
126 net::AuthCredentials* credentials) { 121 net::AuthCredentials* credentials) {
127 return ExtensionWebRequestEventRouter::GetInstance()->OnAuthRequired( 122 return ExtensionWebRequestEventRouter::GetInstance()->OnAuthRequired(
128 browser_context_, extension_info_map_.get(), request, auth_info, callback, 123 browser_context_, extension_info_map_.get(), request, auth_info, callback,
129 credentials); 124 credentials);
130 } 125 }
131 126
132 } // namespace extensions 127 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698