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

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

Issue 2584513003: PlzNavigate: identify same-page browser-initiated navigation. (Closed)
Patch Set: Adding a DCHECK to probably make a lot of tests fail. 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 StartNavigationParams::StartNavigationParams( 124 StartNavigationParams::StartNavigationParams(
127 const StartNavigationParams& other) = default; 125 const StartNavigationParams& other) = default;
128 126
129 StartNavigationParams::~StartNavigationParams() { 127 StartNavigationParams::~StartNavigationParams() {
130 } 128 }
131 129
132 RequestNavigationParams::RequestNavigationParams() 130 RequestNavigationParams::RequestNavigationParams()
133 : is_overriding_user_agent(false), 131 : is_overriding_user_agent(false),
134 can_load_local_resources(false), 132 can_load_local_resources(false),
135 nav_entry_id(0), 133 nav_entry_id(0),
134 is_same_document_fragment_change(false),
136 is_same_document_history_load(false), 135 is_same_document_history_load(false),
137 is_history_navigation_in_new_child(false), 136 is_history_navigation_in_new_child(false),
138 has_committed_real_load(false), 137 has_committed_real_load(false),
139 intended_as_new_entry(false), 138 intended_as_new_entry(false),
140 pending_history_list_offset(-1), 139 pending_history_list_offset(-1),
141 current_history_list_offset(-1), 140 current_history_list_offset(-1),
142 current_history_list_length(0), 141 current_history_list_length(0),
143 is_view_source(false), 142 is_view_source(false),
144 should_clear_history_list(false), 143 should_clear_history_list(false),
145 should_create_service_worker(false), 144 should_create_service_worker(false),
146 service_worker_provider_id(kInvalidServiceWorkerProviderId), 145 service_worker_provider_id(kInvalidServiceWorkerProviderId),
147 appcache_host_id(kAppCacheNoHostId), 146 appcache_host_id(kAppCacheNoHostId),
148 has_user_gesture(false) { 147 has_user_gesture(false) {
149 } 148 }
150 149
151 RequestNavigationParams::RequestNavigationParams( 150 RequestNavigationParams::RequestNavigationParams(
152 bool is_overriding_user_agent, 151 bool is_overriding_user_agent,
153 const std::vector<GURL>& redirects, 152 const std::vector<GURL>& redirects,
154 bool can_load_local_resources, 153 bool can_load_local_resources,
155 const PageState& page_state, 154 const PageState& page_state,
156 int nav_entry_id, 155 int nav_entry_id,
156 bool is_same_document_fragment_change,
157 bool is_same_document_history_load, 157 bool is_same_document_history_load,
158 bool is_history_navigation_in_new_child, 158 bool is_history_navigation_in_new_child,
159 std::map<std::string, bool> subframe_unique_names, 159 std::map<std::string, bool> subframe_unique_names,
160 bool has_committed_real_load, 160 bool has_committed_real_load,
161 bool intended_as_new_entry, 161 bool intended_as_new_entry,
162 int pending_history_list_offset, 162 int pending_history_list_offset,
163 int current_history_list_offset, 163 int current_history_list_offset,
164 int current_history_list_length, 164 int current_history_list_length,
165 bool is_view_source, 165 bool is_view_source,
166 bool should_clear_history_list, 166 bool should_clear_history_list,
167 bool has_user_gesture) 167 bool has_user_gesture)
168 : is_overriding_user_agent(is_overriding_user_agent), 168 : is_overriding_user_agent(is_overriding_user_agent),
169 redirects(redirects), 169 redirects(redirects),
170 can_load_local_resources(can_load_local_resources), 170 can_load_local_resources(can_load_local_resources),
171 page_state(page_state), 171 page_state(page_state),
172 nav_entry_id(nav_entry_id), 172 nav_entry_id(nav_entry_id),
173 is_same_document_fragment_change(is_same_document_fragment_change),
173 is_same_document_history_load(is_same_document_history_load), 174 is_same_document_history_load(is_same_document_history_load),
174 is_history_navigation_in_new_child(is_history_navigation_in_new_child), 175 is_history_navigation_in_new_child(is_history_navigation_in_new_child),
175 subframe_unique_names(subframe_unique_names), 176 subframe_unique_names(subframe_unique_names),
176 has_committed_real_load(has_committed_real_load), 177 has_committed_real_load(has_committed_real_load),
177 intended_as_new_entry(intended_as_new_entry), 178 intended_as_new_entry(intended_as_new_entry),
178 pending_history_list_offset(pending_history_list_offset), 179 pending_history_list_offset(pending_history_list_offset),
179 current_history_list_offset(current_history_list_offset), 180 current_history_list_offset(current_history_list_offset),
180 current_history_list_length(current_history_list_length), 181 current_history_list_length(current_history_list_length),
181 is_view_source(is_view_source), 182 is_view_source(is_view_source),
182 should_clear_history_list(should_clear_history_list), 183 should_clear_history_list(should_clear_history_list),
(...skipping 15 matching lines...) Expand all
198 const RequestNavigationParams& request_params) 199 const RequestNavigationParams& request_params)
199 : common_params(common_params), 200 : common_params(common_params),
200 start_params(start_params), 201 start_params(start_params),
201 request_params(request_params) { 202 request_params(request_params) {
202 } 203 }
203 204
204 NavigationParams::~NavigationParams() { 205 NavigationParams::~NavigationParams() {
205 } 206 }
206 207
207 } // namespace content 208 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698