| 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 void ChromeNetworkDelegate::OnRawBytesRead(const net::URLRequest& request, | 226 void ChromeNetworkDelegate::OnRawBytesRead(const net::URLRequest& request, |
| 227 int bytes_read) { | 227 int bytes_read) { |
| 228 #if defined(ENABLE_TASK_MANAGER) | 228 #if defined(ENABLE_TASK_MANAGER) |
| 229 TaskManager::GetInstance()->model()->NotifyBytesRead(request, bytes_read); | 229 TaskManager::GetInstance()->model()->NotifyBytesRead(request, bytes_read); |
| 230 #endif // defined(ENABLE_TASK_MANAGER) | 230 #endif // defined(ENABLE_TASK_MANAGER) |
| 231 } | 231 } |
| 232 | 232 |
| 233 void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request, | 233 void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request, |
| 234 bool started) { | 234 bool started) { |
| 235 if (request->status().status() == net::URLRequestStatus::SUCCESS || | 235 if (request->status().status() == net::URLRequestStatus::SUCCESS || |
| 236 request->status().status() == net::URLRequestStatus::HANDLED_EXTERNALLY) { | 236 request->status().error() == net::OK_HANDLED_EXTERNALLY) { |
| 237 bool is_redirect = request->response_headers() && | 237 bool is_redirect = request->response_headers() && |
| 238 net::HttpResponseHeaders::IsRedirectResponseCode( | 238 net::HttpResponseHeaders::IsRedirectResponseCode( |
| 239 request->response_headers()->response_code()); | 239 request->response_headers()->response_code()); |
| 240 if (!is_redirect) { | 240 if (!is_redirect) { |
| 241 ExtensionWebRequestEventRouter::GetInstance()->OnCompleted( | 241 ExtensionWebRequestEventRouter::GetInstance()->OnCompleted( |
| 242 profile_, extension_info_map_.get(), request); | 242 profile_, extension_info_map_.get(), request); |
| 243 } | 243 } |
| 244 } else if (request->status().status() == net::URLRequestStatus::FAILED || | 244 } else if (request->status().status() == net::URLRequestStatus::FAILED || |
| 245 request->status().status() == net::URLRequestStatus::CANCELED) { | 245 request->status().status() == net::URLRequestStatus::CANCELED) { |
| 246 ExtensionWebRequestEventRouter::GetInstance()->OnErrorOccurred( | 246 ExtensionWebRequestEventRouter::GetInstance()->OnErrorOccurred( |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 // URL access blocked by policy. | 381 // URL access blocked by policy. |
| 382 socket->net_log()->AddEvent( | 382 socket->net_log()->AddEvent( |
| 383 net::NetLog::TYPE_CHROME_POLICY_ABORTED_REQUEST, | 383 net::NetLog::TYPE_CHROME_POLICY_ABORTED_REQUEST, |
| 384 net::NetLog::StringCallback("url", | 384 net::NetLog::StringCallback("url", |
| 385 &socket->url().possibly_invalid_spec())); | 385 &socket->url().possibly_invalid_spec())); |
| 386 return net::ERR_NETWORK_ACCESS_DENIED; | 386 return net::ERR_NETWORK_ACCESS_DENIED; |
| 387 } | 387 } |
| 388 #endif | 388 #endif |
| 389 return net::OK; | 389 return net::OK; |
| 390 } | 390 } |
| OLD | NEW |