| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/net/chrome_network_delegate.h" | 5 #include "chrome/browser/net/chrome_network_delegate.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/content_settings/cookie_settings.h" | 9 #include "chrome/browser/content_settings/cookie_settings.h" |
| 10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 226 |
| 227 void ChromeNetworkDelegate::OnRawBytesRead(const net::URLRequest& request, | 227 void ChromeNetworkDelegate::OnRawBytesRead(const net::URLRequest& request, |
| 228 int bytes_read) { | 228 int bytes_read) { |
| 229 #if defined(ENABLE_TASK_MANAGER) | 229 #if defined(ENABLE_TASK_MANAGER) |
| 230 TaskManager::GetInstance()->model()->NotifyBytesRead(request, bytes_read); | 230 TaskManager::GetInstance()->model()->NotifyBytesRead(request, bytes_read); |
| 231 #endif // defined(ENABLE_TASK_MANAGER) | 231 #endif // defined(ENABLE_TASK_MANAGER) |
| 232 } | 232 } |
| 233 | 233 |
| 234 void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request, | 234 void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request, |
| 235 bool started) { | 235 bool started) { |
| 236 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
| 236 if (request->status().status() == net::URLRequestStatus::SUCCESS || | 237 if (request->status().status() == net::URLRequestStatus::SUCCESS || |
| 237 request->status().status() == net::URLRequestStatus::HANDLED_EXTERNALLY) { | 238 (info && info->HandledExternally())) { |
| 238 bool is_redirect = request->response_headers() && | 239 bool is_redirect = request->response_headers() && |
| 239 net::HttpResponseHeaders::IsRedirectResponseCode( | 240 net::HttpResponseHeaders::IsRedirectResponseCode( |
| 240 request->response_headers()->response_code()); | 241 request->response_headers()->response_code()); |
| 241 if (!is_redirect) { | 242 if (!is_redirect) { |
| 242 ExtensionWebRequestEventRouter::GetInstance()->OnCompleted( | 243 ExtensionWebRequestEventRouter::GetInstance()->OnCompleted( |
| 243 profile_, extension_info_map_.get(), request); | 244 profile_, extension_info_map_.get(), request); |
| 244 } | 245 } |
| 245 } else if (request->status().status() == net::URLRequestStatus::FAILED || | 246 } else if (request->status().status() == net::URLRequestStatus::FAILED || |
| 246 request->status().status() == net::URLRequestStatus::CANCELED) { | 247 request->status().status() == net::URLRequestStatus::CANCELED) { |
| 247 ExtensionWebRequestEventRouter::GetInstance()->OnErrorOccurred( | 248 ExtensionWebRequestEventRouter::GetInstance()->OnErrorOccurred( |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 // URL access blocked by policy. | 383 // URL access blocked by policy. |
| 383 socket->net_log()->AddEvent( | 384 socket->net_log()->AddEvent( |
| 384 net::NetLog::TYPE_CHROME_POLICY_ABORTED_REQUEST, | 385 net::NetLog::TYPE_CHROME_POLICY_ABORTED_REQUEST, |
| 385 net::NetLog::StringCallback("url", | 386 net::NetLog::StringCallback("url", |
| 386 &socket->url().possibly_invalid_spec())); | 387 &socket->url().possibly_invalid_spec())); |
| 387 return net::ERR_NETWORK_ACCESS_DENIED; | 388 return net::ERR_NETWORK_ACCESS_DENIED; |
| 388 } | 389 } |
| 389 #endif | 390 #endif |
| 390 return net::OK; | 391 return net::OK; |
| 391 } | 392 } |
| OLD | NEW |