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
3 // found in the LICENSE file.
5 #ifndef CONTENT_COMMON_NAVIGATION_PARAMS_H_
6 #define CONTENT_COMMON_NAVIGATION_PARAMS_H_
10 #include "base/basictypes.h"
11 #include "base/time/time.h"
12 #include "content/common/content_export.h"
13 #include "content/common/frame_message_enums.h"
14 #include "content/public/common/page_state.h"
15 #include "content/public/common/referrer.h"
16 #include "ui/base/page_transition_types.h"
20 class RefCountedMemory
;
24 class NavigationEntry
;
26 // The following structures hold parameters used during a navigation. In
27 // particular they are used by FrameMsg_Navigate, FrameMsg_CommitNavigation and
28 // FrameHostMsg_BeginNavigation.
29 // TODO(clamy): Depending on the avancement of the history refactoring move the
30 // history parameters from FrameMsg_Navigate into one of the structs.
32 // Used by all navigation IPCs.
33 struct CONTENT_EXPORT CommonNavigationParams
{
34 CommonNavigationParams();
35 CommonNavigationParams(const GURL
& url
,
36 const Referrer
& referrer
,
37 ui::PageTransition transition
,
38 FrameMsg_Navigate_Type::Value navigation_type
,
40 base::TimeTicks ui_timestamp
,
41 FrameMsg_UILoadMetricsReportType::Value report_type
,
42 const GURL
& base_url_for_data_url
,
43 const GURL
& history_url_for_data_url
);
44 ~CommonNavigationParams();
46 // The URL to navigate to.
47 // PlzNavigate: May be modified when the navigation is ready to commit.
50 // The URL to send in the "Referer" header field. Can be empty if there is
54 // The type of transition.
55 ui::PageTransition transition
;
57 // Type of navigation.
58 FrameMsg_Navigate_Type::Value navigation_type
;
60 // Allows the URL to be downloaded (true by default).
61 // Avoid downloading when in view-source mode.
64 // Timestamp of the user input event that triggered this navigation. Empty if
65 // the navigation was not triggered by clicking on a link or by receiving an
67 base::TimeTicks ui_timestamp
;
69 // The report type to be used when recording the metric using |ui_timestamp|.
70 FrameMsg_UILoadMetricsReportType::Value report_type
;
72 // Base URL for use in Blink's SubstituteData.
73 // Is only used with data: URLs.
74 GURL base_url_for_data_url
;
76 // History URL for use in Blink's SubstituteData.
77 // Is only used with data: URLs.
78 GURL history_url_for_data_url
;
81 // PlzNavigate: parameters needed to start a navigation on the IO thread.
82 struct CONTENT_EXPORT BeginNavigationParams
{
83 // TODO(clamy): See if it is possible to reuse this in
84 // ResourceMsg_Request_Params.
85 BeginNavigationParams();
86 BeginNavigationParams(std::string method
,
89 bool has_user_gesture
);
91 // The request method: GET, POST, etc.
94 // Additional HTTP request headers.
97 // net::URLRequest load flags (net::LOAD_NORMAL) by default).
100 // True if the request was user initiated.
101 bool has_user_gesture
;
104 // Used by FrameMsg_Navigate.
105 // PlzNavigate: sent to the renderer when the navigation is ready to commit.
106 struct CONTENT_EXPORT CommitNavigationParams
{
107 CommitNavigationParams();
108 CommitNavigationParams(const PageState
& page_state
,
109 bool is_overriding_user_agent
,
110 base::TimeTicks navigation_start
);
111 ~CommitNavigationParams();
113 // Opaque history state (received by ViewHostMsg_UpdateState).
114 PageState page_state
;
116 // Whether or not the user agent override string should be used.
117 bool is_overriding_user_agent
;
119 // The navigationStart time to expose through the Navigation Timing API to JS.
120 base::TimeTicks browser_navigation_start
;
122 // TODO(clamy): Move the redirect chain here.
125 } // namespace content
127 #endif // CONTENT_COMMON_NAVIGATION_PARAMS_H_