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

Unified Diff: content/common/navigation_params.h

Issue 2720763002: PlzNavigate: preserve SourceLocation when navigating (Closed)
Patch Set: Addressed nate's comments Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: content/common/navigation_params.h
diff --git a/content/common/navigation_params.h b/content/common/navigation_params.h
index 105130740e309c150cf97dfef2ef918ad4a14e2d..adf7ac46a64c75cf5d86dbd25e766d9434de9ec8 100644
--- a/content/common/navigation_params.h
+++ b/content/common/navigation_params.h
@@ -36,6 +36,21 @@ namespace content {
// about:blank. In these cases, no request needs to be sent.
bool CONTENT_EXPORT ShouldMakeNetworkRequestForURL(const GURL& url);
+// PlzNavigate
+// Struct keeping track of the Javascript SourceLocation that triggered the
+// navigation. This is initialized based on information from Blink at the start
+// of navigation, and passed back to Blink when the navigation commits.
+struct CONTENT_EXPORT SourceLocation {
+ SourceLocation();
+ SourceLocation(const std::string& url,
+ unsigned int line_number,
+ unsigned int column_number);
+ ~SourceLocation();
+ std::string url;
+ unsigned int line_number;
+ unsigned int column_number;
+};
+
// The following structures hold parameters used during a navigation. In
// particular they are used by FrameMsg_Navigate, FrameMsg_CommitNavigation and
// FrameHostMsg_BeginNavigation.
@@ -59,7 +74,8 @@ struct CONTENT_EXPORT CommonNavigationParams {
PreviewsState previews_state,
const base::TimeTicks& navigation_start,
std::string method,
- const scoped_refptr<ResourceRequestBodyImpl>& post_data);
+ const scoped_refptr<ResourceRequestBodyImpl>& post_data,
+ base::Optional<SourceLocation> source_location);
CommonNavigationParams(const CommonNavigationParams& other);
~CommonNavigationParams();
@@ -120,6 +136,13 @@ struct CONTENT_EXPORT CommonNavigationParams {
// Body of HTTP POST request.
scoped_refptr<ResourceRequestBodyImpl> post_data;
+
+ // PlzNavigate
+ // 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.
+ // providing information in console error messages triggered by the
+ // navigation. If the navigation was not caused by Javascript, this should not
+ // be set.
+ base::Optional<SourceLocation> source_location;
};
// Provided by the renderer ----------------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698