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

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

Issue 1182453002: PlzNavigate: support for should_replace_current_entry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Charlie's comments Created 5 years, 4 months 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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/ref_counted_memory.h" 8 #include "base/memory/ref_counted_memory.h"
9 #include "content/public/common/content_switches.h" 9 #include "content/public/common/content_switches.h"
10 10
11 namespace content { 11 namespace content {
12 12
13 // PlzNavigate 13 // PlzNavigate
14 bool ShouldMakeNetworkRequestForURL(const GURL& url) { 14 bool ShouldMakeNetworkRequestForURL(const GURL& url) {
15 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( 15 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
16 switches::kEnableBrowserSideNavigation)); 16 switches::kEnableBrowserSideNavigation));
17 17
18 // Data URLs, Javascript URLs and about:blank should not send a request to the 18 // Data URLs, Javascript URLs and about:blank should not send a request to the
19 // network stack. 19 // network stack.
20 // TODO(clamy): same document navigations should not send requests to the 20 // TODO(clamy): same document navigations should not send requests to the
21 // network stack. Neither should pushState/popState. 21 // network stack. Neither should pushState/popState.
22 return !url.SchemeIs(url::kDataScheme) && url != GURL(url::kAboutBlankURL) && 22 return !url.SchemeIs(url::kDataScheme) && url != GURL(url::kAboutBlankURL) &&
23 !url.SchemeIs(url::kJavaScriptScheme); 23 !url.SchemeIs(url::kJavaScriptScheme);
24 } 24 }
25 25
26 CommonNavigationParams::CommonNavigationParams() 26 CommonNavigationParams::CommonNavigationParams()
27 : transition(ui::PAGE_TRANSITION_LINK), 27 : transition(ui::PAGE_TRANSITION_LINK),
28 navigation_type(FrameMsg_Navigate_Type::NORMAL), 28 navigation_type(FrameMsg_Navigate_Type::NORMAL),
29 allow_download(true), 29 allow_download(true),
30 should_replace_current_entry(false),
30 report_type(FrameMsg_UILoadMetricsReportType::NO_REPORT) { 31 report_type(FrameMsg_UILoadMetricsReportType::NO_REPORT) {
31 } 32 }
32 33
33 CommonNavigationParams::CommonNavigationParams( 34 CommonNavigationParams::CommonNavigationParams(
34 const GURL& url, 35 const GURL& url,
35 const Referrer& referrer, 36 const Referrer& referrer,
36 ui::PageTransition transition, 37 ui::PageTransition transition,
37 FrameMsg_Navigate_Type::Value navigation_type, 38 FrameMsg_Navigate_Type::Value navigation_type,
38 bool allow_download, 39 bool allow_download,
40 bool should_replace_current_entry,
39 base::TimeTicks ui_timestamp, 41 base::TimeTicks ui_timestamp,
40 FrameMsg_UILoadMetricsReportType::Value report_type, 42 FrameMsg_UILoadMetricsReportType::Value report_type,
41 const GURL& base_url_for_data_url, 43 const GURL& base_url_for_data_url,
42 const GURL& history_url_for_data_url) 44 const GURL& history_url_for_data_url)
43 : url(url), 45 : url(url),
44 referrer(referrer), 46 referrer(referrer),
45 transition(transition), 47 transition(transition),
46 navigation_type(navigation_type), 48 navigation_type(navigation_type),
47 allow_download(allow_download), 49 allow_download(allow_download),
50 should_replace_current_entry(should_replace_current_entry),
48 ui_timestamp(ui_timestamp), 51 ui_timestamp(ui_timestamp),
49 report_type(report_type), 52 report_type(report_type),
50 base_url_for_data_url(base_url_for_data_url), 53 base_url_for_data_url(base_url_for_data_url),
51 history_url_for_data_url(history_url_for_data_url) { 54 history_url_for_data_url(history_url_for_data_url) {
52 } 55 }
53 56
54 CommonNavigationParams::~CommonNavigationParams() { 57 CommonNavigationParams::~CommonNavigationParams() {
55 } 58 }
56 59
57 BeginNavigationParams::BeginNavigationParams() 60 BeginNavigationParams::BeginNavigationParams()
58 : load_flags(0), has_user_gesture(false) { 61 : load_flags(0), has_user_gesture(false) {
59 } 62 }
60 63
61 BeginNavigationParams::BeginNavigationParams(std::string method, 64 BeginNavigationParams::BeginNavigationParams(std::string method,
62 std::string headers, 65 std::string headers,
63 int load_flags, 66 int load_flags,
64 bool has_user_gesture) 67 bool has_user_gesture)
65 : method(method), 68 : method(method),
66 headers(headers), 69 headers(headers),
67 load_flags(load_flags), 70 load_flags(load_flags),
68 has_user_gesture(has_user_gesture) { 71 has_user_gesture(has_user_gesture) {
69 } 72 }
70 73
71 StartNavigationParams::StartNavigationParams() 74 StartNavigationParams::StartNavigationParams()
72 : is_post(false), 75 : is_post(false),
73 should_replace_current_entry(false),
74 transferred_request_child_id(-1), 76 transferred_request_child_id(-1),
75 transferred_request_request_id(-1) { 77 transferred_request_request_id(-1) {
76 } 78 }
77 79
78 StartNavigationParams::StartNavigationParams( 80 StartNavigationParams::StartNavigationParams(
79 bool is_post, 81 bool is_post,
80 const std::string& extra_headers, 82 const std::string& extra_headers,
81 const std::vector<unsigned char>& browser_initiated_post_data, 83 const std::vector<unsigned char>& browser_initiated_post_data,
82 bool should_replace_current_entry,
83 int transferred_request_child_id, 84 int transferred_request_child_id,
84 int transferred_request_request_id) 85 int transferred_request_request_id)
85 : is_post(is_post), 86 : is_post(is_post),
86 extra_headers(extra_headers), 87 extra_headers(extra_headers),
87 browser_initiated_post_data(browser_initiated_post_data), 88 browser_initiated_post_data(browser_initiated_post_data),
88 should_replace_current_entry(should_replace_current_entry),
89 transferred_request_child_id(transferred_request_child_id), 89 transferred_request_child_id(transferred_request_child_id),
90 transferred_request_request_id(transferred_request_request_id) { 90 transferred_request_request_id(transferred_request_request_id) {
91 } 91 }
92 92
93 StartNavigationParams::~StartNavigationParams() { 93 StartNavigationParams::~StartNavigationParams() {
94 } 94 }
95 95
96 RequestNavigationParams::RequestNavigationParams() 96 RequestNavigationParams::RequestNavigationParams()
97 : is_overriding_user_agent(false), 97 : is_overriding_user_agent(false),
98 browser_navigation_start(base::TimeTicks::Now()), 98 browser_navigation_start(base::TimeTicks::Now()),
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 const RequestNavigationParams& request_params) 151 const RequestNavigationParams& request_params)
152 : common_params(common_params), 152 : common_params(common_params),
153 start_params(start_params), 153 start_params(start_params),
154 request_params(request_params) { 154 request_params(request_params) {
155 } 155 }
156 156
157 NavigationParams::~NavigationParams() { 157 NavigationParams::~NavigationParams() {
158 } 158 }
159 159
160 } // namespace content 160 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698