| 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/public/browser/browser_context.h" | 12 #include "content/public/browser/browser_context.h" |
| 13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 14 #include "content/public/browser/storage_partition.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 int frame_tree_node_id, | 21 int frame_tree_node_id, |
| 21 scoped_ptr<NavigationRequestInfo> request_info, | 22 scoped_ptr<NavigationRequestInfo> request_info, |
| 22 NavigationURLLoaderDelegate* delegate) | 23 NavigationURLLoaderDelegate* delegate) |
| 23 : delegate_(delegate), | 24 : delegate_(delegate), |
| 24 weak_factory_(this) { | 25 weak_factory_(this) { |
| 25 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 26 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 26 | 27 |
| 27 core_ = new NavigationURLLoaderImplCore(weak_factory_.GetWeakPtr()); | 28 StoragePartition* partition = BrowserContext::GetStoragePartitionForSite( |
| 29 browser_context, request_info->common_params.url); |
| 30 DCHECK(partition); |
| 31 core_ = new NavigationURLLoaderImplCore(weak_factory_.GetWeakPtr(), |
| 32 partition->GetServiceWorkerContext()); |
| 28 BrowserThread::PostTask( | 33 BrowserThread::PostTask( |
| 29 BrowserThread::IO, FROM_HERE, | 34 BrowserThread::IO, FROM_HERE, |
| 30 base::Bind(&NavigationURLLoaderImplCore::Start, base::Unretained(core_), | 35 base::Bind(&NavigationURLLoaderImplCore::Start, base::Unretained(core_), |
| 31 browser_context->GetResourceContext(), frame_tree_node_id, | 36 browser_context->GetResourceContext(), frame_tree_node_id, |
| 32 base::Passed(&request_info))); | 37 base::Passed(&request_info))); |
| 33 } | 38 } |
| 34 | 39 |
| 35 NavigationURLLoaderImpl::~NavigationURLLoaderImpl() { | 40 NavigationURLLoaderImpl::~NavigationURLLoaderImpl() { |
| 36 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 41 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 37 | 42 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 delegate_->OnRequestFailed(in_cache, net_error); | 76 delegate_->OnRequestFailed(in_cache, net_error); |
| 72 } | 77 } |
| 73 | 78 |
| 74 void NavigationURLLoaderImpl::NotifyRequestStarted(base::TimeTicks timestamp) { | 79 void NavigationURLLoaderImpl::NotifyRequestStarted(base::TimeTicks timestamp) { |
| 75 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 80 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 76 | 81 |
| 77 delegate_->OnRequestStarted(timestamp); | 82 delegate_->OnRequestStarted(timestamp); |
| 78 } | 83 } |
| 79 | 84 |
| 80 } // namespace content | 85 } // namespace content |
| OLD | NEW |