| 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.h" | 5 #include "net/url_request/url_request.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 DCHECK(!connect_timing->ssl_end.is_null()); | 135 DCHECK(!connect_timing->ssl_end.is_null()); |
| 136 if (connect_timing->ssl_start < block_on_connect) | 136 if (connect_timing->ssl_start < block_on_connect) |
| 137 connect_timing->ssl_start = block_on_connect; | 137 connect_timing->ssl_start = block_on_connect; |
| 138 if (connect_timing->ssl_end < block_on_connect) | 138 if (connect_timing->ssl_end < block_on_connect) |
| 139 connect_timing->ssl_end = block_on_connect; | 139 connect_timing->ssl_end = block_on_connect; |
| 140 } | 140 } |
| 141 } | 141 } |
| 142 | 142 |
| 143 } // namespace | 143 } // namespace |
| 144 | 144 |
| 145 void URLRequest::Deprecated::RegisterRequestInterceptor( | |
| 146 Interceptor* interceptor) { | |
| 147 URLRequest::RegisterRequestInterceptor(interceptor); | |
| 148 } | |
| 149 | |
| 150 void URLRequest::Deprecated::UnregisterRequestInterceptor( | |
| 151 Interceptor* interceptor) { | |
| 152 URLRequest::UnregisterRequestInterceptor(interceptor); | |
| 153 } | |
| 154 | |
| 155 /////////////////////////////////////////////////////////////////////////////// | |
| 156 // URLRequest::Interceptor | |
| 157 | |
| 158 URLRequestJob* URLRequest::Interceptor::MaybeInterceptRedirect( | |
| 159 URLRequest* request, | |
| 160 NetworkDelegate* network_delegate, | |
| 161 const GURL& location) { | |
| 162 return NULL; | |
| 163 } | |
| 164 | |
| 165 URLRequestJob* URLRequest::Interceptor::MaybeInterceptResponse( | |
| 166 URLRequest* request, NetworkDelegate* network_delegate) { | |
| 167 return NULL; | |
| 168 } | |
| 169 | |
| 170 /////////////////////////////////////////////////////////////////////////////// | 145 /////////////////////////////////////////////////////////////////////////////// |
| 171 // URLRequest::Delegate | 146 // URLRequest::Delegate |
| 172 | 147 |
| 173 void URLRequest::Delegate::OnReceivedRedirect(URLRequest* request, | 148 void URLRequest::Delegate::OnReceivedRedirect(URLRequest* request, |
| 174 const RedirectInfo& redirect_info, | 149 const RedirectInfo& redirect_info, |
| 175 bool* defer_redirect) { | 150 bool* defer_redirect) { |
| 176 } | 151 } |
| 177 | 152 |
| 178 void URLRequest::Delegate::OnAuthRequired(URLRequest* request, | 153 void URLRequest::Delegate::OnAuthRequired(URLRequest* request, |
| 179 AuthChallengeInfo* auth_info) { | 154 AuthChallengeInfo* auth_info) { |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 SIMPLE_STATS_COUNTER("URLRequestCount"); | 592 SIMPLE_STATS_COUNTER("URLRequestCount"); |
| 618 | 593 |
| 619 // Sanity check out environment. | 594 // Sanity check out environment. |
| 620 DCHECK(base::MessageLoop::current()) | 595 DCHECK(base::MessageLoop::current()) |
| 621 << "The current base::MessageLoop must exist"; | 596 << "The current base::MessageLoop must exist"; |
| 622 | 597 |
| 623 context->url_requests()->insert(this); | 598 context->url_requests()->insert(this); |
| 624 net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE); | 599 net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE); |
| 625 } | 600 } |
| 626 | 601 |
| 627 // static | |
| 628 void URLRequest::RegisterRequestInterceptor(Interceptor* interceptor) { | |
| 629 URLRequestJobManager::GetInstance()->RegisterRequestInterceptor(interceptor); | |
| 630 } | |
| 631 | |
| 632 // static | |
| 633 void URLRequest::UnregisterRequestInterceptor(Interceptor* interceptor) { | |
| 634 URLRequestJobManager::GetInstance()->UnregisterRequestInterceptor( | |
| 635 interceptor); | |
| 636 } | |
| 637 | |
| 638 void URLRequest::BeforeRequestComplete(int error) { | 602 void URLRequest::BeforeRequestComplete(int error) { |
| 639 DCHECK(!job_.get()); | 603 DCHECK(!job_.get()); |
| 640 DCHECK_NE(ERR_IO_PENDING, error); | 604 DCHECK_NE(ERR_IO_PENDING, error); |
| 641 | 605 |
| 642 // Check that there are no callbacks to already canceled requests. | 606 // Check that there are no callbacks to already canceled requests. |
| 643 DCHECK_NE(URLRequestStatus::CANCELED, status_.status()); | 607 DCHECK_NE(URLRequestStatus::CANCELED, status_.status()); |
| 644 | 608 |
| 645 OnCallToDelegateComplete(); | 609 OnCallToDelegateComplete(); |
| 646 | 610 |
| 647 if (error != OK) { | 611 if (error != OK) { |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1265 new base::debug::StackTrace(NULL, 0); | 1229 new base::debug::StackTrace(NULL, 0); |
| 1266 *stack_trace_copy = stack_trace; | 1230 *stack_trace_copy = stack_trace; |
| 1267 stack_trace_.reset(stack_trace_copy); | 1231 stack_trace_.reset(stack_trace_copy); |
| 1268 } | 1232 } |
| 1269 | 1233 |
| 1270 const base::debug::StackTrace* URLRequest::stack_trace() const { | 1234 const base::debug::StackTrace* URLRequest::stack_trace() const { |
| 1271 return stack_trace_.get(); | 1235 return stack_trace_.get(); |
| 1272 } | 1236 } |
| 1273 | 1237 |
| 1274 } // namespace net | 1238 } // namespace net |
| OLD | NEW |