| 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 | |
| 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::UNSPECIFIED), |
| 34 allow_download(true), | 32 allow_download(true), |
| 35 should_replace_current_entry(false), | 33 should_replace_current_entry(false), |
| 36 report_type(FrameMsg_UILoadMetricsReportType::NO_REPORT), | 34 report_type(FrameMsg_UILoadMetricsReportType::NO_REPORT), |
| 37 previews_state(PREVIEWS_UNSPECIFIED), | 35 previews_state(PREVIEWS_UNSPECIFIED), |
| 38 navigation_start(base::TimeTicks::Now()), | 36 navigation_start(base::TimeTicks::Now()), |
| 39 method("GET") {} | 37 method("GET") {} |
| 40 | 38 |
| 41 CommonNavigationParams::CommonNavigationParams( | 39 CommonNavigationParams::CommonNavigationParams( |
| 42 const GURL& url, | 40 const GURL& url, |
| 43 const Referrer& referrer, | 41 const Referrer& referrer, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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), |
| 136 is_same_document_history_load(false), | |
| 137 is_history_navigation_in_new_child(false), | 134 is_history_navigation_in_new_child(false), |
| 138 has_committed_real_load(false), | 135 has_committed_real_load(false), |
| 139 intended_as_new_entry(false), | 136 intended_as_new_entry(false), |
| 140 pending_history_list_offset(-1), | 137 pending_history_list_offset(-1), |
| 141 current_history_list_offset(-1), | 138 current_history_list_offset(-1), |
| 142 current_history_list_length(0), | 139 current_history_list_length(0), |
| 143 is_view_source(false), | 140 is_view_source(false), |
| 144 should_clear_history_list(false), | 141 should_clear_history_list(false), |
| 145 should_create_service_worker(false), | 142 should_create_service_worker(false), |
| 146 service_worker_provider_id(kInvalidServiceWorkerProviderId), | 143 service_worker_provider_id(kInvalidServiceWorkerProviderId), |
| 147 appcache_host_id(kAppCacheNoHostId), | 144 appcache_host_id(kAppCacheNoHostId), |
| 148 has_user_gesture(false) { | 145 has_user_gesture(false) { |
| 149 } | 146 } |
| 150 | 147 |
| 151 RequestNavigationParams::RequestNavigationParams( | 148 RequestNavigationParams::RequestNavigationParams( |
| 152 bool is_overriding_user_agent, | 149 bool is_overriding_user_agent, |
| 153 const std::vector<GURL>& redirects, | 150 const std::vector<GURL>& redirects, |
| 154 bool can_load_local_resources, | 151 bool can_load_local_resources, |
| 155 const PageState& page_state, | 152 const PageState& page_state, |
| 156 int nav_entry_id, | 153 int nav_entry_id, |
| 157 bool is_same_document_history_load, | |
| 158 bool is_history_navigation_in_new_child, | 154 bool is_history_navigation_in_new_child, |
| 159 std::map<std::string, bool> subframe_unique_names, | 155 std::map<std::string, bool> subframe_unique_names, |
| 160 bool has_committed_real_load, | 156 bool has_committed_real_load, |
| 161 bool intended_as_new_entry, | 157 bool intended_as_new_entry, |
| 162 int pending_history_list_offset, | 158 int pending_history_list_offset, |
| 163 int current_history_list_offset, | 159 int current_history_list_offset, |
| 164 int current_history_list_length, | 160 int current_history_list_length, |
| 165 bool is_view_source, | 161 bool is_view_source, |
| 166 bool should_clear_history_list, | 162 bool should_clear_history_list, |
| 167 bool has_user_gesture) | 163 bool has_user_gesture) |
| 168 : is_overriding_user_agent(is_overriding_user_agent), | 164 : is_overriding_user_agent(is_overriding_user_agent), |
| 169 redirects(redirects), | 165 redirects(redirects), |
| 170 can_load_local_resources(can_load_local_resources), | 166 can_load_local_resources(can_load_local_resources), |
| 171 page_state(page_state), | 167 page_state(page_state), |
| 172 nav_entry_id(nav_entry_id), | 168 nav_entry_id(nav_entry_id), |
| 173 is_same_document_history_load(is_same_document_history_load), | |
| 174 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), |
| 175 subframe_unique_names(subframe_unique_names), | 170 subframe_unique_names(subframe_unique_names), |
| 176 has_committed_real_load(has_committed_real_load), | 171 has_committed_real_load(has_committed_real_load), |
| 177 intended_as_new_entry(intended_as_new_entry), | 172 intended_as_new_entry(intended_as_new_entry), |
| 178 pending_history_list_offset(pending_history_list_offset), | 173 pending_history_list_offset(pending_history_list_offset), |
| 179 current_history_list_offset(current_history_list_offset), | 174 current_history_list_offset(current_history_list_offset), |
| 180 current_history_list_length(current_history_list_length), | 175 current_history_list_length(current_history_list_length), |
| 181 is_view_source(is_view_source), | 176 is_view_source(is_view_source), |
| 182 should_clear_history_list(should_clear_history_list), | 177 should_clear_history_list(should_clear_history_list), |
| 183 should_create_service_worker(false), | 178 should_create_service_worker(false), |
| (...skipping 14 matching lines...) Expand all Loading... |
| 198 const RequestNavigationParams& request_params) | 193 const RequestNavigationParams& request_params) |
| 199 : common_params(common_params), | 194 : common_params(common_params), |
| 200 start_params(start_params), | 195 start_params(start_params), |
| 201 request_params(request_params) { | 196 request_params(request_params) { |
| 202 } | 197 } |
| 203 | 198 |
| 204 NavigationParams::~NavigationParams() { | 199 NavigationParams::~NavigationParams() { |
| 205 } | 200 } |
| 206 | 201 |
| 207 } // namespace content | 202 } // namespace content |
| OLD | NEW |