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 #ifndef CONTENT_COMMON_NAVIGATION_PARAMS_H_ | 5 #ifndef CONTENT_COMMON_NAVIGATION_PARAMS_H_ |
6 #define CONTENT_COMMON_NAVIGATION_PARAMS_H_ | 6 #define CONTENT_COMMON_NAVIGATION_PARAMS_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
17 #include "content/common/frame_message_enums.h" | 17 #include "content/common/frame_message_enums.h" |
| 18 #include "content/common/navigation_gesture.h" |
18 #include "content/common/resource_request_body_impl.h" | 19 #include "content/common/resource_request_body_impl.h" |
19 #include "content/public/common/page_state.h" | 20 #include "content/public/common/page_state.h" |
20 #include "content/public/common/referrer.h" | 21 #include "content/public/common/referrer.h" |
21 #include "content/public/common/request_context_type.h" | 22 #include "content/public/common/request_context_type.h" |
22 #include "content/public/common/resource_response.h" | 23 #include "content/public/common/resource_response.h" |
23 #include "ui/base/page_transition_types.h" | 24 #include "ui/base/page_transition_types.h" |
24 #include "url/gurl.h" | 25 #include "url/gurl.h" |
25 | 26 |
26 namespace content { | 27 namespace content { |
27 | 28 |
(...skipping 22 matching lines...) Expand all Loading... |
50 // Provided by the browser or the renderer ------------------------------------- | 51 // Provided by the browser or the renderer ------------------------------------- |
51 | 52 |
52 // Used by all navigation IPCs. | 53 // Used by all navigation IPCs. |
53 struct CONTENT_EXPORT CommonNavigationParams { | 54 struct CONTENT_EXPORT CommonNavigationParams { |
54 CommonNavigationParams(); | 55 CommonNavigationParams(); |
55 CommonNavigationParams( | 56 CommonNavigationParams( |
56 const GURL& url, | 57 const GURL& url, |
57 const Referrer& referrer, | 58 const Referrer& referrer, |
58 ui::PageTransition transition, | 59 ui::PageTransition transition, |
59 FrameMsg_Navigate_Type::Value navigation_type, | 60 FrameMsg_Navigate_Type::Value navigation_type, |
| 61 NavigationGesture gesture, |
60 bool allow_download, | 62 bool allow_download, |
61 bool should_replace_current_entry, | 63 bool should_replace_current_entry, |
62 base::TimeTicks ui_timestamp, | 64 base::TimeTicks ui_timestamp, |
63 FrameMsg_UILoadMetricsReportType::Value report_type, | 65 FrameMsg_UILoadMetricsReportType::Value report_type, |
64 const GURL& base_url_for_data_url, | 66 const GURL& base_url_for_data_url, |
65 const GURL& history_url_for_data_url, | 67 const GURL& history_url_for_data_url, |
66 LoFiState lofi_state, | 68 LoFiState lofi_state, |
67 const base::TimeTicks& navigation_start, | 69 const base::TimeTicks& navigation_start, |
68 std::string method, | 70 std::string method, |
69 const scoped_refptr<ResourceRequestBodyImpl>& post_data); | 71 const scoped_refptr<ResourceRequestBodyImpl>& post_data); |
70 CommonNavigationParams(const CommonNavigationParams& other); | 72 CommonNavigationParams(const CommonNavigationParams& other); |
71 ~CommonNavigationParams(); | 73 ~CommonNavigationParams(); |
72 | 74 |
73 // The URL to navigate to. | 75 // The URL to navigate to. |
74 // PlzNavigate: May be modified when the navigation is ready to commit. | 76 // PlzNavigate: May be modified when the navigation is ready to commit. |
75 GURL url; | 77 GURL url; |
76 | 78 |
77 // The URL to send in the "Referer" header field. Can be empty if there is | 79 // The URL to send in the "Referer" header field. Can be empty if there is |
78 // no referrer. | 80 // no referrer. |
79 Referrer referrer; | 81 Referrer referrer; |
80 | 82 |
81 // The type of transition. | 83 // The type of transition. |
82 ui::PageTransition transition; | 84 ui::PageTransition transition; |
83 | 85 |
84 // Type of navigation. | 86 // Type of navigation. |
85 FrameMsg_Navigate_Type::Value navigation_type; | 87 FrameMsg_Navigate_Type::Value navigation_type; |
86 | 88 |
| 89 // Indicates the gesture type. |
| 90 NavigationGesture gesture; |
| 91 |
87 // Allows the URL to be downloaded (true by default). | 92 // Allows the URL to be downloaded (true by default). |
88 // Avoid downloading when in view-source mode. | 93 // Avoid downloading when in view-source mode. |
89 bool allow_download; | 94 bool allow_download; |
90 | 95 |
91 // Informs the RenderView the pending navigation should replace the current | 96 // Informs the RenderView the pending navigation should replace the current |
92 // history entry when it commits. This is used for cross-process redirects so | 97 // history entry when it commits. This is used for cross-process redirects so |
93 // the transferred navigation can recover the navigation state. | 98 // the transferred navigation can recover the navigation state. |
94 // PlzNavigate: this is used by client-side redirects to indicate that when | 99 // PlzNavigate: this is used by client-side redirects to indicate that when |
95 // the navigation commits, it should commit in the existing page. | 100 // the navigation commits, it should commit in the existing page. |
96 bool should_replace_current_entry; | 101 bool should_replace_current_entry; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 142 |
138 // This struct is not used outside of the PlzNavigate project. | 143 // This struct is not used outside of the PlzNavigate project. |
139 // PlzNavigate: parameters needed to start a navigation on the IO thread, | 144 // PlzNavigate: parameters needed to start a navigation on the IO thread, |
140 // following a renderer-initiated navigation request. | 145 // following a renderer-initiated navigation request. |
141 struct CONTENT_EXPORT BeginNavigationParams { | 146 struct CONTENT_EXPORT BeginNavigationParams { |
142 // TODO(clamy): See if it is possible to reuse this in | 147 // TODO(clamy): See if it is possible to reuse this in |
143 // ResourceMsg_Request_Params. | 148 // ResourceMsg_Request_Params. |
144 BeginNavigationParams(); | 149 BeginNavigationParams(); |
145 BeginNavigationParams(std::string headers, | 150 BeginNavigationParams(std::string headers, |
146 int load_flags, | 151 int load_flags, |
147 bool has_user_gesture, | |
148 bool skip_service_worker, | 152 bool skip_service_worker, |
149 RequestContextType request_context_type); | 153 RequestContextType request_context_type); |
150 BeginNavigationParams(const BeginNavigationParams& other); | 154 BeginNavigationParams(const BeginNavigationParams& other); |
151 | 155 |
152 // Additional HTTP request headers. | 156 // Additional HTTP request headers. |
153 std::string headers; | 157 std::string headers; |
154 | 158 |
155 // net::URLRequest load flags (net::LOAD_NORMAL) by default). | 159 // net::URLRequest load flags (net::LOAD_NORMAL) by default). |
156 int load_flags; | 160 int load_flags; |
157 | 161 |
158 // True if the request was user initiated. | |
159 bool has_user_gesture; | |
160 | |
161 // True if the ServiceWorker should be skipped. | 162 // True if the ServiceWorker should be skipped. |
162 bool skip_service_worker; | 163 bool skip_service_worker; |
163 | 164 |
164 // Indicates the request context type. | 165 // Indicates the request context type. |
165 RequestContextType request_context_type; | 166 RequestContextType request_context_type; |
166 | 167 |
167 // See WebSearchableFormData for a description of these. | 168 // See WebSearchableFormData for a description of these. |
168 GURL searchable_form_url; | 169 GURL searchable_form_url; |
169 std::string searchable_form_encoding; | 170 std::string searchable_form_encoding; |
170 }; | 171 }; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 int nav_entry_id, | 226 int nav_entry_id, |
226 bool is_same_document_history_load, | 227 bool is_same_document_history_load, |
227 bool is_history_navigation_in_new_child, | 228 bool is_history_navigation_in_new_child, |
228 std::map<std::string, bool> subframe_unique_names, | 229 std::map<std::string, bool> subframe_unique_names, |
229 bool has_committed_real_load, | 230 bool has_committed_real_load, |
230 bool intended_as_new_entry, | 231 bool intended_as_new_entry, |
231 int pending_history_list_offset, | 232 int pending_history_list_offset, |
232 int current_history_list_offset, | 233 int current_history_list_offset, |
233 int current_history_list_length, | 234 int current_history_list_length, |
234 bool is_view_source, | 235 bool is_view_source, |
235 bool should_clear_history_list, | 236 bool should_clear_history_list); |
236 bool has_user_gesture); | |
237 RequestNavigationParams(const RequestNavigationParams& other); | 237 RequestNavigationParams(const RequestNavigationParams& other); |
238 ~RequestNavigationParams(); | 238 ~RequestNavigationParams(); |
239 | 239 |
240 // Whether or not the user agent override string should be used. | 240 // Whether or not the user agent override string should be used. |
241 bool is_overriding_user_agent; | 241 bool is_overriding_user_agent; |
242 | 242 |
243 // Any redirect URLs that occurred before |url|. Useful for cross-process | 243 // Any redirect URLs that occurred before |url|. Useful for cross-process |
244 // navigations; defaults to empty. | 244 // navigations; defaults to empty. |
245 std::vector<GURL> redirects; | 245 std::vector<GURL> redirects; |
246 | 246 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 // Timing of navigation events. | 318 // Timing of navigation events. |
319 NavigationTiming navigation_timing; | 319 NavigationTiming navigation_timing; |
320 | 320 |
321 // PlzNavigate | 321 // PlzNavigate |
322 // The ServiceWorkerProviderHost ID used for navigations, if it was already | 322 // The ServiceWorkerProviderHost ID used for navigations, if it was already |
323 // created by the browser. Set to kInvalidServiceWorkerProviderId otherwise. | 323 // created by the browser. Set to kInvalidServiceWorkerProviderId otherwise. |
324 // This parameter is not used in the current navigation architecture, where | 324 // This parameter is not used in the current navigation architecture, where |
325 // it will always be equal to kInvalidServiceWorkerProviderId. | 325 // it will always be equal to kInvalidServiceWorkerProviderId. |
326 int service_worker_provider_id; | 326 int service_worker_provider_id; |
327 | 327 |
328 // True if the navigation originated due to a user gesture. | |
329 bool has_user_gesture; | |
330 | |
331 #if defined(OS_ANDROID) | 328 #if defined(OS_ANDROID) |
332 // The real content of the data: URL. Only used in Android WebView for | 329 // The real content of the data: URL. Only used in Android WebView for |
333 // implementing LoadDataWithBaseUrl API method to circumvent the restriction | 330 // implementing LoadDataWithBaseUrl API method to circumvent the restriction |
334 // on the GURL max length in the IPC layer. Short data: URLs can still be | 331 // on the GURL max length in the IPC layer. Short data: URLs can still be |
335 // passed in the |CommonNavigationParams::url| field. | 332 // passed in the |CommonNavigationParams::url| field. |
336 std::string data_url_as_string; | 333 std::string data_url_as_string; |
337 #endif | 334 #endif |
338 }; | 335 }; |
339 | 336 |
340 // Helper struct keeping track in one place of all the parameters the browser | 337 // Helper struct keeping track in one place of all the parameters the browser |
341 // needs to provide to the renderer. | 338 // needs to provide to the renderer. |
342 struct NavigationParams { | 339 struct NavigationParams { |
343 NavigationParams(const CommonNavigationParams& common_params, | 340 NavigationParams(const CommonNavigationParams& common_params, |
344 const StartNavigationParams& start_params, | 341 const StartNavigationParams& start_params, |
345 const RequestNavigationParams& request_params); | 342 const RequestNavigationParams& request_params); |
346 ~NavigationParams(); | 343 ~NavigationParams(); |
347 | 344 |
348 CommonNavigationParams common_params; | 345 CommonNavigationParams common_params; |
349 StartNavigationParams start_params; | 346 StartNavigationParams start_params; |
350 RequestNavigationParams request_params; | 347 RequestNavigationParams request_params; |
351 }; | 348 }; |
352 | 349 |
353 } // namespace content | 350 } // namespace content |
354 | 351 |
355 #endif // CONTENT_COMMON_NAVIGATION_PARAMS_H_ | 352 #endif // CONTENT_COMMON_NAVIGATION_PARAMS_H_ |
OLD | NEW |