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/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" |
(...skipping 13 matching lines...) Expand all Loading... |
24 // TODO(clamy): same document navigations should not send requests to the | 24 // TODO(clamy): same document navigations should not send requests to the |
25 // network stack. Neither should pushState/popState. | 25 // network stack. Neither should pushState/popState. |
26 return url != url::kAboutBlankURL && !url.SchemeIs(url::kJavaScriptScheme) && | 26 return url != url::kAboutBlankURL && !url.SchemeIs(url::kJavaScriptScheme) && |
27 !url.is_empty() && !url.SchemeIs(url::kContentIDScheme) && | 27 !url.is_empty() && !url.SchemeIs(url::kContentIDScheme) && |
28 url != content::kAboutSrcDocURL; | 28 url != content::kAboutSrcDocURL; |
29 } | 29 } |
30 | 30 |
31 CommonNavigationParams::CommonNavigationParams() | 31 CommonNavigationParams::CommonNavigationParams() |
32 : transition(ui::PAGE_TRANSITION_LINK), | 32 : transition(ui::PAGE_TRANSITION_LINK), |
33 navigation_type(FrameMsg_Navigate_Type::NORMAL), | 33 navigation_type(FrameMsg_Navigate_Type::NORMAL), |
34 gesture(NavigationGestureUnknown), | |
35 allow_download(true), | 34 allow_download(true), |
36 should_replace_current_entry(false), | 35 should_replace_current_entry(false), |
37 report_type(FrameMsg_UILoadMetricsReportType::NO_REPORT), | 36 report_type(FrameMsg_UILoadMetricsReportType::NO_REPORT), |
38 lofi_state(LOFI_UNSPECIFIED), | 37 lofi_state(LOFI_UNSPECIFIED), |
39 navigation_start(base::TimeTicks::Now()), | 38 navigation_start(base::TimeTicks::Now()), |
40 method("GET") {} | 39 method("GET") {} |
41 | 40 |
42 CommonNavigationParams::CommonNavigationParams( | 41 CommonNavigationParams::CommonNavigationParams( |
43 const GURL& url, | 42 const GURL& url, |
44 const Referrer& referrer, | 43 const Referrer& referrer, |
45 ui::PageTransition transition, | 44 ui::PageTransition transition, |
46 FrameMsg_Navigate_Type::Value navigation_type, | 45 FrameMsg_Navigate_Type::Value navigation_type, |
47 NavigationGesture gesture, | |
48 bool allow_download, | 46 bool allow_download, |
49 bool should_replace_current_entry, | 47 bool should_replace_current_entry, |
50 base::TimeTicks ui_timestamp, | 48 base::TimeTicks ui_timestamp, |
51 FrameMsg_UILoadMetricsReportType::Value report_type, | 49 FrameMsg_UILoadMetricsReportType::Value report_type, |
52 const GURL& base_url_for_data_url, | 50 const GURL& base_url_for_data_url, |
53 const GURL& history_url_for_data_url, | 51 const GURL& history_url_for_data_url, |
54 LoFiState lofi_state, | 52 LoFiState lofi_state, |
55 const base::TimeTicks& navigation_start, | 53 const base::TimeTicks& navigation_start, |
56 std::string method, | 54 std::string method, |
57 const scoped_refptr<ResourceRequestBodyImpl>& post_data) | 55 const scoped_refptr<ResourceRequestBodyImpl>& post_data) |
58 : url(url), | 56 : url(url), |
59 referrer(referrer), | 57 referrer(referrer), |
60 transition(transition), | 58 transition(transition), |
61 navigation_type(navigation_type), | 59 navigation_type(navigation_type), |
62 gesture(gesture), | |
63 allow_download(allow_download), | 60 allow_download(allow_download), |
64 should_replace_current_entry(should_replace_current_entry), | 61 should_replace_current_entry(should_replace_current_entry), |
65 ui_timestamp(ui_timestamp), | 62 ui_timestamp(ui_timestamp), |
66 report_type(report_type), | 63 report_type(report_type), |
67 base_url_for_data_url(base_url_for_data_url), | 64 base_url_for_data_url(base_url_for_data_url), |
68 history_url_for_data_url(history_url_for_data_url), | 65 history_url_for_data_url(history_url_for_data_url), |
69 lofi_state(lofi_state), | 66 lofi_state(lofi_state), |
70 navigation_start(navigation_start), | 67 navigation_start(navigation_start), |
71 method(method), | 68 method(method), |
72 post_data(post_data) { | 69 post_data(post_data) { |
73 // |method != "POST"| should imply absence of |post_data|. | 70 // |method != "POST"| should imply absence of |post_data|. |
74 if (method != "POST" && post_data) { | 71 if (method != "POST" && post_data) { |
75 NOTREACHED(); | 72 NOTREACHED(); |
76 this->post_data = nullptr; | 73 this->post_data = nullptr; |
77 } | 74 } |
78 } | 75 } |
79 | 76 |
80 CommonNavigationParams::CommonNavigationParams( | 77 CommonNavigationParams::CommonNavigationParams( |
81 const CommonNavigationParams& other) = default; | 78 const CommonNavigationParams& other) = default; |
82 | 79 |
83 CommonNavigationParams::~CommonNavigationParams() { | 80 CommonNavigationParams::~CommonNavigationParams() { |
84 } | 81 } |
85 | 82 |
86 BeginNavigationParams::BeginNavigationParams() | 83 BeginNavigationParams::BeginNavigationParams() |
87 : load_flags(0), | 84 : load_flags(0), |
| 85 has_user_gesture(false), |
88 skip_service_worker(false), | 86 skip_service_worker(false), |
89 request_context_type(REQUEST_CONTEXT_TYPE_LOCATION) {} | 87 request_context_type(REQUEST_CONTEXT_TYPE_LOCATION) {} |
90 | 88 |
91 BeginNavigationParams::BeginNavigationParams( | 89 BeginNavigationParams::BeginNavigationParams( |
92 std::string headers, | 90 std::string headers, |
93 int load_flags, | 91 int load_flags, |
| 92 bool has_user_gesture, |
94 bool skip_service_worker, | 93 bool skip_service_worker, |
95 RequestContextType request_context_type) | 94 RequestContextType request_context_type) |
96 : headers(headers), | 95 : headers(headers), |
97 load_flags(load_flags), | 96 load_flags(load_flags), |
| 97 has_user_gesture(has_user_gesture), |
98 skip_service_worker(skip_service_worker), | 98 skip_service_worker(skip_service_worker), |
99 request_context_type(request_context_type) {} | 99 request_context_type(request_context_type) {} |
100 | 100 |
101 BeginNavigationParams::BeginNavigationParams( | 101 BeginNavigationParams::BeginNavigationParams( |
102 const BeginNavigationParams& other) = default; | 102 const BeginNavigationParams& other) = default; |
103 | 103 |
104 StartNavigationParams::StartNavigationParams() | 104 StartNavigationParams::StartNavigationParams() |
105 : transferred_request_child_id(-1), | 105 : transferred_request_child_id(-1), |
106 transferred_request_request_id(-1) { | 106 transferred_request_request_id(-1) { |
107 } | 107 } |
(...skipping 21 matching lines...) Expand all Loading... |
129 is_history_navigation_in_new_child(false), | 129 is_history_navigation_in_new_child(false), |
130 has_committed_real_load(false), | 130 has_committed_real_load(false), |
131 intended_as_new_entry(false), | 131 intended_as_new_entry(false), |
132 pending_history_list_offset(-1), | 132 pending_history_list_offset(-1), |
133 current_history_list_offset(-1), | 133 current_history_list_offset(-1), |
134 current_history_list_length(0), | 134 current_history_list_length(0), |
135 is_view_source(false), | 135 is_view_source(false), |
136 should_clear_history_list(false), | 136 should_clear_history_list(false), |
137 should_create_service_worker(false), | 137 should_create_service_worker(false), |
138 service_worker_provider_id(kInvalidServiceWorkerProviderId), | 138 service_worker_provider_id(kInvalidServiceWorkerProviderId), |
139 appcache_host_id(kAppCacheNoHostId) {} | 139 appcache_host_id(kAppCacheNoHostId), |
| 140 has_user_gesture(false) { |
| 141 } |
140 | 142 |
141 RequestNavigationParams::RequestNavigationParams( | 143 RequestNavigationParams::RequestNavigationParams( |
142 bool is_overriding_user_agent, | 144 bool is_overriding_user_agent, |
143 const std::vector<GURL>& redirects, | 145 const std::vector<GURL>& redirects, |
144 bool can_load_local_resources, | 146 bool can_load_local_resources, |
145 const PageState& page_state, | 147 const PageState& page_state, |
146 int nav_entry_id, | 148 int nav_entry_id, |
147 bool is_same_document_history_load, | 149 bool is_same_document_history_load, |
148 bool is_history_navigation_in_new_child, | 150 bool is_history_navigation_in_new_child, |
149 std::map<std::string, bool> subframe_unique_names, | 151 std::map<std::string, bool> subframe_unique_names, |
150 bool has_committed_real_load, | 152 bool has_committed_real_load, |
151 bool intended_as_new_entry, | 153 bool intended_as_new_entry, |
152 int pending_history_list_offset, | 154 int pending_history_list_offset, |
153 int current_history_list_offset, | 155 int current_history_list_offset, |
154 int current_history_list_length, | 156 int current_history_list_length, |
155 bool is_view_source, | 157 bool is_view_source, |
156 bool should_clear_history_list) | 158 bool should_clear_history_list, |
| 159 bool has_user_gesture) |
157 : is_overriding_user_agent(is_overriding_user_agent), | 160 : is_overriding_user_agent(is_overriding_user_agent), |
158 redirects(redirects), | 161 redirects(redirects), |
159 can_load_local_resources(can_load_local_resources), | 162 can_load_local_resources(can_load_local_resources), |
160 page_state(page_state), | 163 page_state(page_state), |
161 nav_entry_id(nav_entry_id), | 164 nav_entry_id(nav_entry_id), |
162 is_same_document_history_load(is_same_document_history_load), | 165 is_same_document_history_load(is_same_document_history_load), |
163 is_history_navigation_in_new_child(is_history_navigation_in_new_child), | 166 is_history_navigation_in_new_child(is_history_navigation_in_new_child), |
164 subframe_unique_names(subframe_unique_names), | 167 subframe_unique_names(subframe_unique_names), |
165 has_committed_real_load(has_committed_real_load), | 168 has_committed_real_load(has_committed_real_load), |
166 intended_as_new_entry(intended_as_new_entry), | 169 intended_as_new_entry(intended_as_new_entry), |
167 pending_history_list_offset(pending_history_list_offset), | 170 pending_history_list_offset(pending_history_list_offset), |
168 current_history_list_offset(current_history_list_offset), | 171 current_history_list_offset(current_history_list_offset), |
169 current_history_list_length(current_history_list_length), | 172 current_history_list_length(current_history_list_length), |
170 is_view_source(is_view_source), | 173 is_view_source(is_view_source), |
171 should_clear_history_list(should_clear_history_list), | 174 should_clear_history_list(should_clear_history_list), |
172 should_create_service_worker(false), | 175 should_create_service_worker(false), |
173 service_worker_provider_id(kInvalidServiceWorkerProviderId), | 176 service_worker_provider_id(kInvalidServiceWorkerProviderId), |
174 appcache_host_id(kAppCacheNoHostId) {} | 177 appcache_host_id(kAppCacheNoHostId), |
| 178 has_user_gesture(has_user_gesture) { |
| 179 } |
175 | 180 |
176 RequestNavigationParams::RequestNavigationParams( | 181 RequestNavigationParams::RequestNavigationParams( |
177 const RequestNavigationParams& other) = default; | 182 const RequestNavigationParams& other) = default; |
178 | 183 |
179 RequestNavigationParams::~RequestNavigationParams() { | 184 RequestNavigationParams::~RequestNavigationParams() { |
180 } | 185 } |
181 | 186 |
182 NavigationParams::NavigationParams( | 187 NavigationParams::NavigationParams( |
183 const CommonNavigationParams& common_params, | 188 const CommonNavigationParams& common_params, |
184 const StartNavigationParams& start_params, | 189 const StartNavigationParams& start_params, |
185 const RequestNavigationParams& request_params) | 190 const RequestNavigationParams& request_params) |
186 : common_params(common_params), | 191 : common_params(common_params), |
187 start_params(start_params), | 192 start_params(start_params), |
188 request_params(request_params) { | 193 request_params(request_params) { |
189 } | 194 } |
190 | 195 |
191 NavigationParams::~NavigationParams() { | 196 NavigationParams::~NavigationParams() { |
192 } | 197 } |
193 | 198 |
194 } // namespace content | 199 } // namespace content |
OLD | NEW |