Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Side by Side Diff: content/common/navigation_params.h

Issue 2720763002: PlzNavigate: preserve SourceLocation when navigating (Closed)
Patch Set: Addressed nate's comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
(...skipping 18 matching lines...) Expand all
29 #include "url/origin.h" 29 #include "url/origin.h"
30 30
31 namespace content { 31 namespace content {
32 32
33 // PlzNavigate 33 // PlzNavigate
34 // Helper function to determine if the navigation to |url| should make a request 34 // Helper function to determine if the navigation to |url| should make a request
35 // to the network stack. A request should not be sent for JavaScript URLs or 35 // to the network stack. A request should not be sent for JavaScript URLs or
36 // about:blank. In these cases, no request needs to be sent. 36 // about:blank. In these cases, no request needs to be sent.
37 bool CONTENT_EXPORT ShouldMakeNetworkRequestForURL(const GURL& url); 37 bool CONTENT_EXPORT ShouldMakeNetworkRequestForURL(const GURL& url);
38 38
39 // PlzNavigate
40 // Struct keeping track of the Javascript SourceLocation that triggered the
41 // navigation. This is initialized based on information from Blink at the start
42 // of navigation, and passed back to Blink when the navigation commits.
43 struct CONTENT_EXPORT SourceLocation {
44 SourceLocation();
45 SourceLocation(const std::string& url,
46 unsigned int line_number,
47 unsigned int column_number);
48 ~SourceLocation();
49 std::string url;
50 unsigned int line_number;
51 unsigned int column_number;
52 };
53
39 // The following structures hold parameters used during a navigation. In 54 // The following structures hold parameters used during a navigation. In
40 // particular they are used by FrameMsg_Navigate, FrameMsg_CommitNavigation and 55 // particular they are used by FrameMsg_Navigate, FrameMsg_CommitNavigation and
41 // FrameHostMsg_BeginNavigation. 56 // FrameHostMsg_BeginNavigation.
42 57
43 // Provided by the browser or the renderer ------------------------------------- 58 // Provided by the browser or the renderer -------------------------------------
44 59
45 // Used by all navigation IPCs. 60 // Used by all navigation IPCs.
46 struct CONTENT_EXPORT CommonNavigationParams { 61 struct CONTENT_EXPORT CommonNavigationParams {
47 CommonNavigationParams(); 62 CommonNavigationParams();
48 CommonNavigationParams( 63 CommonNavigationParams(
49 const GURL& url, 64 const GURL& url,
50 const Referrer& referrer, 65 const Referrer& referrer,
51 ui::PageTransition transition, 66 ui::PageTransition transition,
52 FrameMsg_Navigate_Type::Value navigation_type, 67 FrameMsg_Navigate_Type::Value navigation_type,
53 bool allow_download, 68 bool allow_download,
54 bool should_replace_current_entry, 69 bool should_replace_current_entry,
55 base::TimeTicks ui_timestamp, 70 base::TimeTicks ui_timestamp,
56 FrameMsg_UILoadMetricsReportType::Value report_type, 71 FrameMsg_UILoadMetricsReportType::Value report_type,
57 const GURL& base_url_for_data_url, 72 const GURL& base_url_for_data_url,
58 const GURL& history_url_for_data_url, 73 const GURL& history_url_for_data_url,
59 PreviewsState previews_state, 74 PreviewsState previews_state,
60 const base::TimeTicks& navigation_start, 75 const base::TimeTicks& navigation_start,
61 std::string method, 76 std::string method,
62 const scoped_refptr<ResourceRequestBodyImpl>& post_data); 77 const scoped_refptr<ResourceRequestBodyImpl>& post_data,
78 base::Optional<SourceLocation> source_location);
63 CommonNavigationParams(const CommonNavigationParams& other); 79 CommonNavigationParams(const CommonNavigationParams& other);
64 ~CommonNavigationParams(); 80 ~CommonNavigationParams();
65 81
66 // The URL to navigate to. 82 // The URL to navigate to.
67 // PlzNavigate: May be modified when the navigation is ready to commit. 83 // PlzNavigate: May be modified when the navigation is ready to commit.
68 GURL url; 84 GURL url;
69 85
70 // The URL to send in the "Referer" header field. Can be empty if there is 86 // The URL to send in the "Referer" header field. Can be empty if there is
71 // no referrer. 87 // no referrer.
72 Referrer referrer; 88 Referrer referrer;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // navigation_start value in Blink. 129 // navigation_start value in Blink.
114 // PlzNavigate: For renderer initiated navigations, this will be set on the 130 // PlzNavigate: For renderer initiated navigations, this will be set on the
115 // renderer side and sent with FrameHostMsg_BeginNavigation. 131 // renderer side and sent with FrameHostMsg_BeginNavigation.
116 base::TimeTicks navigation_start; 132 base::TimeTicks navigation_start;
117 133
118 // The request method: GET, POST, etc. 134 // The request method: GET, POST, etc.
119 std::string method; 135 std::string method;
120 136
121 // Body of HTTP POST request. 137 // Body of HTTP POST request.
122 scoped_refptr<ResourceRequestBodyImpl> post_data; 138 scoped_refptr<ResourceRequestBodyImpl> post_data;
139
140 // PlzNavigate
141 // Information about the javascript source for this navigation. Used for
nasko 2017/03/02 23:56:04 nit: Be consistent with the capitalization of "Jav
clamy 2017/03/06 13:27:53 Done.
142 // providing information in console error messages triggered by the
143 // navigation. If the navigation was not caused by Javascript, this should not
144 // be set.
145 base::Optional<SourceLocation> source_location;
123 }; 146 };
124 147
125 // Provided by the renderer ---------------------------------------------------- 148 // Provided by the renderer ----------------------------------------------------
126 // 149 //
127 // This struct holds parameters sent by the renderer to the browser. It is only 150 // This struct holds parameters sent by the renderer to the browser. It is only
128 // used in PlzNavigate (since in the current architecture, the renderer does not 151 // used in PlzNavigate (since in the current architecture, the renderer does not
129 // inform the browser of navigations until they commit). 152 // inform the browser of navigations until they commit).
130 153
131 // This struct is not used outside of the PlzNavigate project. 154 // This struct is not used outside of the PlzNavigate project.
132 // PlzNavigate: parameters needed to start a navigation on the IO thread, 155 // PlzNavigate: parameters needed to start a navigation on the IO thread,
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 ~NavigationParams(); 388 ~NavigationParams();
366 389
367 CommonNavigationParams common_params; 390 CommonNavigationParams common_params;
368 StartNavigationParams start_params; 391 StartNavigationParams start_params;
369 RequestNavigationParams request_params; 392 RequestNavigationParams request_params;
370 }; 393 };
371 394
372 } // namespace content 395 } // namespace content
373 396
374 #endif // CONTENT_COMMON_NAVIGATION_PARAMS_H_ 397 #endif // CONTENT_COMMON_NAVIGATION_PARAMS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698