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

Unified Diff: chrome/browser/predictors/resource_prefetch_common.cc

Issue 2545943003: Accessing navigation information via webcontents (Closed)
Patch Set: Post-Review Modifications Created 4 years 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: chrome/browser/predictors/resource_prefetch_common.cc
diff --git a/chrome/browser/predictors/resource_prefetch_common.cc b/chrome/browser/predictors/resource_prefetch_common.cc
index 8cd02209b3ec65cff4677f920ec98cd3742d119c..3fa8e379319380cdedd3ff3133bdcbe991bec1e1 100644
--- a/chrome/browser/predictors/resource_prefetch_common.cc
+++ b/chrome/browser/predictors/resource_prefetch_common.cc
@@ -16,6 +16,7 @@
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
+#include "net/url_request/url_request.h"
ahemery 2016/12/06 14:59:17 Relic from try&error
namespace predictors {
@@ -81,13 +82,6 @@ NavigationID::NavigationID()
render_frame_id(-1) {
}
-NavigationID::NavigationID(int render_process_id,
- int render_frame_id,
- const GURL& main_frame_url)
- : render_process_id(render_process_id),
- render_frame_id(render_frame_id),
- main_frame_url(main_frame_url) {}
-
NavigationID::NavigationID(const NavigationID& other)
: render_process_id(other.render_process_id),
render_frame_id(other.render_frame_id),
@@ -101,6 +95,15 @@ NavigationID::NavigationID(content::WebContents* web_contents)
main_frame_url(web_contents->GetURL()) {
}
+NavigationID::NavigationID(content::WebContents* web_contents,
+ const GURL& main_frame_url,
+ const base::TimeTicks& creation_time)
+ : render_process_id(web_contents->GetRenderProcessHost()->GetID()),
+ render_frame_id(web_contents->GetMainFrame()->GetRoutingID()),
+ main_frame_url(main_frame_url),
+ creation_time(creation_time) {
+}
+
bool NavigationID::is_valid() const {
return render_process_id != -1 && render_frame_id != -1 &&
!main_frame_url.is_empty();

Powered by Google App Engine
This is Rietveld 408576698