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/command_line.h" |
7 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
| 9 #include "content/public/common/content_switches.h" |
8 | 10 |
9 namespace content { | 11 namespace content { |
10 | 12 |
| 13 // PlzNavigate |
| 14 bool ShouldMakeNetworkRequestForURL(const GURL& url) { |
| 15 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 16 switches::kEnableBrowserSideNavigation)); |
| 17 |
| 18 // Data URLs, Javascript URLs and about:blank should not send a request to the |
| 19 // network stack. |
| 20 // TODO(clamy): same document navigations should not send requests to the |
| 21 // network stack. Neither should pushState/popState. |
| 22 return !url.SchemeIs(url::kDataScheme) && url != GURL(url::kAboutBlankURL) && |
| 23 !url.SchemeIs(url::kJavaScriptScheme); |
| 24 } |
| 25 |
11 CommonNavigationParams::CommonNavigationParams() | 26 CommonNavigationParams::CommonNavigationParams() |
12 : transition(ui::PAGE_TRANSITION_LINK), | 27 : transition(ui::PAGE_TRANSITION_LINK), |
13 navigation_type(FrameMsg_Navigate_Type::NORMAL), | 28 navigation_type(FrameMsg_Navigate_Type::NORMAL), |
14 allow_download(true), | 29 allow_download(true), |
15 report_type(FrameMsg_UILoadMetricsReportType::NO_REPORT) { | 30 report_type(FrameMsg_UILoadMetricsReportType::NO_REPORT) { |
16 } | 31 } |
17 | 32 |
18 CommonNavigationParams::CommonNavigationParams( | 33 CommonNavigationParams::CommonNavigationParams( |
19 const GURL& url, | 34 const GURL& url, |
20 const Referrer& referrer, | 35 const Referrer& referrer, |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 const RequestNavigationParams& request_params) | 151 const RequestNavigationParams& request_params) |
137 : common_params(common_params), | 152 : common_params(common_params), |
138 start_params(start_params), | 153 start_params(start_params), |
139 request_params(request_params) { | 154 request_params(request_params) { |
140 } | 155 } |
141 | 156 |
142 NavigationParams::~NavigationParams() { | 157 NavigationParams::~NavigationParams() { |
143 } | 158 } |
144 | 159 |
145 } // namespace content | 160 } // namespace content |
OLD | NEW |