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

Side by Side Diff: content/common/navigation_params.cc

Issue 2584513003: PlzNavigate: identify same-page browser-initiated navigation. (Closed)
Patch Set: Fix 2 WebContentsImplTest by assigning a document_sequence_number. Created 3 years, 11 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/common/navigation_params.h" 5 #include "content/common/navigation_params.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "content/common/service_worker/service_worker_types.h" 9 #include "content/common/service_worker/service_worker_types.h"
10 #include "content/public/common/appcache_info.h" 10 #include "content/public/common/appcache_info.h"
11 #include "content/public/common/browser_side_navigation_policy.h" 11 #include "content/public/common/browser_side_navigation_policy.h"
12 #include "content/public/common/url_constants.h" 12 #include "content/public/common/url_constants.h"
13 #include "url/gurl.h" 13 #include "url/gurl.h"
14 #include "url/url_constants.h" 14 #include "url/url_constants.h"
15 15
16 namespace content { 16 namespace content {
17 17
18 // PlzNavigate 18 // PlzNavigate
19 bool ShouldMakeNetworkRequestForURL(const GURL& url) { 19 bool ShouldMakeNetworkRequestForURL(const GURL& url) {
20 CHECK(IsBrowserSideNavigationEnabled()); 20 CHECK(IsBrowserSideNavigationEnabled());
21 21
22 // Javascript URLs, about:blank, srcdoc should not send a request 22 // Javascript URLs, about:blank, srcdoc should not send a request
23 // to the network stack. 23 // to the network stack.
24 // TODO(clamy): same document navigations should not send requests to the
25 // network stack. Neither should pushState/popState.
26 return url != url::kAboutBlankURL && !url.SchemeIs(url::kJavaScriptScheme) && 24 return url != url::kAboutBlankURL && !url.SchemeIs(url::kJavaScriptScheme) &&
27 !url.is_empty() && !url.SchemeIs(url::kContentIDScheme) && 25 !url.is_empty() && !url.SchemeIs(url::kContentIDScheme) &&
28 url != content::kAboutSrcDocURL; 26 url != content::kAboutSrcDocURL;
29 } 27 }
30 28
31 CommonNavigationParams::CommonNavigationParams() 29 CommonNavigationParams::CommonNavigationParams()
32 : transition(ui::PAGE_TRANSITION_LINK), 30 : transition(ui::PAGE_TRANSITION_LINK),
33 navigation_type(FrameMsg_Navigate_Type::NORMAL), 31 navigation_type(FrameMsg_Navigate_Type::NORMAL),
34 allow_download(true), 32 allow_download(true),
35 should_replace_current_entry(false), 33 should_replace_current_entry(false),
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 StartNavigationParams::StartNavigationParams( 120 StartNavigationParams::StartNavigationParams(
123 const StartNavigationParams& other) = default; 121 const StartNavigationParams& other) = default;
124 122
125 StartNavigationParams::~StartNavigationParams() { 123 StartNavigationParams::~StartNavigationParams() {
126 } 124 }
127 125
128 RequestNavigationParams::RequestNavigationParams() 126 RequestNavigationParams::RequestNavigationParams()
129 : is_overriding_user_agent(false), 127 : is_overriding_user_agent(false),
130 can_load_local_resources(false), 128 can_load_local_resources(false),
131 nav_entry_id(0), 129 nav_entry_id(0),
130 is_same_document_fragment_change(false),
132 is_same_document_history_load(false), 131 is_same_document_history_load(false),
133 is_history_navigation_in_new_child(false), 132 is_history_navigation_in_new_child(false),
134 has_committed_real_load(false), 133 has_committed_real_load(false),
135 intended_as_new_entry(false), 134 intended_as_new_entry(false),
136 pending_history_list_offset(-1), 135 pending_history_list_offset(-1),
137 current_history_list_offset(-1), 136 current_history_list_offset(-1),
138 current_history_list_length(0), 137 current_history_list_length(0),
139 is_view_source(false), 138 is_view_source(false),
140 should_clear_history_list(false), 139 should_clear_history_list(false),
141 should_create_service_worker(false), 140 should_create_service_worker(false),
142 service_worker_provider_id(kInvalidServiceWorkerProviderId), 141 service_worker_provider_id(kInvalidServiceWorkerProviderId),
143 appcache_host_id(kAppCacheNoHostId), 142 appcache_host_id(kAppCacheNoHostId),
144 has_user_gesture(false) { 143 has_user_gesture(false) {
145 } 144 }
146 145
147 RequestNavigationParams::RequestNavigationParams( 146 RequestNavigationParams::RequestNavigationParams(
148 bool is_overriding_user_agent, 147 bool is_overriding_user_agent,
149 const std::vector<GURL>& redirects, 148 const std::vector<GURL>& redirects,
150 bool can_load_local_resources, 149 bool can_load_local_resources,
151 const PageState& page_state, 150 const PageState& page_state,
152 int nav_entry_id, 151 int nav_entry_id,
152 bool is_same_document_fragment_change,
153 bool is_same_document_history_load, 153 bool is_same_document_history_load,
154 bool is_history_navigation_in_new_child, 154 bool is_history_navigation_in_new_child,
155 std::map<std::string, bool> subframe_unique_names, 155 std::map<std::string, bool> subframe_unique_names,
156 bool has_committed_real_load, 156 bool has_committed_real_load,
157 bool intended_as_new_entry, 157 bool intended_as_new_entry,
158 int pending_history_list_offset, 158 int pending_history_list_offset,
159 int current_history_list_offset, 159 int current_history_list_offset,
160 int current_history_list_length, 160 int current_history_list_length,
161 bool is_view_source, 161 bool is_view_source,
162 bool should_clear_history_list, 162 bool should_clear_history_list,
163 bool has_user_gesture) 163 bool has_user_gesture)
164 : is_overriding_user_agent(is_overriding_user_agent), 164 : is_overriding_user_agent(is_overriding_user_agent),
165 redirects(redirects), 165 redirects(redirects),
166 can_load_local_resources(can_load_local_resources), 166 can_load_local_resources(can_load_local_resources),
167 page_state(page_state), 167 page_state(page_state),
168 nav_entry_id(nav_entry_id), 168 nav_entry_id(nav_entry_id),
169 is_same_document_fragment_change(is_same_document_fragment_change),
169 is_same_document_history_load(is_same_document_history_load), 170 is_same_document_history_load(is_same_document_history_load),
170 is_history_navigation_in_new_child(is_history_navigation_in_new_child), 171 is_history_navigation_in_new_child(is_history_navigation_in_new_child),
171 subframe_unique_names(subframe_unique_names), 172 subframe_unique_names(subframe_unique_names),
172 has_committed_real_load(has_committed_real_load), 173 has_committed_real_load(has_committed_real_load),
173 intended_as_new_entry(intended_as_new_entry), 174 intended_as_new_entry(intended_as_new_entry),
174 pending_history_list_offset(pending_history_list_offset), 175 pending_history_list_offset(pending_history_list_offset),
175 current_history_list_offset(current_history_list_offset), 176 current_history_list_offset(current_history_list_offset),
176 current_history_list_length(current_history_list_length), 177 current_history_list_length(current_history_list_length),
177 is_view_source(is_view_source), 178 is_view_source(is_view_source),
178 should_clear_history_list(should_clear_history_list), 179 should_clear_history_list(should_clear_history_list),
(...skipping 15 matching lines...) Expand all
194 const RequestNavigationParams& request_params) 195 const RequestNavigationParams& request_params)
195 : common_params(common_params), 196 : common_params(common_params),
196 start_params(start_params), 197 start_params(start_params),
197 request_params(request_params) { 198 request_params(request_params) {
198 } 199 }
199 200
200 NavigationParams::~NavigationParams() { 201 NavigationParams::~NavigationParams() {
201 } 202 }
202 203
203 } // namespace content 204 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698