Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: content/common/navigation_params.cc

Issue 2484633004: Change Lo-Fi bool to bitmask to support multiple Previews types (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/previews_state.h"
nasko 2016/12/12 23:05:41 Why was this include removed? It is needed for Pre
megjablon 2016/12/14 01:10:32 Sorry didn't see these comments before. It was add
12 #include "content/public/common/url_constants.h" 13 #include "content/public/common/url_constants.h"
13 #include "url/gurl.h" 14 #include "url/gurl.h"
14 #include "url/url_constants.h" 15 #include "url/url_constants.h"
15 16
16 namespace content { 17 namespace content {
17 18
18 // PlzNavigate 19 // PlzNavigate
19 bool ShouldMakeNetworkRequestForURL(const GURL& url) { 20 bool ShouldMakeNetworkRequestForURL(const GURL& url) {
20 CHECK(IsBrowserSideNavigationEnabled()); 21 CHECK(IsBrowserSideNavigationEnabled());
21 22
22 // Javascript URLs, about:blank, srcdoc should not send a request 23 // Javascript URLs, about:blank, srcdoc should not send a request
23 // to the network stack. 24 // to the network stack.
24 // TODO(clamy): same document navigations should not send requests to the 25 // TODO(clamy): same document navigations should not send requests to the
25 // network stack. Neither should pushState/popState. 26 // network stack. Neither should pushState/popState.
26 return url != url::kAboutBlankURL && !url.SchemeIs(url::kJavaScriptScheme) && 27 return url != url::kAboutBlankURL && !url.SchemeIs(url::kJavaScriptScheme) &&
27 !url.is_empty() && !url.SchemeIs(url::kContentIDScheme) && 28 !url.is_empty() && !url.SchemeIs(url::kContentIDScheme) &&
28 url != content::kAboutSrcDocURL; 29 url != content::kAboutSrcDocURL;
29 } 30 }
30 31
31 CommonNavigationParams::CommonNavigationParams() 32 CommonNavigationParams::CommonNavigationParams()
32 : transition(ui::PAGE_TRANSITION_LINK), 33 : transition(ui::PAGE_TRANSITION_LINK),
33 navigation_type(FrameMsg_Navigate_Type::NORMAL), 34 navigation_type(FrameMsg_Navigate_Type::NORMAL),
34 gesture(NavigationGestureUnknown), 35 gesture(NavigationGestureUnknown),
35 allow_download(true), 36 allow_download(true),
36 should_replace_current_entry(false), 37 should_replace_current_entry(false),
37 report_type(FrameMsg_UILoadMetricsReportType::NO_REPORT), 38 report_type(FrameMsg_UILoadMetricsReportType::NO_REPORT),
38 lofi_state(LOFI_UNSPECIFIED), 39 previews_state(PREVIEWS_UNSPECIFIED),
39 navigation_start(base::TimeTicks::Now()), 40 navigation_start(base::TimeTicks::Now()),
40 method("GET") {} 41 method("GET") {}
41 42
42 CommonNavigationParams::CommonNavigationParams( 43 CommonNavigationParams::CommonNavigationParams(
43 const GURL& url, 44 const GURL& url,
44 const Referrer& referrer, 45 const Referrer& referrer,
45 ui::PageTransition transition, 46 ui::PageTransition transition,
46 FrameMsg_Navigate_Type::Value navigation_type, 47 FrameMsg_Navigate_Type::Value navigation_type,
47 NavigationGesture gesture, 48 NavigationGesture gesture,
48 bool allow_download, 49 bool allow_download,
49 bool should_replace_current_entry, 50 bool should_replace_current_entry,
50 base::TimeTicks ui_timestamp, 51 base::TimeTicks ui_timestamp,
51 FrameMsg_UILoadMetricsReportType::Value report_type, 52 FrameMsg_UILoadMetricsReportType::Value report_type,
52 const GURL& base_url_for_data_url, 53 const GURL& base_url_for_data_url,
53 const GURL& history_url_for_data_url, 54 const GURL& history_url_for_data_url,
54 LoFiState lofi_state, 55 int previews_state,
55 const base::TimeTicks& navigation_start, 56 const base::TimeTicks& navigation_start,
56 std::string method, 57 std::string method,
57 const scoped_refptr<ResourceRequestBodyImpl>& post_data) 58 const scoped_refptr<ResourceRequestBodyImpl>& post_data)
58 : url(url), 59 : url(url),
59 referrer(referrer), 60 referrer(referrer),
60 transition(transition), 61 transition(transition),
61 navigation_type(navigation_type), 62 navigation_type(navigation_type),
62 gesture(gesture), 63 gesture(gesture),
63 allow_download(allow_download), 64 allow_download(allow_download),
64 should_replace_current_entry(should_replace_current_entry), 65 should_replace_current_entry(should_replace_current_entry),
65 ui_timestamp(ui_timestamp), 66 ui_timestamp(ui_timestamp),
66 report_type(report_type), 67 report_type(report_type),
67 base_url_for_data_url(base_url_for_data_url), 68 base_url_for_data_url(base_url_for_data_url),
68 history_url_for_data_url(history_url_for_data_url), 69 history_url_for_data_url(history_url_for_data_url),
69 lofi_state(lofi_state), 70 previews_state(previews_state),
70 navigation_start(navigation_start), 71 navigation_start(navigation_start),
71 method(method), 72 method(method),
72 post_data(post_data) { 73 post_data(post_data) {
73 // |method != "POST"| should imply absence of |post_data|. 74 // |method != "POST"| should imply absence of |post_data|.
74 if (method != "POST" && post_data) { 75 if (method != "POST" && post_data) {
75 NOTREACHED(); 76 NOTREACHED();
76 this->post_data = nullptr; 77 this->post_data = nullptr;
77 } 78 }
78 } 79 }
79 80
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 const RequestNavigationParams& request_params) 186 const RequestNavigationParams& request_params)
186 : common_params(common_params), 187 : common_params(common_params),
187 start_params(start_params), 188 start_params(start_params),
188 request_params(request_params) { 189 request_params(request_params) {
189 } 190 }
190 191
191 NavigationParams::~NavigationParams() { 192 NavigationParams::~NavigationParams() {
192 } 193 }
193 194
194 } // namespace content 195 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698