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.h" | 5 #include "content/browser/loader/navigation_url_loader_impl.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 "content/browser/frame_host/navigation_request_info.h" | 9 #include "content/browser/frame_host/navigation_request_info.h" |
10 #include "content/browser/loader/navigation_url_loader_delegate.h" | 10 #include "content/browser/loader/navigation_url_loader_delegate.h" |
11 #include "content/browser/loader/navigation_url_loader_impl_core.h" | 11 #include "content/browser/loader/navigation_url_loader_impl_core.h" |
| 12 #include "content/browser/service_worker/service_worker_navigation_handle.h" |
12 #include "content/public/browser/browser_context.h" | 13 #include "content/public/browser/browser_context.h" |
13 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
14 #include "content/public/browser/stream_handle.h" | 15 #include "content/public/browser/stream_handle.h" |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 | 18 |
18 NavigationURLLoaderImpl::NavigationURLLoaderImpl( | 19 NavigationURLLoaderImpl::NavigationURLLoaderImpl( |
19 BrowserContext* browser_context, | 20 BrowserContext* browser_context, |
20 scoped_ptr<NavigationRequestInfo> request_info, | 21 scoped_ptr<NavigationRequestInfo> request_info, |
| 22 ServiceWorkerNavigationHandle* service_worker_handle, |
21 NavigationURLLoaderDelegate* delegate) | 23 NavigationURLLoaderDelegate* delegate) |
22 : delegate_(delegate), | 24 : delegate_(delegate), weak_factory_(this) { |
23 weak_factory_(this) { | |
24 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 25 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
25 | 26 |
26 core_ = new NavigationURLLoaderImplCore(weak_factory_.GetWeakPtr()); | 27 core_ = new NavigationURLLoaderImplCore(weak_factory_.GetWeakPtr()); |
| 28 ServiceWorkerNavigationHandleCore* service_worker_handle_core = |
| 29 service_worker_handle ? service_worker_handle->core() : nullptr; |
27 BrowserThread::PostTask( | 30 BrowserThread::PostTask( |
28 BrowserThread::IO, FROM_HERE, | 31 BrowserThread::IO, FROM_HERE, |
29 base::Bind(&NavigationURLLoaderImplCore::Start, base::Unretained(core_), | 32 base::Bind(&NavigationURLLoaderImplCore::Start, base::Unretained(core_), |
30 browser_context->GetResourceContext(), | 33 browser_context->GetResourceContext(), |
31 base::Passed(&request_info))); | 34 service_worker_handle_core, base::Passed(&request_info))); |
32 } | 35 } |
33 | 36 |
34 NavigationURLLoaderImpl::~NavigationURLLoaderImpl() { | 37 NavigationURLLoaderImpl::~NavigationURLLoaderImpl() { |
35 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 38 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
36 | 39 |
37 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, core_); | 40 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, core_); |
38 core_ = nullptr; | 41 core_ = nullptr; |
39 } | 42 } |
40 | 43 |
41 void NavigationURLLoaderImpl::FollowRedirect() { | 44 void NavigationURLLoaderImpl::FollowRedirect() { |
(...skipping 28 matching lines...) Expand all Loading... |
70 delegate_->OnRequestFailed(in_cache, net_error); | 73 delegate_->OnRequestFailed(in_cache, net_error); |
71 } | 74 } |
72 | 75 |
73 void NavigationURLLoaderImpl::NotifyRequestStarted(base::TimeTicks timestamp) { | 76 void NavigationURLLoaderImpl::NotifyRequestStarted(base::TimeTicks timestamp) { |
74 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 77 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
75 | 78 |
76 delegate_->OnRequestStarted(timestamp); | 79 delegate_->OnRequestStarted(timestamp); |
77 } | 80 } |
78 | 81 |
79 } // namespace content | 82 } // namespace content |
OLD | NEW |