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 | 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 | 24 // TODO(clamy): pushState/popState should not send requests to the |
clamy
2016/12/20 15:16:22
Can you remove the TODO entirely? pushState & popS
arthursonzogni
2016/12/21 10:11:08
Done.
| |
25 // network stack. Neither should pushState/popState. | 25 // network stack. |
26 return url != url::kAboutBlankURL && !url.SchemeIs(url::kJavaScriptScheme) && | 26 return url != url::kAboutBlankURL && !url.SchemeIs(url::kJavaScriptScheme) && |
27 !url.is_empty() && !url.SchemeIs(url::kContentIDScheme) && | 27 !url.is_empty() && !url.SchemeIs(url::kContentIDScheme) && |
28 url != content::kAboutSrcDocURL; | 28 url != content::kAboutSrcDocURL; |
29 } | 29 } |
30 | 30 |
31 CommonNavigationParams::CommonNavigationParams() | 31 CommonNavigationParams::CommonNavigationParams() |
32 : transition(ui::PAGE_TRANSITION_LINK), | 32 : transition(ui::PAGE_TRANSITION_LINK), |
33 navigation_type(FrameMsg_Navigate_Type::NORMAL), | 33 navigation_type(FrameMsg_Navigate_Type::NORMAL), |
34 allow_download(true), | 34 allow_download(true), |
35 should_replace_current_entry(false), | 35 should_replace_current_entry(false), |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 StartNavigationParams::StartNavigationParams( | 118 StartNavigationParams::StartNavigationParams( |
119 const StartNavigationParams& other) = default; | 119 const StartNavigationParams& other) = default; |
120 | 120 |
121 StartNavigationParams::~StartNavigationParams() { | 121 StartNavigationParams::~StartNavigationParams() { |
122 } | 122 } |
123 | 123 |
124 RequestNavigationParams::RequestNavigationParams() | 124 RequestNavigationParams::RequestNavigationParams() |
125 : is_overriding_user_agent(false), | 125 : is_overriding_user_agent(false), |
126 can_load_local_resources(false), | 126 can_load_local_resources(false), |
127 nav_entry_id(0), | 127 nav_entry_id(0), |
128 is_same_document_navigation(false), | |
128 is_same_document_history_load(false), | 129 is_same_document_history_load(false), |
129 is_history_navigation_in_new_child(false), | 130 is_history_navigation_in_new_child(false), |
130 has_committed_real_load(false), | 131 has_committed_real_load(false), |
131 intended_as_new_entry(false), | 132 intended_as_new_entry(false), |
132 pending_history_list_offset(-1), | 133 pending_history_list_offset(-1), |
133 current_history_list_offset(-1), | 134 current_history_list_offset(-1), |
134 current_history_list_length(0), | 135 current_history_list_length(0), |
135 is_view_source(false), | 136 is_view_source(false), |
136 should_clear_history_list(false), | 137 should_clear_history_list(false), |
137 should_create_service_worker(false), | 138 should_create_service_worker(false), |
138 service_worker_provider_id(kInvalidServiceWorkerProviderId), | 139 service_worker_provider_id(kInvalidServiceWorkerProviderId), |
139 appcache_host_id(kAppCacheNoHostId), | 140 appcache_host_id(kAppCacheNoHostId), |
140 has_user_gesture(false) { | 141 has_user_gesture(false) { |
141 } | 142 } |
142 | 143 |
143 RequestNavigationParams::RequestNavigationParams( | 144 RequestNavigationParams::RequestNavigationParams( |
144 bool is_overriding_user_agent, | 145 bool is_overriding_user_agent, |
145 const std::vector<GURL>& redirects, | 146 const std::vector<GURL>& redirects, |
146 bool can_load_local_resources, | 147 bool can_load_local_resources, |
147 const PageState& page_state, | 148 const PageState& page_state, |
148 int nav_entry_id, | 149 int nav_entry_id, |
150 bool is_same_document_navigation, | |
149 bool is_same_document_history_load, | 151 bool is_same_document_history_load, |
150 bool is_history_navigation_in_new_child, | 152 bool is_history_navigation_in_new_child, |
151 std::map<std::string, bool> subframe_unique_names, | 153 std::map<std::string, bool> subframe_unique_names, |
152 bool has_committed_real_load, | 154 bool has_committed_real_load, |
153 bool intended_as_new_entry, | 155 bool intended_as_new_entry, |
154 int pending_history_list_offset, | 156 int pending_history_list_offset, |
155 int current_history_list_offset, | 157 int current_history_list_offset, |
156 int current_history_list_length, | 158 int current_history_list_length, |
157 bool is_view_source, | 159 bool is_view_source, |
158 bool should_clear_history_list, | 160 bool should_clear_history_list, |
159 bool has_user_gesture) | 161 bool has_user_gesture) |
160 : is_overriding_user_agent(is_overriding_user_agent), | 162 : is_overriding_user_agent(is_overriding_user_agent), |
161 redirects(redirects), | 163 redirects(redirects), |
162 can_load_local_resources(can_load_local_resources), | 164 can_load_local_resources(can_load_local_resources), |
163 page_state(page_state), | 165 page_state(page_state), |
164 nav_entry_id(nav_entry_id), | 166 nav_entry_id(nav_entry_id), |
167 is_same_document_navigation(is_same_document_navigation), | |
165 is_same_document_history_load(is_same_document_history_load), | 168 is_same_document_history_load(is_same_document_history_load), |
166 is_history_navigation_in_new_child(is_history_navigation_in_new_child), | 169 is_history_navigation_in_new_child(is_history_navigation_in_new_child), |
167 subframe_unique_names(subframe_unique_names), | 170 subframe_unique_names(subframe_unique_names), |
168 has_committed_real_load(has_committed_real_load), | 171 has_committed_real_load(has_committed_real_load), |
169 intended_as_new_entry(intended_as_new_entry), | 172 intended_as_new_entry(intended_as_new_entry), |
170 pending_history_list_offset(pending_history_list_offset), | 173 pending_history_list_offset(pending_history_list_offset), |
171 current_history_list_offset(current_history_list_offset), | 174 current_history_list_offset(current_history_list_offset), |
172 current_history_list_length(current_history_list_length), | 175 current_history_list_length(current_history_list_length), |
173 is_view_source(is_view_source), | 176 is_view_source(is_view_source), |
174 should_clear_history_list(should_clear_history_list), | 177 should_clear_history_list(should_clear_history_list), |
(...skipping 15 matching lines...) Expand all Loading... | |
190 const RequestNavigationParams& request_params) | 193 const RequestNavigationParams& request_params) |
191 : common_params(common_params), | 194 : common_params(common_params), |
192 start_params(start_params), | 195 start_params(start_params), |
193 request_params(request_params) { | 196 request_params(request_params) { |
194 } | 197 } |
195 | 198 |
196 NavigationParams::~NavigationParams() { | 199 NavigationParams::~NavigationParams() { |
197 } | 200 } |
198 | 201 |
199 } // namespace content | 202 } // namespace content |
OLD | NEW |