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 "ui/base/page_transition_types.h" | 16 #include "ui/base/page_transition_types.h" |
17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class RefCountedMemory; | 20 class RefCountedMemory; |
21 } | 21 } |
22 | 22 |
23 namespace content { | 23 namespace content { |
24 class NavigationEntry; | 24 class NavigationEntry; |
25 | 25 |
26 // PlzNavigate | |
27 // Helper function that returns true if a network request should be made for the | |
28 // navigation to |url|. | |
29 bool ShouldMakeNetworkRequestForNavigation(const GURL& url); | |
clamy
2015/02/16 18:00:44
This function is used both in the renderer and the
Charlie Reis
2015/02/18 00:43:25
I think the premise on this one might be a bit fla
clamy
2015/02/20 17:05:59
I moved it to NavigationRequest where the context
| |
30 | |
26 // The following structures hold parameters used during a navigation. In | 31 // The following structures hold parameters used during a navigation. In |
27 // particular they are used by FrameMsg_Navigate, FrameMsg_CommitNavigation and | 32 // particular they are used by FrameMsg_Navigate, FrameMsg_CommitNavigation and |
28 // FrameHostMsg_BeginNavigation. | 33 // FrameHostMsg_BeginNavigation. |
29 // TODO(clamy): Depending on the avancement of the history refactoring move the | 34 // TODO(clamy): Depending on the avancement of the history refactoring move the |
30 // history parameters from FrameMsg_Navigate into one of the structs. | 35 // history parameters from FrameMsg_Navigate into one of the structs. |
31 | 36 |
32 // Used by all navigation IPCs. | 37 // Used by all navigation IPCs. |
33 struct CONTENT_EXPORT CommonNavigationParams { | 38 struct CONTENT_EXPORT CommonNavigationParams { |
34 CommonNavigationParams(); | 39 CommonNavigationParams(); |
35 CommonNavigationParams(const GURL& url, | 40 CommonNavigationParams(const GURL& url, |
36 const Referrer& referrer, | 41 const Referrer& referrer, |
37 ui::PageTransition transition, | 42 ui::PageTransition transition, |
38 FrameMsg_Navigate_Type::Value navigation_type, | 43 FrameMsg_Navigate_Type::Value navigation_type, |
39 bool allow_download, | 44 bool allow_download, |
40 base::TimeTicks ui_timestamp, | 45 base::TimeTicks ui_timestamp, |
41 FrameMsg_UILoadMetricsReportType::Value report_type); | 46 FrameMsg_UILoadMetricsReportType::Value report_type, |
47 const GURL& base_url_for_data_url, | |
48 const GURL& history_url_for_data_url); | |
42 ~CommonNavigationParams(); | 49 ~CommonNavigationParams(); |
43 | 50 |
44 // The URL to navigate to. | 51 // The URL to navigate to. |
45 // PlzNavigate: May be modified when the navigation is ready to commit. | 52 // PlzNavigate: May be modified when the navigation is ready to commit. |
46 GURL url; | 53 GURL url; |
47 | 54 |
48 // The URL to send in the "Referer" header field. Can be empty if there is | 55 // The URL to send in the "Referer" header field. Can be empty if there is |
49 // no referrer. | 56 // no referrer. |
50 Referrer referrer; | 57 Referrer referrer; |
51 | 58 |
52 // The type of transition. | 59 // The type of transition. |
53 ui::PageTransition transition; | 60 ui::PageTransition transition; |
54 | 61 |
55 // Type of navigation. | 62 // Type of navigation. |
56 FrameMsg_Navigate_Type::Value navigation_type; | 63 FrameMsg_Navigate_Type::Value navigation_type; |
57 | 64 |
58 // Allows the URL to be downloaded (true by default). | 65 // Allows the URL to be downloaded (true by default). |
59 // Avoid downloading when in view-source mode. | 66 // Avoid downloading when in view-source mode. |
60 bool allow_download; | 67 bool allow_download; |
61 | 68 |
62 // Timestamp of the user input event that triggered this navigation. Empty if | 69 // Timestamp of the user input event that triggered this navigation. Empty if |
63 // the navigation was not triggered by clicking on a link or by receiving an | 70 // the navigation was not triggered by clicking on a link or by receiving an |
64 // intent on Android. | 71 // intent on Android. |
65 base::TimeTicks ui_timestamp; | 72 base::TimeTicks ui_timestamp; |
66 | 73 |
67 // The report type to be used when recording the metric using |ui_timestamp|. | 74 // The report type to be used when recording the metric using |ui_timestamp|. |
68 FrameMsg_UILoadMetricsReportType::Value report_type; | 75 FrameMsg_UILoadMetricsReportType::Value report_type; |
76 | |
77 // Base URL for use in blink's SubstituteData. | |
78 // Is only used with data: URLs. | |
79 GURL base_url_for_data_url; | |
80 | |
81 // History URL for use in blink's SubstituteData. | |
82 // Is only used with data: URLs. | |
83 GURL history_url_for_data_url; | |
69 }; | 84 }; |
70 | 85 |
71 // PlzNavigate: parameters needed to start a navigation on the IO thread. | 86 // PlzNavigate: parameters needed to start a navigation on the IO thread. |
72 struct CONTENT_EXPORT BeginNavigationParams { | 87 struct CONTENT_EXPORT BeginNavigationParams { |
73 // TODO(clamy): See if it is possible to reuse this in | 88 // TODO(clamy): See if it is possible to reuse this in |
74 // ResourceMsg_Request_Params. | 89 // ResourceMsg_Request_Params. |
75 BeginNavigationParams(); | 90 BeginNavigationParams(); |
76 BeginNavigationParams(std::string method, | 91 BeginNavigationParams(std::string method, |
77 std::string headers, | 92 std::string headers, |
78 int load_flags, | 93 int load_flags, |
(...skipping 29 matching lines...) Expand all Loading... | |
108 | 123 |
109 // The navigationStart time to expose through the Navigation Timing API to JS. | 124 // The navigationStart time to expose through the Navigation Timing API to JS. |
110 base::TimeTicks browser_navigation_start; | 125 base::TimeTicks browser_navigation_start; |
111 | 126 |
112 // TODO(clamy): Move the redirect chain here. | 127 // TODO(clamy): Move the redirect chain here. |
113 }; | 128 }; |
114 | 129 |
115 } // namespace content | 130 } // namespace content |
116 | 131 |
117 #endif // CONTENT_COMMON_NAVIGATION_PARAMS_H_ | 132 #endif // CONTENT_COMMON_NAVIGATION_PARAMS_H_ |
OLD | NEW |