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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 #include "content/common/frame_message_enums.h" | 13 #include "content/common/frame_message_enums.h" |
14 #include "content/public/common/page_state.h" | 14 #include "content/public/common/page_state.h" |
15 #include "content/public/common/referrer.h" | 15 #include "content/public/common/referrer.h" |
16 #include "content/public/common/request_context_type.h" | 16 #include "content/public/common/request_context_type.h" |
17 #include "ui/base/page_transition_types.h" | 17 #include "ui/base/page_transition_types.h" |
18 #include "url/gurl.h" | 18 #include "url/gurl.h" |
19 | 19 |
20 namespace base { | 20 namespace base { |
21 class RefCountedMemory; | 21 class RefCountedMemory; |
22 } | 22 } |
23 | 23 |
24 namespace content { | 24 namespace content { |
25 | 25 |
| 26 // The LoFi state which determines whether to add the Lo-Fi header. |
| 27 enum LoFiState { |
| 28 // Let the browser process decide whether or not to request the Lo-Fi version. |
| 29 LOFI_UNSPECIFIED = 0, |
| 30 |
| 31 // Request a normal (non-Lo-Fi) version of the resource. |
| 32 LOFI_OFF, |
| 33 |
| 34 // Request a Lo-Fi version of the resource. |
| 35 LOFI_ON, |
| 36 }; |
| 37 |
26 // PlzNavigate | 38 // PlzNavigate |
27 // Helper function to determine if the navigation to |url| should make a request | 39 // Helper function to determine if the navigation to |url| should make a request |
28 // to the network stack. A request should not be sent for data URLs, JavaScript | 40 // to the network stack. A request should not be sent for data URLs, JavaScript |
29 // URLs or about:blank. In these cases, no request needs to be sent. | 41 // URLs or about:blank. In these cases, no request needs to be sent. |
30 bool ShouldMakeNetworkRequestForURL(const GURL& url); | 42 bool ShouldMakeNetworkRequestForURL(const GURL& url); |
31 | 43 |
32 // The following structures hold parameters used during a navigation. In | 44 // The following structures hold parameters used during a navigation. In |
33 // particular they are used by FrameMsg_Navigate, FrameMsg_CommitNavigation and | 45 // particular they are used by FrameMsg_Navigate, FrameMsg_CommitNavigation and |
34 // FrameHostMsg_BeginNavigation. | 46 // FrameHostMsg_BeginNavigation. |
35 | 47 |
36 // Provided by the browser or the renderer ------------------------------------- | 48 // Provided by the browser or the renderer ------------------------------------- |
37 | 49 |
38 // Used by all navigation IPCs. | 50 // Used by all navigation IPCs. |
39 struct CONTENT_EXPORT CommonNavigationParams { | 51 struct CONTENT_EXPORT CommonNavigationParams { |
40 CommonNavigationParams(); | 52 CommonNavigationParams(); |
41 CommonNavigationParams(const GURL& url, | 53 CommonNavigationParams(const GURL& url, |
42 const Referrer& referrer, | 54 const Referrer& referrer, |
43 ui::PageTransition transition, | 55 ui::PageTransition transition, |
44 FrameMsg_Navigate_Type::Value navigation_type, | 56 FrameMsg_Navigate_Type::Value navigation_type, |
45 bool allow_download, | 57 bool allow_download, |
46 bool should_replace_current_entry, | 58 bool should_replace_current_entry, |
47 base::TimeTicks ui_timestamp, | 59 base::TimeTicks ui_timestamp, |
48 FrameMsg_UILoadMetricsReportType::Value report_type, | 60 FrameMsg_UILoadMetricsReportType::Value report_type, |
49 const GURL& base_url_for_data_url, | 61 const GURL& base_url_for_data_url, |
50 const GURL& history_url_for_data_url); | 62 const GURL& history_url_for_data_url, |
| 63 LoFiState lofi_state); |
51 ~CommonNavigationParams(); | 64 ~CommonNavigationParams(); |
52 | 65 |
53 // The URL to navigate to. | 66 // The URL to navigate to. |
54 // PlzNavigate: May be modified when the navigation is ready to commit. | 67 // PlzNavigate: May be modified when the navigation is ready to commit. |
55 GURL url; | 68 GURL url; |
56 | 69 |
57 // The URL to send in the "Referer" header field. Can be empty if there is | 70 // The URL to send in the "Referer" header field. Can be empty if there is |
58 // no referrer. | 71 // no referrer. |
59 Referrer referrer; | 72 Referrer referrer; |
60 | 73 |
(...skipping 22 matching lines...) Expand all Loading... |
83 // The report type to be used when recording the metric using |ui_timestamp|. | 96 // The report type to be used when recording the metric using |ui_timestamp|. |
84 FrameMsg_UILoadMetricsReportType::Value report_type; | 97 FrameMsg_UILoadMetricsReportType::Value report_type; |
85 | 98 |
86 // Base URL for use in Blink's SubstituteData. | 99 // Base URL for use in Blink's SubstituteData. |
87 // Is only used with data: URLs. | 100 // Is only used with data: URLs. |
88 GURL base_url_for_data_url; | 101 GURL base_url_for_data_url; |
89 | 102 |
90 // History URL for use in Blink's SubstituteData. | 103 // History URL for use in Blink's SubstituteData. |
91 // Is only used with data: URLs. | 104 // Is only used with data: URLs. |
92 GURL history_url_for_data_url; | 105 GURL history_url_for_data_url; |
| 106 |
| 107 // Whether or not to request a LoFi version of the document or let the browser |
| 108 // decide. |
| 109 LoFiState lofi_state; |
93 }; | 110 }; |
94 | 111 |
95 // Provided by the renderer ---------------------------------------------------- | 112 // Provided by the renderer ---------------------------------------------------- |
96 // | 113 // |
97 // This struct holds parameters sent by the renderer to the browser. It is only | 114 // This struct holds parameters sent by the renderer to the browser. It is only |
98 // used in PlzNavigate (since in the current architecture, the renderer does not | 115 // used in PlzNavigate (since in the current architecture, the renderer does not |
99 // inform the browser of navigations until they commit). | 116 // inform the browser of navigations until they commit). |
100 | 117 |
101 // This struct is not used outside of the PlzNavigate project. | 118 // This struct is not used outside of the PlzNavigate project. |
102 // PlzNavigate: parameters needed to start a navigation on the IO thread, | 119 // PlzNavigate: parameters needed to start a navigation on the IO thread, |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 ~NavigationParams(); | 301 ~NavigationParams(); |
285 | 302 |
286 CommonNavigationParams common_params; | 303 CommonNavigationParams common_params; |
287 StartNavigationParams start_params; | 304 StartNavigationParams start_params; |
288 RequestNavigationParams request_params; | 305 RequestNavigationParams request_params; |
289 }; | 306 }; |
290 | 307 |
291 } // namespace content | 308 } // namespace content |
292 | 309 |
293 #endif // CONTENT_COMMON_NAVIGATION_PARAMS_H_ | 310 #endif // CONTENT_COMMON_NAVIGATION_PARAMS_H_ |
OLD | NEW |