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/resource_request_body_impl.h" | 18 #include "content/common/resource_request_body_impl.h" |
19 #include "content/public/common/page_state.h" | 19 #include "content/public/common/page_state.h" |
| 20 #include "content/public/common/previews_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 |
28 // The LoFi state which determines whether to add the Lo-Fi header. | |
29 enum LoFiState { | |
30 // Let the browser process decide whether or not to request the Lo-Fi version. | |
31 LOFI_UNSPECIFIED = 0, | |
32 | |
33 // Request a normal (non-Lo-Fi) version of the resource. | |
34 LOFI_OFF, | |
35 | |
36 // Request a Lo-Fi version of the resource. | |
37 LOFI_ON, | |
38 }; | |
39 | |
40 // PlzNavigate | 29 // PlzNavigate |
41 // Helper function to determine if the navigation to |url| should make a request | 30 // Helper function to determine if the navigation to |url| should make a request |
42 // to the network stack. A request should not be sent for JavaScript URLs or | 31 // to the network stack. A request should not be sent for JavaScript URLs or |
43 // about:blank. In these cases, no request needs to be sent. | 32 // about:blank. In these cases, no request needs to be sent. |
44 bool CONTENT_EXPORT ShouldMakeNetworkRequestForURL(const GURL& url); | 33 bool CONTENT_EXPORT ShouldMakeNetworkRequestForURL(const GURL& url); |
45 | 34 |
46 // The following structures hold parameters used during a navigation. In | 35 // The following structures hold parameters used during a navigation. In |
47 // particular they are used by FrameMsg_Navigate, FrameMsg_CommitNavigation and | 36 // particular they are used by FrameMsg_Navigate, FrameMsg_CommitNavigation and |
48 // FrameHostMsg_BeginNavigation. | 37 // FrameHostMsg_BeginNavigation. |
49 | 38 |
50 // Provided by the browser or the renderer ------------------------------------- | 39 // Provided by the browser or the renderer ------------------------------------- |
51 | 40 |
52 // Used by all navigation IPCs. | 41 // Used by all navigation IPCs. |
53 struct CONTENT_EXPORT CommonNavigationParams { | 42 struct CONTENT_EXPORT CommonNavigationParams { |
54 CommonNavigationParams(); | 43 CommonNavigationParams(); |
55 CommonNavigationParams( | 44 CommonNavigationParams( |
56 const GURL& url, | 45 const GURL& url, |
57 const Referrer& referrer, | 46 const Referrer& referrer, |
58 ui::PageTransition transition, | 47 ui::PageTransition transition, |
59 FrameMsg_Navigate_Type::Value navigation_type, | 48 FrameMsg_Navigate_Type::Value navigation_type, |
60 bool allow_download, | 49 bool allow_download, |
61 bool should_replace_current_entry, | 50 bool should_replace_current_entry, |
62 base::TimeTicks ui_timestamp, | 51 base::TimeTicks ui_timestamp, |
63 FrameMsg_UILoadMetricsReportType::Value report_type, | 52 FrameMsg_UILoadMetricsReportType::Value report_type, |
64 const GURL& base_url_for_data_url, | 53 const GURL& base_url_for_data_url, |
65 const GURL& history_url_for_data_url, | 54 const GURL& history_url_for_data_url, |
66 LoFiState lofi_state, | 55 PreviewsState previews_state, |
67 const base::TimeTicks& navigation_start, | 56 const base::TimeTicks& navigation_start, |
68 std::string method, | 57 std::string method, |
69 const scoped_refptr<ResourceRequestBodyImpl>& post_data); | 58 const scoped_refptr<ResourceRequestBodyImpl>& post_data); |
70 CommonNavigationParams(const CommonNavigationParams& other); | 59 CommonNavigationParams(const CommonNavigationParams& other); |
71 ~CommonNavigationParams(); | 60 ~CommonNavigationParams(); |
72 | 61 |
73 // The URL to navigate to. | 62 // The URL to navigate to. |
74 // PlzNavigate: May be modified when the navigation is ready to commit. | 63 // PlzNavigate: May be modified when the navigation is ready to commit. |
75 GURL url; | 64 GURL url; |
76 | 65 |
(...skipping 27 matching lines...) Expand all Loading... |
104 FrameMsg_UILoadMetricsReportType::Value report_type; | 93 FrameMsg_UILoadMetricsReportType::Value report_type; |
105 | 94 |
106 // Base URL for use in Blink's SubstituteData. | 95 // Base URL for use in Blink's SubstituteData. |
107 // Is only used with data: URLs. | 96 // Is only used with data: URLs. |
108 GURL base_url_for_data_url; | 97 GURL base_url_for_data_url; |
109 | 98 |
110 // History URL for use in Blink's SubstituteData. | 99 // History URL for use in Blink's SubstituteData. |
111 // Is only used with data: URLs. | 100 // Is only used with data: URLs. |
112 GURL history_url_for_data_url; | 101 GURL history_url_for_data_url; |
113 | 102 |
114 // Whether or not to request a LoFi version of the document or let the browser | 103 // Bitmask that has whether or not to request a Preview version of the |
115 // decide. | 104 // document for various preview types or let the browser decide. |
116 LoFiState lofi_state; | 105 PreviewsState previews_state; |
117 | 106 |
118 // The navigationStart time exposed through the Navigation Timing API to JS. | 107 // The navigationStart time exposed through the Navigation Timing API to JS. |
119 // If this is for a browser-initiated navigation, this can override the | 108 // If this is for a browser-initiated navigation, this can override the |
120 // navigation_start value in Blink. | 109 // navigation_start value in Blink. |
121 // PlzNavigate: For renderer initiated navigations, this will be set on the | 110 // PlzNavigate: For renderer initiated navigations, this will be set on the |
122 // renderer side and sent with FrameHostMsg_BeginNavigation. | 111 // renderer side and sent with FrameHostMsg_BeginNavigation. |
123 base::TimeTicks navigation_start; | 112 base::TimeTicks navigation_start; |
124 | 113 |
125 // The request method: GET, POST, etc. | 114 // The request method: GET, POST, etc. |
126 std::string method; | 115 std::string method; |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 ~NavigationParams(); | 339 ~NavigationParams(); |
351 | 340 |
352 CommonNavigationParams common_params; | 341 CommonNavigationParams common_params; |
353 StartNavigationParams start_params; | 342 StartNavigationParams start_params; |
354 RequestNavigationParams request_params; | 343 RequestNavigationParams request_params; |
355 }; | 344 }; |
356 | 345 |
357 } // namespace content | 346 } // namespace content |
358 | 347 |
359 #endif // CONTENT_COMMON_NAVIGATION_PARAMS_H_ | 348 #endif // CONTENT_COMMON_NAVIGATION_PARAMS_H_ |
OLD | NEW |