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

Side by Side Diff: content/browser/frame_host/navigation_request.cc

Issue 1294243004: PlzNavigate: Make ServiceWorker work with PlzNavigate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 3 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/frame_host/navigation_request.h" 5 #include "content/browser/frame_host/navigation_request.h"
6 6
7 #include "content/browser/frame_host/frame_tree.h" 7 #include "content/browser/frame_host/frame_tree.h"
8 #include "content/browser/frame_host/frame_tree_node.h" 8 #include "content/browser/frame_host/frame_tree_node.h"
9 #include "content/browser/frame_host/navigation_controller_impl.h" 9 #include "content/browser/frame_host/navigation_controller_impl.h"
10 #include "content/browser/frame_host/navigation_handle_impl.h" 10 #include "content/browser/frame_host/navigation_handle_impl.h"
11 #include "content/browser/frame_host/navigation_request_info.h" 11 #include "content/browser/frame_host/navigation_request_info.h"
12 #include "content/browser/frame_host/navigator.h" 12 #include "content/browser/frame_host/navigator.h"
13 #include "content/browser/loader/navigation_url_loader.h" 13 #include "content/browser/loader/navigation_url_loader.h"
14 #include "content/browser/service_worker/service_worker_provider_host.h"
14 #include "content/browser/site_instance_impl.h" 15 #include "content/browser/site_instance_impl.h"
15 #include "content/common/resource_request_body.h" 16 #include "content/common/resource_request_body.h"
16 #include "content/public/browser/navigation_controller.h" 17 #include "content/public/browser/navigation_controller.h"
17 #include "content/public/browser/stream_handle.h" 18 #include "content/public/browser/stream_handle.h"
18 #include "content/public/common/content_client.h" 19 #include "content/public/common/content_client.h"
19 #include "net/base/load_flags.h" 20 #include "net/base/load_flags.h"
20 #include "net/http/http_request_headers.h" 21 #include "net/http/http_request_headers.h"
21 #include "net/url_request/redirect_info.h" 22 #include "net/url_request/redirect_info.h"
22 23
23 namespace content { 24 namespace content {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 if (entry.GetHasPostData()) { 79 if (entry.GetHasPostData()) {
79 request_body = new ResourceRequestBody(); 80 request_body = new ResourceRequestBody();
80 request_body->AppendBytes( 81 request_body->AppendBytes(
81 reinterpret_cast<const char *>( 82 reinterpret_cast<const char *>(
82 entry.GetBrowserInitiatedPostData()->front()), 83 entry.GetBrowserInitiatedPostData()->front()),
83 entry.GetBrowserInitiatedPostData()->size()); 84 entry.GetBrowserInitiatedPostData()->size());
84 } 85 }
85 86
86 scoped_ptr<NavigationRequest> navigation_request(new NavigationRequest( 87 scoped_ptr<NavigationRequest> navigation_request(new NavigationRequest(
87 frame_tree_node, 88 frame_tree_node,
88 entry.ConstructCommonNavigationParams(dest_url, dest_referrer, 89 entry.ConstructCommonNavigationParams(
89 frame_entry, navigation_type), 90 dest_url, dest_referrer, frame_entry, navigation_type,
90 BeginNavigationParams(method, headers.ToString(), 91 ServiceWorkerProviderHost::GetNextBrowserProviderID()),
91 LoadFlagFromNavigationType(navigation_type), false), 92 BeginNavigationParams(method,
93 headers.ToString(),
94 LoadFlagFromNavigationType(navigation_type),
95 false, // has_user_gestures
96 false, // skip_service_worker
97 REQUEST_CONTEXT_TYPE_LOCATION,
clamy 2015/08/27 11:53:45 I'm not sure this is the best context type for a b
carlosk 2015/08/27 14:26:42 If you do this change here remember that there are
Fabrice (no longer in Chrome) 2015/08/28 15:40:15 I left LOCATION for now, I'd like some more people
98 frame_tree_node->IsMainFrame() ?
99 REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL :
100 REQUEST_CONTEXT_FRAME_TYPE_NESTED),
92 entry.ConstructRequestNavigationParams( 101 entry.ConstructRequestNavigationParams(
93 frame_entry, navigation_start, is_same_document_history_load, 102 frame_entry, navigation_start, is_same_document_history_load,
94 frame_tree_node->has_committed_real_load(), 103 frame_tree_node->has_committed_real_load(),
95 controller->GetPendingEntryIndex() == -1, 104 controller->GetPendingEntryIndex() == -1,
96 controller->GetIndexOfEntry(&entry), 105 controller->GetIndexOfEntry(&entry),
97 controller->GetLastCommittedEntryIndex(), 106 controller->GetLastCommittedEntryIndex(),
98 controller->GetEntryCount()), 107 controller->GetEntryCount()),
99 request_body, true, &frame_entry, &entry)); 108 request_body, true, &frame_entry, &entry));
100 return navigation_request.Pass(); 109 return navigation_request.Pass();
101 } 110 }
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 frame_tree_node_->navigator()->FailedNavigation( 246 frame_tree_node_->navigator()->FailedNavigation(
238 frame_tree_node_, has_stale_copy_in_cache, net_error); 247 frame_tree_node_, has_stale_copy_in_cache, net_error);
239 } 248 }
240 249
241 void NavigationRequest::OnRequestStarted(base::TimeTicks timestamp) { 250 void NavigationRequest::OnRequestStarted(base::TimeTicks timestamp) {
242 frame_tree_node_->navigator()->LogResourceRequestTime(timestamp, 251 frame_tree_node_->navigator()->LogResourceRequestTime(timestamp,
243 common_params_.url); 252 common_params_.url);
244 } 253 }
245 254
246 } // namespace content 255 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698