| 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 "content/browser/loader/navigation_url_loader_impl_core.h" | 5 #include "content/browser/loader/navigation_url_loader_impl_core.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "content/browser/frame_host/navigation_request_info.h" | 10 #include "content/browser/frame_host/navigation_request_info.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 NavigationURLLoaderImplCore::~NavigationURLLoaderImplCore() { | 34 NavigationURLLoaderImplCore::~NavigationURLLoaderImplCore() { |
| 35 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 35 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 36 | 36 |
| 37 if (resource_handler_) | 37 if (resource_handler_) |
| 38 resource_handler_->Cancel(); | 38 resource_handler_->Cancel(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void NavigationURLLoaderImplCore::Start( | 41 void NavigationURLLoaderImplCore::Start( |
| 42 ResourceContext* resource_context, | 42 ResourceContext* resource_context, |
| 43 ServiceWorkerNavigationHandleCore* service_worker_handle_core, | 43 ServiceWorkerNavigationHandleCore* service_worker_handle_core, |
| 44 AppCacheNavigationHandleCore* appcache_handle_core, |
| 44 std::unique_ptr<NavigationRequestInfo> request_info, | 45 std::unique_ptr<NavigationRequestInfo> request_info, |
| 45 std::unique_ptr<NavigationUIData> navigation_ui_data) { | 46 std::unique_ptr<NavigationUIData> navigation_ui_data) { |
| 46 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 47 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 47 | 48 |
| 48 BrowserThread::PostTask( | 49 BrowserThread::PostTask( |
| 49 BrowserThread::UI, FROM_HERE, | 50 BrowserThread::UI, FROM_HERE, |
| 50 base::Bind(&NavigationURLLoaderImpl::NotifyRequestStarted, loader_, | 51 base::Bind(&NavigationURLLoaderImpl::NotifyRequestStarted, loader_, |
| 51 base::TimeTicks::Now())); | 52 base::TimeTicks::Now())); |
| 52 | 53 |
| 53 // The ResourceDispatcherHostImpl can be null in unit tests. | 54 // The ResourceDispatcherHostImpl can be null in unit tests. |
| 54 if (ResourceDispatcherHostImpl::Get()) { | 55 if (ResourceDispatcherHostImpl::Get()) { |
| 55 ResourceDispatcherHostImpl::Get()->BeginNavigationRequest( | 56 ResourceDispatcherHostImpl::Get()->BeginNavigationRequest( |
| 56 resource_context, *request_info, std::move(navigation_ui_data), this, | 57 resource_context, *request_info, std::move(navigation_ui_data), this, |
| 57 service_worker_handle_core); | 58 service_worker_handle_core, appcache_handle_core); |
| 58 } | 59 } |
| 59 } | 60 } |
| 60 | 61 |
| 61 void NavigationURLLoaderImplCore::FollowRedirect() { | 62 void NavigationURLLoaderImplCore::FollowRedirect() { |
| 62 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 63 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 63 | 64 |
| 64 if (resource_handler_) | 65 if (resource_handler_) |
| 65 resource_handler_->FollowRedirect(); | 66 resource_handler_->FollowRedirect(); |
| 66 } | 67 } |
| 67 | 68 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 "&NavigationURLLoaderImplCore", this, "success", | 131 "&NavigationURLLoaderImplCore", this, "success", |
| 131 false); | 132 false); |
| 132 | 133 |
| 133 BrowserThread::PostTask( | 134 BrowserThread::PostTask( |
| 134 BrowserThread::UI, FROM_HERE, | 135 BrowserThread::UI, FROM_HERE, |
| 135 base::Bind(&NavigationURLLoaderImpl::NotifyRequestFailed, loader_, | 136 base::Bind(&NavigationURLLoaderImpl::NotifyRequestFailed, loader_, |
| 136 in_cache, net_error)); | 137 in_cache, net_error)); |
| 137 } | 138 } |
| 138 | 139 |
| 139 } // namespace content | 140 } // namespace content |
| OLD | NEW |