| 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/optional.h" | 14 #include "base/optional.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
| 18 #include "content/common/frame_message_enums.h" | 18 #include "content/common/frame_message_enums.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 #include "url/origin.h" | 27 #include "url/origin.h" |
| 27 | 28 |
| 28 namespace content { | 29 namespace content { |
| 29 | 30 |
| 30 // The LoFi state which determines whether to add the Lo-Fi header. | |
| 31 enum LoFiState { | |
| 32 // Let the browser process decide whether or not to request the Lo-Fi version. | |
| 33 LOFI_UNSPECIFIED = 0, | |
| 34 | |
| 35 // Request a normal (non-Lo-Fi) version of the resource. | |
| 36 LOFI_OFF, | |
| 37 | |
| 38 // Request a Lo-Fi version of the resource. | |
| 39 LOFI_ON, | |
| 40 }; | |
| 41 | |
| 42 // PlzNavigate | 31 // PlzNavigate |
| 43 // Helper function to determine if the navigation to |url| should make a request | 32 // Helper function to determine if the navigation to |url| should make a request |
| 44 // to the network stack. A request should not be sent for JavaScript URLs or | 33 // to the network stack. A request should not be sent for JavaScript URLs or |
| 45 // about:blank. In these cases, no request needs to be sent. | 34 // about:blank. In these cases, no request needs to be sent. |
| 46 bool CONTENT_EXPORT ShouldMakeNetworkRequestForURL(const GURL& url); | 35 bool CONTENT_EXPORT ShouldMakeNetworkRequestForURL(const GURL& url); |
| 47 | 36 |
| 48 // The following structures hold parameters used during a navigation. In | 37 // The following structures hold parameters used during a navigation. In |
| 49 // particular they are used by FrameMsg_Navigate, FrameMsg_CommitNavigation and | 38 // particular they are used by FrameMsg_Navigate, FrameMsg_CommitNavigation and |
| 50 // FrameHostMsg_BeginNavigation. | 39 // FrameHostMsg_BeginNavigation. |
| 51 | 40 |
| 52 // Provided by the browser or the renderer ------------------------------------- | 41 // Provided by the browser or the renderer ------------------------------------- |
| 53 | 42 |
| 54 // Used by all navigation IPCs. | 43 // Used by all navigation IPCs. |
| 55 struct CONTENT_EXPORT CommonNavigationParams { | 44 struct CONTENT_EXPORT CommonNavigationParams { |
| 56 CommonNavigationParams(); | 45 CommonNavigationParams(); |
| 57 CommonNavigationParams( | 46 CommonNavigationParams( |
| 58 const GURL& url, | 47 const GURL& url, |
| 59 const Referrer& referrer, | 48 const Referrer& referrer, |
| 60 ui::PageTransition transition, | 49 ui::PageTransition transition, |
| 61 FrameMsg_Navigate_Type::Value navigation_type, | 50 FrameMsg_Navigate_Type::Value navigation_type, |
| 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 27 matching lines...) Expand all Loading... |
| 106 FrameMsg_UILoadMetricsReportType::Value report_type; | 95 FrameMsg_UILoadMetricsReportType::Value report_type; |
| 107 | 96 |
| 108 // Base URL for use in Blink's SubstituteData. | 97 // Base URL for use in Blink's SubstituteData. |
| 109 // Is only used with data: URLs. | 98 // Is only used with data: URLs. |
| 110 GURL base_url_for_data_url; | 99 GURL base_url_for_data_url; |
| 111 | 100 |
| 112 // History URL for use in Blink's SubstituteData. | 101 // History URL for use in Blink's SubstituteData. |
| 113 // Is only used with data: URLs. | 102 // Is only used with data: URLs. |
| 114 GURL history_url_for_data_url; | 103 GURL history_url_for_data_url; |
| 115 | 104 |
| 116 // Whether or not to request a LoFi version of the document or let the browser | 105 // Bitmask that has whether or not to request a Preview version of the |
| 117 // decide. | 106 // document for various preview types or let the browser decide. |
| 118 LoFiState lofi_state; | 107 PreviewsState previews_state; |
| 119 | 108 |
| 120 // The navigationStart time exposed through the Navigation Timing API to JS. | 109 // The navigationStart time exposed through the Navigation Timing API to JS. |
| 121 // If this is for a browser-initiated navigation, this can override the | 110 // If this is for a browser-initiated navigation, this can override the |
| 122 // navigation_start value in Blink. | 111 // navigation_start value in Blink. |
| 123 // PlzNavigate: For renderer initiated navigations, this will be set on the | 112 // PlzNavigate: For renderer initiated navigations, this will be set on the |
| 124 // renderer side and sent with FrameHostMsg_BeginNavigation. | 113 // renderer side and sent with FrameHostMsg_BeginNavigation. |
| 125 base::TimeTicks navigation_start; | 114 base::TimeTicks navigation_start; |
| 126 | 115 |
| 127 // The request method: GET, POST, etc. | 116 // The request method: GET, POST, etc. |
| 128 std::string method; | 117 std::string method; |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 ~NavigationParams(); | 348 ~NavigationParams(); |
| 360 | 349 |
| 361 CommonNavigationParams common_params; | 350 CommonNavigationParams common_params; |
| 362 StartNavigationParams start_params; | 351 StartNavigationParams start_params; |
| 363 RequestNavigationParams request_params; | 352 RequestNavigationParams request_params; |
| 364 }; | 353 }; |
| 365 | 354 |
| 366 } // namespace content | 355 } // namespace content |
| 367 | 356 |
| 368 #endif // CONTENT_COMMON_NAVIGATION_PARAMS_H_ | 357 #endif // CONTENT_COMMON_NAVIGATION_PARAMS_H_ |
| OLD | NEW |