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