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

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

Issue 2499313003: Set user_gesture bit at NavigationHandle creation time. (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
« no previous file with comments | « content/common/navigation_params.h ('k') | content/public/browser/navigation_handle.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 12 matching lines...) Expand all
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 != url::kAboutBlankURL && !url.SchemeIs(url::kJavaScriptScheme) && 25 return url != url::kAboutBlankURL && !url.SchemeIs(url::kJavaScriptScheme) &&
26 !url.is_empty() && !url.SchemeIs(url::kContentIDScheme) && 26 !url.is_empty() && !url.SchemeIs(url::kContentIDScheme) &&
27 url != content::kAboutSrcDocURL; 27 url != content::kAboutSrcDocURL;
28 } 28 }
29 29
30 CommonNavigationParams::CommonNavigationParams() 30 CommonNavigationParams::CommonNavigationParams()
31 : transition(ui::PAGE_TRANSITION_LINK), 31 : transition(ui::PAGE_TRANSITION_LINK),
32 navigation_type(FrameMsg_Navigate_Type::NORMAL), 32 navigation_type(FrameMsg_Navigate_Type::NORMAL),
33 gesture(NavigationGestureUnknown),
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),
37 navigation_start(base::TimeTicks::Now()), 38 navigation_start(base::TimeTicks::Now()),
38 method("GET") {} 39 method("GET") {}
39 40
40 CommonNavigationParams::CommonNavigationParams( 41 CommonNavigationParams::CommonNavigationParams(
41 const GURL& url, 42 const GURL& url,
42 const Referrer& referrer, 43 const Referrer& referrer,
43 ui::PageTransition transition, 44 ui::PageTransition transition,
44 FrameMsg_Navigate_Type::Value navigation_type, 45 FrameMsg_Navigate_Type::Value navigation_type,
46 NavigationGesture gesture,
45 bool allow_download, 47 bool allow_download,
46 bool should_replace_current_entry, 48 bool should_replace_current_entry,
47 base::TimeTicks ui_timestamp, 49 base::TimeTicks ui_timestamp,
48 FrameMsg_UILoadMetricsReportType::Value report_type, 50 FrameMsg_UILoadMetricsReportType::Value report_type,
49 const GURL& base_url_for_data_url, 51 const GURL& base_url_for_data_url,
50 const GURL& history_url_for_data_url, 52 const GURL& history_url_for_data_url,
51 LoFiState lofi_state, 53 LoFiState lofi_state,
52 const base::TimeTicks& navigation_start, 54 const base::TimeTicks& navigation_start,
53 std::string method, 55 std::string method,
54 const scoped_refptr<ResourceRequestBodyImpl>& post_data) 56 const scoped_refptr<ResourceRequestBodyImpl>& post_data)
55 : url(url), 57 : url(url),
56 referrer(referrer), 58 referrer(referrer),
57 transition(transition), 59 transition(transition),
58 navigation_type(navigation_type), 60 navigation_type(navigation_type),
61 gesture(gesture),
59 allow_download(allow_download), 62 allow_download(allow_download),
60 should_replace_current_entry(should_replace_current_entry), 63 should_replace_current_entry(should_replace_current_entry),
61 ui_timestamp(ui_timestamp), 64 ui_timestamp(ui_timestamp),
62 report_type(report_type), 65 report_type(report_type),
63 base_url_for_data_url(base_url_for_data_url), 66 base_url_for_data_url(base_url_for_data_url),
64 history_url_for_data_url(history_url_for_data_url), 67 history_url_for_data_url(history_url_for_data_url),
65 lofi_state(lofi_state), 68 lofi_state(lofi_state),
66 navigation_start(navigation_start), 69 navigation_start(navigation_start),
67 method(method), 70 method(method),
68 post_data(post_data) { 71 post_data(post_data) {
69 // |method != "POST"| should imply absence of |post_data|. 72 // |method != "POST"| should imply absence of |post_data|.
70 if (method != "POST" && post_data) { 73 if (method != "POST" && post_data) {
71 NOTREACHED(); 74 NOTREACHED();
72 this->post_data = nullptr; 75 this->post_data = nullptr;
73 } 76 }
74 } 77 }
75 78
76 CommonNavigationParams::CommonNavigationParams( 79 CommonNavigationParams::CommonNavigationParams(
77 const CommonNavigationParams& other) = default; 80 const CommonNavigationParams& other) = default;
78 81
79 CommonNavigationParams::~CommonNavigationParams() { 82 CommonNavigationParams::~CommonNavigationParams() {
80 } 83 }
81 84
82 BeginNavigationParams::BeginNavigationParams() 85 BeginNavigationParams::BeginNavigationParams()
83 : load_flags(0), 86 : load_flags(0),
84 has_user_gesture(false),
85 skip_service_worker(false), 87 skip_service_worker(false),
86 request_context_type(REQUEST_CONTEXT_TYPE_LOCATION) {} 88 request_context_type(REQUEST_CONTEXT_TYPE_LOCATION) {}
87 89
88 BeginNavigationParams::BeginNavigationParams( 90 BeginNavigationParams::BeginNavigationParams(
89 std::string headers, 91 std::string headers,
90 int load_flags, 92 int load_flags,
91 bool has_user_gesture,
92 bool skip_service_worker, 93 bool skip_service_worker,
93 RequestContextType request_context_type) 94 RequestContextType request_context_type)
94 : headers(headers), 95 : headers(headers),
95 load_flags(load_flags), 96 load_flags(load_flags),
96 has_user_gesture(has_user_gesture),
97 skip_service_worker(skip_service_worker), 97 skip_service_worker(skip_service_worker),
98 request_context_type(request_context_type) {} 98 request_context_type(request_context_type) {}
99 99
100 BeginNavigationParams::BeginNavigationParams( 100 BeginNavigationParams::BeginNavigationParams(
101 const BeginNavigationParams& other) = default; 101 const BeginNavigationParams& other) = default;
102 102
103 StartNavigationParams::StartNavigationParams() 103 StartNavigationParams::StartNavigationParams()
104 : transferred_request_child_id(-1), 104 : transferred_request_child_id(-1),
105 transferred_request_request_id(-1) { 105 transferred_request_request_id(-1) {
106 } 106 }
(...skipping 20 matching lines...) Expand all
127 is_same_document_history_load(false), 127 is_same_document_history_load(false),
128 is_history_navigation_in_new_child(false), 128 is_history_navigation_in_new_child(false),
129 has_committed_real_load(false), 129 has_committed_real_load(false),
130 intended_as_new_entry(false), 130 intended_as_new_entry(false),
131 pending_history_list_offset(-1), 131 pending_history_list_offset(-1),
132 current_history_list_offset(-1), 132 current_history_list_offset(-1),
133 current_history_list_length(0), 133 current_history_list_length(0),
134 is_view_source(false), 134 is_view_source(false),
135 should_clear_history_list(false), 135 should_clear_history_list(false),
136 should_create_service_worker(false), 136 should_create_service_worker(false),
137 service_worker_provider_id(kInvalidServiceWorkerProviderId), 137 service_worker_provider_id(kInvalidServiceWorkerProviderId) {}
138 has_user_gesture(false) {}
139 138
140 RequestNavigationParams::RequestNavigationParams( 139 RequestNavigationParams::RequestNavigationParams(
141 bool is_overriding_user_agent, 140 bool is_overriding_user_agent,
142 const std::vector<GURL>& redirects, 141 const std::vector<GURL>& redirects,
143 bool can_load_local_resources, 142 bool can_load_local_resources,
144 const PageState& page_state, 143 const PageState& page_state,
145 int nav_entry_id, 144 int nav_entry_id,
146 bool is_same_document_history_load, 145 bool is_same_document_history_load,
147 bool is_history_navigation_in_new_child, 146 bool is_history_navigation_in_new_child,
148 std::map<std::string, bool> subframe_unique_names, 147 std::map<std::string, bool> subframe_unique_names,
149 bool has_committed_real_load, 148 bool has_committed_real_load,
150 bool intended_as_new_entry, 149 bool intended_as_new_entry,
151 int pending_history_list_offset, 150 int pending_history_list_offset,
152 int current_history_list_offset, 151 int current_history_list_offset,
153 int current_history_list_length, 152 int current_history_list_length,
154 bool is_view_source, 153 bool is_view_source,
155 bool should_clear_history_list, 154 bool should_clear_history_list)
156 bool has_user_gesture)
157 : is_overriding_user_agent(is_overriding_user_agent), 155 : is_overriding_user_agent(is_overriding_user_agent),
158 redirects(redirects), 156 redirects(redirects),
159 can_load_local_resources(can_load_local_resources), 157 can_load_local_resources(can_load_local_resources),
160 page_state(page_state), 158 page_state(page_state),
161 nav_entry_id(nav_entry_id), 159 nav_entry_id(nav_entry_id),
162 is_same_document_history_load(is_same_document_history_load), 160 is_same_document_history_load(is_same_document_history_load),
163 is_history_navigation_in_new_child(is_history_navigation_in_new_child), 161 is_history_navigation_in_new_child(is_history_navigation_in_new_child),
164 subframe_unique_names(subframe_unique_names), 162 subframe_unique_names(subframe_unique_names),
165 has_committed_real_load(has_committed_real_load), 163 has_committed_real_load(has_committed_real_load),
166 intended_as_new_entry(intended_as_new_entry), 164 intended_as_new_entry(intended_as_new_entry),
167 pending_history_list_offset(pending_history_list_offset), 165 pending_history_list_offset(pending_history_list_offset),
168 current_history_list_offset(current_history_list_offset), 166 current_history_list_offset(current_history_list_offset),
169 current_history_list_length(current_history_list_length), 167 current_history_list_length(current_history_list_length),
170 is_view_source(is_view_source), 168 is_view_source(is_view_source),
171 should_clear_history_list(should_clear_history_list), 169 should_clear_history_list(should_clear_history_list),
172 should_create_service_worker(false), 170 should_create_service_worker(false),
173 service_worker_provider_id(kInvalidServiceWorkerProviderId), 171 service_worker_provider_id(kInvalidServiceWorkerProviderId) {}
174 has_user_gesture(has_user_gesture) {}
175 172
176 RequestNavigationParams::RequestNavigationParams( 173 RequestNavigationParams::RequestNavigationParams(
177 const RequestNavigationParams& other) = default; 174 const RequestNavigationParams& other) = default;
178 175
179 RequestNavigationParams::~RequestNavigationParams() { 176 RequestNavigationParams::~RequestNavigationParams() {
180 } 177 }
181 178
182 NavigationParams::NavigationParams( 179 NavigationParams::NavigationParams(
183 const CommonNavigationParams& common_params, 180 const CommonNavigationParams& common_params,
184 const StartNavigationParams& start_params, 181 const StartNavigationParams& start_params,
185 const RequestNavigationParams& request_params) 182 const RequestNavigationParams& request_params)
186 : common_params(common_params), 183 : common_params(common_params),
187 start_params(start_params), 184 start_params(start_params),
188 request_params(request_params) { 185 request_params(request_params) {
189 } 186 }
190 187
191 NavigationParams::~NavigationParams() { 188 NavigationParams::~NavigationParams() {
192 } 189 }
193 190
194 } // namespace content 191 } // namespace content
OLDNEW
« no previous file with comments | « content/common/navigation_params.h ('k') | content/public/browser/navigation_handle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698