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

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

Issue 2584513003: PlzNavigate: identify same-page browser-initiated navigation. (Closed)
Patch Set: Addressed comments (@clamy). Created 4 years 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 StartNavigationParams::StartNavigationParams( 116 StartNavigationParams::StartNavigationParams(
119 const StartNavigationParams& other) = default; 117 const StartNavigationParams& other) = default;
120 118
121 StartNavigationParams::~StartNavigationParams() { 119 StartNavigationParams::~StartNavigationParams() {
122 } 120 }
123 121
124 RequestNavigationParams::RequestNavigationParams() 122 RequestNavigationParams::RequestNavigationParams()
125 : is_overriding_user_agent(false), 123 : is_overriding_user_agent(false),
126 can_load_local_resources(false), 124 can_load_local_resources(false),
127 nav_entry_id(0), 125 nav_entry_id(0),
126 is_same_document_navigation(false),
128 is_same_document_history_load(false), 127 is_same_document_history_load(false),
129 is_history_navigation_in_new_child(false), 128 is_history_navigation_in_new_child(false),
130 has_committed_real_load(false), 129 has_committed_real_load(false),
131 intended_as_new_entry(false), 130 intended_as_new_entry(false),
132 pending_history_list_offset(-1), 131 pending_history_list_offset(-1),
133 current_history_list_offset(-1), 132 current_history_list_offset(-1),
134 current_history_list_length(0), 133 current_history_list_length(0),
135 is_view_source(false), 134 is_view_source(false),
136 should_clear_history_list(false), 135 should_clear_history_list(false),
137 should_create_service_worker(false), 136 should_create_service_worker(false),
138 service_worker_provider_id(kInvalidServiceWorkerProviderId), 137 service_worker_provider_id(kInvalidServiceWorkerProviderId),
139 appcache_host_id(kAppCacheNoHostId), 138 appcache_host_id(kAppCacheNoHostId),
140 has_user_gesture(false) { 139 has_user_gesture(false) {
141 } 140 }
142 141
143 RequestNavigationParams::RequestNavigationParams( 142 RequestNavigationParams::RequestNavigationParams(
144 bool is_overriding_user_agent, 143 bool is_overriding_user_agent,
145 const std::vector<GURL>& redirects, 144 const std::vector<GURL>& redirects,
146 bool can_load_local_resources, 145 bool can_load_local_resources,
147 const PageState& page_state, 146 const PageState& page_state,
148 int nav_entry_id, 147 int nav_entry_id,
148 bool is_same_document_navigation,
149 bool is_same_document_history_load, 149 bool is_same_document_history_load,
150 bool is_history_navigation_in_new_child, 150 bool is_history_navigation_in_new_child,
151 std::map<std::string, bool> subframe_unique_names, 151 std::map<std::string, bool> subframe_unique_names,
152 bool has_committed_real_load, 152 bool has_committed_real_load,
153 bool intended_as_new_entry, 153 bool intended_as_new_entry,
154 int pending_history_list_offset, 154 int pending_history_list_offset,
155 int current_history_list_offset, 155 int current_history_list_offset,
156 int current_history_list_length, 156 int current_history_list_length,
157 bool is_view_source, 157 bool is_view_source,
158 bool should_clear_history_list, 158 bool should_clear_history_list,
159 bool has_user_gesture) 159 bool has_user_gesture)
160 : is_overriding_user_agent(is_overriding_user_agent), 160 : is_overriding_user_agent(is_overriding_user_agent),
161 redirects(redirects), 161 redirects(redirects),
162 can_load_local_resources(can_load_local_resources), 162 can_load_local_resources(can_load_local_resources),
163 page_state(page_state), 163 page_state(page_state),
164 nav_entry_id(nav_entry_id), 164 nav_entry_id(nav_entry_id),
165 is_same_document_navigation(is_same_document_navigation),
165 is_same_document_history_load(is_same_document_history_load), 166 is_same_document_history_load(is_same_document_history_load),
166 is_history_navigation_in_new_child(is_history_navigation_in_new_child), 167 is_history_navigation_in_new_child(is_history_navigation_in_new_child),
167 subframe_unique_names(subframe_unique_names), 168 subframe_unique_names(subframe_unique_names),
168 has_committed_real_load(has_committed_real_load), 169 has_committed_real_load(has_committed_real_load),
169 intended_as_new_entry(intended_as_new_entry), 170 intended_as_new_entry(intended_as_new_entry),
170 pending_history_list_offset(pending_history_list_offset), 171 pending_history_list_offset(pending_history_list_offset),
171 current_history_list_offset(current_history_list_offset), 172 current_history_list_offset(current_history_list_offset),
172 current_history_list_length(current_history_list_length), 173 current_history_list_length(current_history_list_length),
173 is_view_source(is_view_source), 174 is_view_source(is_view_source),
174 should_clear_history_list(should_clear_history_list), 175 should_clear_history_list(should_clear_history_list),
(...skipping 15 matching lines...) Expand all
190 const RequestNavigationParams& request_params) 191 const RequestNavigationParams& request_params)
191 : common_params(common_params), 192 : common_params(common_params),
192 start_params(start_params), 193 start_params(start_params),
193 request_params(request_params) { 194 request_params(request_params) {
194 } 195 }
195 196
196 NavigationParams::~NavigationParams() { 197 NavigationParams::~NavigationParams() {
197 } 198 }
198 199
199 } // namespace content 200 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698