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

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: add back previews_unspecified 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/browser_side_navigation_policy.h" 10 #include "content/public/common/browser_side_navigation_policy.h"
11 #include "content/public/common/previews_state.h"
11 #include "content/public/common/url_constants.h" 12 #include "content/public/common/url_constants.h"
12 #include "url/gurl.h" 13 #include "url/gurl.h"
13 #include "url/url_constants.h" 14 #include "url/url_constants.h"
14 15
15 namespace content { 16 namespace content {
16 17
17 // PlzNavigate 18 // PlzNavigate
18 bool ShouldMakeNetworkRequestForURL(const GURL& url) { 19 bool ShouldMakeNetworkRequestForURL(const GURL& url) {
19 CHECK(IsBrowserSideNavigationEnabled()); 20 CHECK(IsBrowserSideNavigationEnabled());
20 21
21 // Javascript URLs, about:blank, srcdoc should not send a request 22 // Javascript URLs, about:blank, srcdoc should not send a request
22 // to the network stack. 23 // to the network stack.
23 // TODO(clamy): same document navigations should not send requests to the 24 // TODO(clamy): same document navigations should not send requests to the
24 // network stack. Neither should pushState/popState. 25 // network stack. Neither should pushState/popState.
25 return url != url::kAboutBlankURL && !url.SchemeIs(url::kJavaScriptScheme) && 26 return url != url::kAboutBlankURL && !url.SchemeIs(url::kJavaScriptScheme) &&
26 !url.is_empty() && !url.SchemeIs(url::kContentIDScheme) && 27 !url.is_empty() && !url.SchemeIs(url::kContentIDScheme) &&
27 url != content::kAboutSrcDocURL; 28 url != 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 gesture(NavigationGestureUnknown), 34 gesture(NavigationGestureUnknown),
34 allow_download(true), 35 allow_download(true),
35 should_replace_current_entry(false), 36 should_replace_current_entry(false),
36 report_type(FrameMsg_UILoadMetricsReportType::NO_REPORT), 37 report_type(FrameMsg_UILoadMetricsReportType::NO_REPORT),
37 lofi_state(LOFI_UNSPECIFIED), 38 previews_state(PREVIEWS_UNSPECIFIED),
38 navigation_start(base::TimeTicks::Now()), 39 navigation_start(base::TimeTicks::Now()),
39 method("GET") {} 40 method("GET") {}
40 41
41 CommonNavigationParams::CommonNavigationParams( 42 CommonNavigationParams::CommonNavigationParams(
42 const GURL& url, 43 const GURL& url,
43 const Referrer& referrer, 44 const Referrer& referrer,
44 ui::PageTransition transition, 45 ui::PageTransition transition,
45 FrameMsg_Navigate_Type::Value navigation_type, 46 FrameMsg_Navigate_Type::Value navigation_type,
46 NavigationGesture gesture, 47 NavigationGesture gesture,
47 bool allow_download, 48 bool allow_download,
48 bool should_replace_current_entry, 49 bool should_replace_current_entry,
49 base::TimeTicks ui_timestamp, 50 base::TimeTicks ui_timestamp,
50 FrameMsg_UILoadMetricsReportType::Value report_type, 51 FrameMsg_UILoadMetricsReportType::Value report_type,
51 const GURL& base_url_for_data_url, 52 const GURL& base_url_for_data_url,
52 const GURL& history_url_for_data_url, 53 const GURL& history_url_for_data_url,
53 LoFiState lofi_state, 54 int previews_state,
nasko 2016/12/08 22:19:33 PreviewsState
megjablon 2016/12/09 20:35:54 Done.
54 const base::TimeTicks& navigation_start, 55 const base::TimeTicks& navigation_start,
55 std::string method, 56 std::string method,
56 const scoped_refptr<ResourceRequestBodyImpl>& post_data) 57 const scoped_refptr<ResourceRequestBodyImpl>& post_data)
57 : url(url), 58 : url(url),
58 referrer(referrer), 59 referrer(referrer),
59 transition(transition), 60 transition(transition),
60 navigation_type(navigation_type), 61 navigation_type(navigation_type),
61 gesture(gesture), 62 gesture(gesture),
62 allow_download(allow_download), 63 allow_download(allow_download),
63 should_replace_current_entry(should_replace_current_entry), 64 should_replace_current_entry(should_replace_current_entry),
64 ui_timestamp(ui_timestamp), 65 ui_timestamp(ui_timestamp),
65 report_type(report_type), 66 report_type(report_type),
66 base_url_for_data_url(base_url_for_data_url), 67 base_url_for_data_url(base_url_for_data_url),
67 history_url_for_data_url(history_url_for_data_url), 68 history_url_for_data_url(history_url_for_data_url),
68 lofi_state(lofi_state), 69 previews_state(previews_state),
69 navigation_start(navigation_start), 70 navigation_start(navigation_start),
70 method(method), 71 method(method),
71 post_data(post_data) { 72 post_data(post_data) {
72 // |method != "POST"| should imply absence of |post_data|. 73 // |method != "POST"| should imply absence of |post_data|.
73 if (method != "POST" && post_data) { 74 if (method != "POST" && post_data) {
74 NOTREACHED(); 75 NOTREACHED();
75 this->post_data = nullptr; 76 this->post_data = nullptr;
76 } 77 }
77 } 78 }
78 79
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 const RequestNavigationParams& request_params) 183 const RequestNavigationParams& request_params)
183 : common_params(common_params), 184 : common_params(common_params),
184 start_params(start_params), 185 start_params(start_params),
185 request_params(request_params) { 186 request_params(request_params) {
186 } 187 }
187 188
188 NavigationParams::~NavigationParams() { 189 NavigationParams::~NavigationParams() {
189 } 190 }
190 191
191 } // namespace content 192 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698