| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 "&NavigationURLLoaderImplCore", this, "success", | 140 "&NavigationURLLoaderImplCore", this, "success", |
| 141 false); | 141 false); |
| 142 | 142 |
| 143 BrowserThread::PostTask( | 143 BrowserThread::PostTask( |
| 144 BrowserThread::UI, FROM_HERE, | 144 BrowserThread::UI, FROM_HERE, |
| 145 base::Bind(&NavigationURLLoaderImpl::NotifyRequestFailed, loader_, | 145 base::Bind(&NavigationURLLoaderImpl::NotifyRequestFailed, loader_, |
| 146 in_cache, net_error)); | 146 in_cache, net_error)); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void NavigationURLLoaderImplCore::OnServiceWorkerChecksPerformed( | 149 void NavigationURLLoaderImplCore::OnServiceWorkerChecksPerformed( |
| 150 ServiceWorkerStatusCode status, | 150 ServiceWorkerStatusCode status, |
| 151 const scoped_refptr<ServiceWorkerRegistration>& registration) { | 151 scoped_refptr<ServiceWorkerRegistration> registration) { |
| 152 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 152 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 153 // If the navigation has a ServiceWorker, bail out immediately. | 153 // If the navigation has a ServiceWorker, bail out immediately. |
| 154 // TODO(clamy): only bail out when the ServiceWorker has a Fetch event | 154 // TODO(clamy): only bail out when the ServiceWorker has a Fetch event |
| 155 // handler. | 155 // handler. |
| 156 if (status == SERVICE_WORKER_OK) { | 156 if (status == SERVICE_WORKER_OK) { |
| 157 BrowserThread::PostTask( | 157 BrowserThread::PostTask( |
| 158 BrowserThread::UI, FROM_HERE, | 158 BrowserThread::UI, FROM_HERE, |
| 159 base::Bind(&NavigationURLLoaderImpl::NotifyServiceWorkerEncountered, | 159 base::Bind(&NavigationURLLoaderImpl::NotifyServiceWorkerEncountered, |
| 160 loader_)); | 160 loader_)); |
| 161 return; | 161 return; |
| 162 } | 162 } |
| 163 | 163 |
| 164 // Otherwise, start the navigation in the network stack. | 164 // Otherwise, start the navigation in the network stack. |
| 165 | 165 |
| 166 // The ResourceDispatcherHostImpl can be null in unit tests. | 166 // The ResourceDispatcherHostImpl can be null in unit tests. |
| 167 if (!ResourceDispatcherHostImpl::Get()) | 167 if (!ResourceDispatcherHostImpl::Get()) |
| 168 return; | 168 return; |
| 169 | 169 |
| 170 ResourceDispatcherHostImpl::Get()->BeginNavigationRequest( | 170 ResourceDispatcherHostImpl::Get()->BeginNavigationRequest( |
| 171 resource_context_, *request_info_, this); | 171 resource_context_, *request_info_, this); |
| 172 } | 172 } |
| 173 | 173 |
| 174 } // namespace content | 174 } // namespace content |
| OLD | NEW |