Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: content/browser/loader/navigation_url_loader_impl.cc

Issue 1294243004: PlzNavigate: Make ServiceWorker work with PlzNavigate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Missed a spot. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // Picking the partition based on the URL is incorrect.
29 // See crbug.com/513539
30 StoragePartition* partition = BrowserContext::GetStoragePartitionForSite(
31 browser_context, request_info->common_params.url);
32 DCHECK(partition);
33 core_ = new NavigationURLLoaderImplCore(weak_factory_.GetWeakPtr(),
34 partition->GetServiceWorkerContext());
28 BrowserThread::PostTask( 35 BrowserThread::PostTask(
29 BrowserThread::IO, FROM_HERE, 36 BrowserThread::IO, FROM_HERE,
30 base::Bind(&NavigationURLLoaderImplCore::Start, base::Unretained(core_), 37 base::Bind(&NavigationURLLoaderImplCore::Start, base::Unretained(core_),
31 browser_context->GetResourceContext(), frame_tree_node_id, 38 browser_context->GetResourceContext(), frame_tree_node_id,
32 base::Passed(&request_info))); 39 base::Passed(&request_info)));
33 } 40 }
34 41
35 NavigationURLLoaderImpl::~NavigationURLLoaderImpl() { 42 NavigationURLLoaderImpl::~NavigationURLLoaderImpl() {
36 DCHECK_CURRENTLY_ON(BrowserThread::UI); 43 DCHECK_CURRENTLY_ON(BrowserThread::UI);
37 44
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 delegate_->OnRequestFailed(in_cache, net_error); 78 delegate_->OnRequestFailed(in_cache, net_error);
72 } 79 }
73 80
74 void NavigationURLLoaderImpl::NotifyRequestStarted(base::TimeTicks timestamp) { 81 void NavigationURLLoaderImpl::NotifyRequestStarted(base::TimeTicks timestamp) {
75 DCHECK_CURRENTLY_ON(BrowserThread::UI); 82 DCHECK_CURRENTLY_ON(BrowserThread::UI);
76 83
77 delegate_->OnRequestStarted(timestamp); 84 delegate_->OnRequestStarted(timestamp);
78 } 85 }
79 86
80 } // namespace content 87 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698