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 "net/url_request/url_request_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 if (transaction_.get()) { | 313 if (transaction_.get()) { |
314 rv = transaction_->RestartWithAuth(auth_credentials_, start_callback_); | 314 rv = transaction_->RestartWithAuth(auth_credentials_, start_callback_); |
315 auth_credentials_ = AuthCredentials(); | 315 auth_credentials_ = AuthCredentials(); |
316 } else { | 316 } else { |
317 DCHECK(request_->context()); | 317 DCHECK(request_->context()); |
318 DCHECK(request_->context()->http_transaction_factory()); | 318 DCHECK(request_->context()->http_transaction_factory()); |
319 | 319 |
320 rv = request_->context()->http_transaction_factory()->CreateTransaction( | 320 rv = request_->context()->http_transaction_factory()->CreateTransaction( |
321 &transaction_); | 321 &transaction_); |
322 if (rv == OK) { | 322 if (rv == OK) { |
| 323 // TODO(joi): The hard-coded check for "chrome-extension" is |
| 324 // temporary (as of 2012/3/21), intended only to make sure this |
| 325 // change (to throttle only requests originating from |
| 326 // extensions) gets into M19. Right after the M19 branch point, |
| 327 // I will sort this out in a more architecturally-sound way. |
323 if (!URLRequestThrottlerManager::GetInstance()->enforce_throttling() || | 328 if (!URLRequestThrottlerManager::GetInstance()->enforce_throttling() || |
| 329 request_->first_party_for_cookies().scheme() != "chrome-extension" || |
324 !throttling_entry_->ShouldRejectRequest(request_info_.load_flags)) { | 330 !throttling_entry_->ShouldRejectRequest(request_info_.load_flags)) { |
325 rv = transaction_->Start( | 331 rv = transaction_->Start( |
326 &request_info_, start_callback_, request_->net_log()); | 332 &request_info_, start_callback_, request_->net_log()); |
327 start_time_ = base::TimeTicks::Now(); | 333 start_time_ = base::TimeTicks::Now(); |
328 } else { | 334 } else { |
329 // Special error code for the exponential back-off module. | 335 // Special error code for the exponential back-off module. |
330 rv = ERR_TEMPORARILY_THROTTLED; | 336 rv = ERR_TEMPORARILY_THROTTLED; |
331 } | 337 } |
332 // Make sure the context is alive for the duration of the | 338 // Make sure the context is alive for the duration of the |
333 // transaction. | 339 // transaction. |
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1409 return override_response_headers_.get() ? | 1415 return override_response_headers_.get() ? |
1410 override_response_headers_ : | 1416 override_response_headers_ : |
1411 transaction_->GetResponseInfo()->headers; | 1417 transaction_->GetResponseInfo()->headers; |
1412 } | 1418 } |
1413 | 1419 |
1414 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1420 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
1415 awaiting_callback_ = false; | 1421 awaiting_callback_ = false; |
1416 } | 1422 } |
1417 | 1423 |
1418 } // namespace net | 1424 } // namespace net |
OLD | NEW |