Chromium Code Reviews| 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/browser_side_navigation_policy.h" | 10 #include "content/public/common/browser_side_navigation_policy.h" |
| 11 #include "content/public/common/url_constants.h" | 11 #include "content/public/common/url_constants.h" |
| 12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 13 #include "url/url_constants.h" | 13 #include "url/url_constants.h" |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 | 16 |
| 17 // PlzNavigate | 17 // PlzNavigate |
| 18 bool ShouldMakeNetworkRequestForURL(const GURL& url) { | 18 bool ShouldMakeNetworkRequestForURL(const GURL& url) { |
|
Mike West
2016/06/24 09:08:32
Would you mind adding a unit test for this method?
blundell
2016/06/27 14:00:58
Done.
| |
| 19 CHECK(IsBrowserSideNavigationEnabled()); | 19 CHECK(IsBrowserSideNavigationEnabled()); |
| 20 | 20 |
| 21 // Data URLs, Javascript URLs, about:blank, srcdoc should not send a request | 21 // Data URLs, Javascript URLs, about:blank, srcdoc should not send a request |
| 22 // to the network stack. | 22 // to the network stack. |
| 23 // TODO(clamy): same document navigations should not send requests to the | 23 // TODO(clamy): same document navigations should not send requests to the |
| 24 // network stack. Neither should pushState/popState. | 24 // network stack. Neither should pushState/popState. |
| 25 return !url.SchemeIs(url::kDataScheme) && url != GURL(url::kAboutBlankURL) && | 25 return !url.SchemeIs(url::kDataScheme) && url != GURL(url::kAboutBlankURL) && |
| 26 !url.SchemeIs(url::kJavaScriptScheme) && !url.is_empty() && | 26 !url.SchemeIs(url::kJavaScriptScheme) && !url.is_empty() && |
| 27 !url.SchemeIs(url::kContentIDScheme) && | |
| 27 url != GURL(content::kAboutSrcDocURL); | 28 url != GURL(content::kAboutSrcDocURL); |
| 28 } | 29 } |
| 29 | 30 |
| 30 CommonNavigationParams::CommonNavigationParams() | 31 CommonNavigationParams::CommonNavigationParams() |
| 31 : transition(ui::PAGE_TRANSITION_LINK), | 32 : transition(ui::PAGE_TRANSITION_LINK), |
| 32 navigation_type(FrameMsg_Navigate_Type::NORMAL), | 33 navigation_type(FrameMsg_Navigate_Type::NORMAL), |
| 33 allow_download(true), | 34 allow_download(true), |
| 34 should_replace_current_entry(false), | 35 should_replace_current_entry(false), |
| 35 report_type(FrameMsg_UILoadMetricsReportType::NO_REPORT), | 36 report_type(FrameMsg_UILoadMetricsReportType::NO_REPORT), |
| 36 lofi_state(LOFI_UNSPECIFIED), | 37 lofi_state(LOFI_UNSPECIFIED), |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 const RequestNavigationParams& request_params) | 194 const RequestNavigationParams& request_params) |
| 194 : common_params(common_params), | 195 : common_params(common_params), |
| 195 start_params(start_params), | 196 start_params(start_params), |
| 196 request_params(request_params) { | 197 request_params(request_params) { |
| 197 } | 198 } |
| 198 | 199 |
| 199 NavigationParams::~NavigationParams() { | 200 NavigationParams::~NavigationParams() { |
| 200 } | 201 } |
| 201 | 202 |
| 202 } // namespace content | 203 } // namespace content |
| OLD | NEW |