OLD | NEW |
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 #include "url/url_util.h" | 15 #include "url/url_util.h" |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 | 18 |
19 // PlzNavigate | 19 // PlzNavigate |
20 bool ShouldMakeNetworkRequestForURL(const GURL& url) { | 20 bool ShouldMakeNetworkRequestForURL(const GURL& url) { |
21 CHECK(IsBrowserSideNavigationEnabled()); | 21 CHECK(IsBrowserSideNavigationEnabled()); |
22 | 22 |
23 // Javascript URLs, about:blank, srcdoc should not send a request | 23 // Javascript URLs, about:blank, srcdoc should not send a request |
24 // to the network stack. | 24 // to the network stack. |
25 // TODO(clamy): same document navigations should not send requests to the | |
26 // network stack. Neither should pushState/popState. | |
27 return !url::IsAboutBlank(url) && !url.SchemeIs(url::kJavaScriptScheme) && | 25 return !url::IsAboutBlank(url) && !url.SchemeIs(url::kJavaScriptScheme) && |
28 !url.is_empty() && !url.SchemeIs(url::kContentIDScheme) && | 26 !url.is_empty() && !url.SchemeIs(url::kContentIDScheme) && |
29 url != content::kAboutSrcDocURL; | 27 url != content::kAboutSrcDocURL; |
30 } | 28 } |
31 | 29 |
32 CommonNavigationParams::CommonNavigationParams() | 30 CommonNavigationParams::CommonNavigationParams() |
33 : transition(ui::PAGE_TRANSITION_LINK), | 31 : transition(ui::PAGE_TRANSITION_LINK), |
34 navigation_type(FrameMsg_Navigate_Type::NORMAL), | 32 navigation_type(FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT), |
35 allow_download(true), | 33 allow_download(true), |
36 should_replace_current_entry(false), | 34 should_replace_current_entry(false), |
37 report_type(FrameMsg_UILoadMetricsReportType::NO_REPORT), | 35 report_type(FrameMsg_UILoadMetricsReportType::NO_REPORT), |
38 previews_state(PREVIEWS_UNSPECIFIED), | 36 previews_state(PREVIEWS_UNSPECIFIED), |
39 navigation_start(base::TimeTicks::Now()), | 37 navigation_start(base::TimeTicks::Now()), |
40 method("GET") {} | 38 method("GET") {} |
41 | 39 |
42 CommonNavigationParams::CommonNavigationParams( | 40 CommonNavigationParams::CommonNavigationParams( |
43 const GURL& url, | 41 const GURL& url, |
44 const Referrer& referrer, | 42 const Referrer& referrer, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 StartNavigationParams::StartNavigationParams( | 125 StartNavigationParams::StartNavigationParams( |
128 const StartNavigationParams& other) = default; | 126 const StartNavigationParams& other) = default; |
129 | 127 |
130 StartNavigationParams::~StartNavigationParams() { | 128 StartNavigationParams::~StartNavigationParams() { |
131 } | 129 } |
132 | 130 |
133 RequestNavigationParams::RequestNavigationParams() | 131 RequestNavigationParams::RequestNavigationParams() |
134 : is_overriding_user_agent(false), | 132 : is_overriding_user_agent(false), |
135 can_load_local_resources(false), | 133 can_load_local_resources(false), |
136 nav_entry_id(0), | 134 nav_entry_id(0), |
137 is_same_document_history_load(false), | |
138 is_history_navigation_in_new_child(false), | 135 is_history_navigation_in_new_child(false), |
139 has_committed_real_load(false), | 136 has_committed_real_load(false), |
140 intended_as_new_entry(false), | 137 intended_as_new_entry(false), |
141 pending_history_list_offset(-1), | 138 pending_history_list_offset(-1), |
142 current_history_list_offset(-1), | 139 current_history_list_offset(-1), |
143 current_history_list_length(0), | 140 current_history_list_length(0), |
144 is_view_source(false), | 141 is_view_source(false), |
145 should_clear_history_list(false), | 142 should_clear_history_list(false), |
146 should_create_service_worker(false), | 143 should_create_service_worker(false), |
147 service_worker_provider_id(kInvalidServiceWorkerProviderId), | 144 service_worker_provider_id(kInvalidServiceWorkerProviderId), |
148 appcache_host_id(kAppCacheNoHostId), | 145 appcache_host_id(kAppCacheNoHostId), |
149 has_user_gesture(false) { | 146 has_user_gesture(false) { |
150 } | 147 } |
151 | 148 |
152 RequestNavigationParams::RequestNavigationParams( | 149 RequestNavigationParams::RequestNavigationParams( |
153 bool is_overriding_user_agent, | 150 bool is_overriding_user_agent, |
154 const std::vector<GURL>& redirects, | 151 const std::vector<GURL>& redirects, |
155 bool can_load_local_resources, | 152 bool can_load_local_resources, |
156 const PageState& page_state, | 153 const PageState& page_state, |
157 int nav_entry_id, | 154 int nav_entry_id, |
158 bool is_same_document_history_load, | |
159 bool is_history_navigation_in_new_child, | 155 bool is_history_navigation_in_new_child, |
160 std::map<std::string, bool> subframe_unique_names, | 156 std::map<std::string, bool> subframe_unique_names, |
161 bool has_committed_real_load, | 157 bool has_committed_real_load, |
162 bool intended_as_new_entry, | 158 bool intended_as_new_entry, |
163 int pending_history_list_offset, | 159 int pending_history_list_offset, |
164 int current_history_list_offset, | 160 int current_history_list_offset, |
165 int current_history_list_length, | 161 int current_history_list_length, |
166 bool is_view_source, | 162 bool is_view_source, |
167 bool should_clear_history_list, | 163 bool should_clear_history_list, |
168 bool has_user_gesture) | 164 bool has_user_gesture) |
169 : is_overriding_user_agent(is_overriding_user_agent), | 165 : is_overriding_user_agent(is_overriding_user_agent), |
170 redirects(redirects), | 166 redirects(redirects), |
171 can_load_local_resources(can_load_local_resources), | 167 can_load_local_resources(can_load_local_resources), |
172 page_state(page_state), | 168 page_state(page_state), |
173 nav_entry_id(nav_entry_id), | 169 nav_entry_id(nav_entry_id), |
174 is_same_document_history_load(is_same_document_history_load), | |
175 is_history_navigation_in_new_child(is_history_navigation_in_new_child), | 170 is_history_navigation_in_new_child(is_history_navigation_in_new_child), |
176 subframe_unique_names(subframe_unique_names), | 171 subframe_unique_names(subframe_unique_names), |
177 has_committed_real_load(has_committed_real_load), | 172 has_committed_real_load(has_committed_real_load), |
178 intended_as_new_entry(intended_as_new_entry), | 173 intended_as_new_entry(intended_as_new_entry), |
179 pending_history_list_offset(pending_history_list_offset), | 174 pending_history_list_offset(pending_history_list_offset), |
180 current_history_list_offset(current_history_list_offset), | 175 current_history_list_offset(current_history_list_offset), |
181 current_history_list_length(current_history_list_length), | 176 current_history_list_length(current_history_list_length), |
182 is_view_source(is_view_source), | 177 is_view_source(is_view_source), |
183 should_clear_history_list(should_clear_history_list), | 178 should_clear_history_list(should_clear_history_list), |
184 should_create_service_worker(false), | 179 should_create_service_worker(false), |
(...skipping 14 matching lines...) Expand all Loading... |
199 const RequestNavigationParams& request_params) | 194 const RequestNavigationParams& request_params) |
200 : common_params(common_params), | 195 : common_params(common_params), |
201 start_params(start_params), | 196 start_params(start_params), |
202 request_params(request_params) { | 197 request_params(request_params) { |
203 } | 198 } |
204 | 199 |
205 NavigationParams::~NavigationParams() { | 200 NavigationParams::~NavigationParams() { |
206 } | 201 } |
207 | 202 |
208 } // namespace content | 203 } // namespace content |
OLD | NEW |