Blink roll 25b6bd3a7a131ffe68d809546ad1a20707915cdc:3a503f41ae42e5b79cfcd2ff10e65afde...
[chromium-blink-merge.git] / content / common / navigation_params.h
blobd30d382322dd815a452538c3157ac0bb1813265e
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_
8 #include <string>
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"
17 #include "url/gurl.h"
19 namespace base {
20 class RefCountedMemory;
23 namespace content {
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,
39 bool allow_download);
40 ~CommonNavigationParams();
42 // The URL to navigate to.
43 // PlzNavigate: May be modified when the navigation is ready to commit.
44 GURL url;
46 // The URL to send in the "Referer" header field. Can be empty if there is
47 // no referrer.
48 Referrer referrer;
50 // The type of transition.
51 ui::PageTransition transition;
53 // Type of navigation.
54 FrameMsg_Navigate_Type::Value navigation_type;
56 // Allows the URL to be downloaded (true by default).
57 // Avoid downloading when in view-source mode.
58 bool allow_download;
61 // Used by FrameMsg_Navigate.
62 // PlzNavigate: sent to the renderer when requesting a navigation.
63 struct CONTENT_EXPORT RequestNavigationParams {
64 RequestNavigationParams();
65 RequestNavigationParams(bool is_post,
66 const std::string& extra_headers,
67 const base::RefCountedMemory* post_data);
68 ~RequestNavigationParams();
70 // Whether the navigation is a POST request (as opposed to a GET).
71 bool is_post;
73 // Extra headers (separated by \n) to send during the request.
74 std::string extra_headers;
76 // If is_post is true, holds the post_data information from browser. Empty
77 // otherwise.
78 std::vector<unsigned char> browser_initiated_post_data;
81 // Used by FrameMsg_Navigate.
82 // PlzNavigate: sent to the renderer when the navigation is ready to commit.
83 struct CONTENT_EXPORT CommitNavigationParams {
84 CommitNavigationParams();
85 CommitNavigationParams(const PageState& page_state,
86 bool is_overriding_user_agent,
87 base::TimeTicks navigation_start);
88 ~CommitNavigationParams();
90 // Opaque history state (received by ViewHostMsg_UpdateState).
91 PageState page_state;
93 // Whether or not the user agent override string should be used.
94 bool is_overriding_user_agent;
96 // The navigationStart time to expose through the Navigation Timing API to JS.
97 base::TimeTicks browser_navigation_start;
99 // TODO(clamy): Move the redirect chain here.
102 } // namespace content
104 #endif // CONTENT_COMMON_NAVIGATION_PARAMS_H_