| OLD | NEW |
| 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 "chrome/browser/devtools/devtools_network_transaction.h" | 5 #include "chrome/browser/devtools/devtools_network_transaction.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "chrome/browser/devtools/devtools_network_controller.h" | 10 #include "chrome/browser/devtools/devtools_network_controller.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 bool DevToolsNetworkTransaction::CheckFailed() { | 98 bool DevToolsNetworkTransaction::CheckFailed() { |
| 99 if (failed_) | 99 if (failed_) |
| 100 return true; | 100 return true; |
| 101 if (interceptor_ && interceptor_->IsOffline()) { | 101 if (interceptor_ && interceptor_->IsOffline()) { |
| 102 Fail(); | 102 Fail(); |
| 103 return true; | 103 return true; |
| 104 } | 104 } |
| 105 return false; | 105 return false; |
| 106 } | 106 } |
| 107 | 107 |
| 108 int DevToolsNetworkTransaction::Start( | 108 int DevToolsNetworkTransaction::Start(const net::HttpRequestInfo* request, |
| 109 const net::HttpRequestInfo* request, | 109 const net::CompletionCallback& callback, |
| 110 const net::CompletionCallback& callback, | 110 const net::NetLogWithSource& net_log) { |
| 111 const net::BoundNetLog& net_log) { | |
| 112 DCHECK(request); | 111 DCHECK(request); |
| 113 request_ = request; | 112 request_ = request; |
| 114 | 113 |
| 115 std::string client_id; | 114 std::string client_id; |
| 116 bool has_devtools_client_id = request_->extra_headers.HasHeader( | 115 bool has_devtools_client_id = request_->extra_headers.HasHeader( |
| 117 kDevToolsEmulateNetworkConditionsClientId); | 116 kDevToolsEmulateNetworkConditionsClientId); |
| 118 if (has_devtools_client_id) { | 117 if (has_devtools_client_id) { |
| 119 custom_request_.reset(new net::HttpRequestInfo(*request_)); | 118 custom_request_.reset(new net::HttpRequestInfo(*request_)); |
| 120 custom_request_->extra_headers.GetHeader( | 119 custom_request_->extra_headers.GetHeader( |
| 121 kDevToolsEmulateNetworkConditionsClientId, &client_id); | 120 kDevToolsEmulateNetworkConditionsClientId, &client_id); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 if (CheckFailed()) | 291 if (CheckFailed()) |
| 293 return net::ERR_INTERNET_DISCONNECTED; | 292 return net::ERR_INTERNET_DISCONNECTED; |
| 294 return network_transaction_->ResumeNetworkStart(); | 293 return network_transaction_->ResumeNetworkStart(); |
| 295 } | 294 } |
| 296 | 295 |
| 297 void | 296 void |
| 298 DevToolsNetworkTransaction::GetConnectionAttempts(net::ConnectionAttempts* out) | 297 DevToolsNetworkTransaction::GetConnectionAttempts(net::ConnectionAttempts* out) |
| 299 const { | 298 const { |
| 300 network_transaction_->GetConnectionAttempts(out); | 299 network_transaction_->GetConnectionAttempts(out); |
| 301 } | 300 } |
| OLD | NEW |