| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/custom_handlers/protocol_handler_registry.h" |
| 8 #include "chrome/browser/extensions/extension_event_router_forwarder.h" | 9 #include "chrome/browser/extensions/extension_event_router_forwarder.h" |
| 9 #include "chrome/browser/extensions/extension_proxy_api.h" | 10 #include "chrome/browser/extensions/extension_proxy_api.h" |
| 10 #include "chrome/browser/extensions/extension_webrequest_api.h" | 11 #include "chrome/browser/extensions/extension_webrequest_api.h" |
| 11 #include "chrome/browser/prefs/pref_member.h" | 12 #include "chrome/browser/prefs/pref_member.h" |
| 13 #include "chrome/browser/task_manager/task_manager.h" |
| 12 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
| 13 #include "content/browser/browser_thread.h" | 15 #include "content/browser/browser_thread.h" |
| 14 #include "net/base/host_port_pair.h" | 16 #include "net/base/host_port_pair.h" |
| 15 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
| 16 #include "net/http/http_request_headers.h" | 18 #include "net/http/http_request_headers.h" |
| 17 #include "net/http/http_response_headers.h" | 19 #include "net/http/http_response_headers.h" |
| 18 #include "net/url_request/url_request.h" | 20 #include "net/url_request/url_request.h" |
| 19 | 21 |
| 20 namespace { | 22 namespace { |
| 21 | 23 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 profile_id_, event_router_.get(), request, new_location); | 93 profile_id_, event_router_.get(), request, new_location); |
| 92 } | 94 } |
| 93 | 95 |
| 94 | 96 |
| 95 void ChromeNetworkDelegate::OnResponseStarted(net::URLRequest* request) { | 97 void ChromeNetworkDelegate::OnResponseStarted(net::URLRequest* request) { |
| 96 ExtensionWebRequestEventRouter::GetInstance()->OnResponseStarted( | 98 ExtensionWebRequestEventRouter::GetInstance()->OnResponseStarted( |
| 97 profile_id_, event_router_.get(), request); | 99 profile_id_, event_router_.get(), request); |
| 98 ForwardProxyErrors(request, event_router_.get(), profile_id_); | 100 ForwardProxyErrors(request, event_router_.get(), profile_id_); |
| 99 } | 101 } |
| 100 | 102 |
| 103 void ChromeNetworkDelegate::OnRawBytesRead(const net::URLRequest& request, |
| 104 int bytes_read) { |
| 105 TaskManager::GetInstance()->model()->NotifyBytesRead(request, bytes_read); |
| 106 } |
| 107 |
| 101 void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request) { | 108 void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request) { |
| 102 if (request->status().status() == net::URLRequestStatus::SUCCESS) { | 109 if (request->status().status() == net::URLRequestStatus::SUCCESS) { |
| 103 bool is_redirect = request->response_headers() && | 110 bool is_redirect = request->response_headers() && |
| 104 net::HttpResponseHeaders::IsRedirectResponseCode( | 111 net::HttpResponseHeaders::IsRedirectResponseCode( |
| 105 request->response_headers()->response_code()); | 112 request->response_headers()->response_code()); |
| 106 if (!is_redirect) { | 113 if (!is_redirect) { |
| 107 ExtensionWebRequestEventRouter::GetInstance()->OnCompleted( | 114 ExtensionWebRequestEventRouter::GetInstance()->OnCompleted( |
| 108 profile_id_, event_router_.get(), request); | 115 profile_id_, event_router_.get(), request); |
| 109 } | 116 } |
| 110 } else if (request->status().status() == net::URLRequestStatus::FAILED) { | 117 } else if (request->status().status() == net::URLRequestStatus::FAILED) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 122 void ChromeNetworkDelegate::OnHttpTransactionDestroyed(uint64 request_id) { | 129 void ChromeNetworkDelegate::OnHttpTransactionDestroyed(uint64 request_id) { |
| 123 ExtensionWebRequestEventRouter::GetInstance()->OnHttpTransactionDestroyed( | 130 ExtensionWebRequestEventRouter::GetInstance()->OnHttpTransactionDestroyed( |
| 124 profile_id_, request_id); | 131 profile_id_, request_id); |
| 125 } | 132 } |
| 126 | 133 |
| 127 void ChromeNetworkDelegate::OnPACScriptError(int line_number, | 134 void ChromeNetworkDelegate::OnPACScriptError(int line_number, |
| 128 const string16& error) { | 135 const string16& error) { |
| 129 ExtensionProxyEventRouter::GetInstance()->OnPACScriptError( | 136 ExtensionProxyEventRouter::GetInstance()->OnPACScriptError( |
| 130 event_router_.get(), profile_id_, line_number, error); | 137 event_router_.get(), profile_id_, line_number, error); |
| 131 } | 138 } |
| OLD | NEW |