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

Unified Diff: chrome/browser/prerender/prerender_observer.cc

Issue 7741002: Add code to keep track of what fraction of pageviews are top sites. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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
« no previous file with comments | « chrome/browser/prerender/prerender_observer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prerender/prerender_observer.cc
===================================================================
--- chrome/browser/prerender/prerender_observer.cc (revision 98138)
+++ chrome/browser/prerender/prerender_observer.cc (working copy)
@@ -80,6 +80,19 @@
base::Histogram* time_hover_until_click_;
};
+enum PAGEVIEW_EVENTS {
+ PAGEVIEW_EVENT_NEW_URL = 0,
+ PAGEVIEW_EVENT_TOP_SITE_NEW_URL = 1,
+ PAGEVIEW_EVENT_LOAD_START = 2,
+ PAGEVIEW_EVENT_TOP_SITE_LOAD_START = 3,
+ PAGEVIEW_EVENT_MAX = 4
+};
+
+void RecordPageviewEvent(PAGEVIEW_EVENTS event) {
+ UMA_HISTOGRAM_ENUMERATION("Prerender.PageviewEvents",
+ event, PAGEVIEW_EVENT_MAX);
+}
+
} // namespace
class PrerenderObserver::HoverData {
@@ -180,6 +193,9 @@
void PrerenderObserver::ProvisionalChangeToMainFrameUrl(const GURL& url,
bool has_opener_set) {
+ RecordPageviewEvent(PAGEVIEW_EVENT_NEW_URL);
+ if (IsTopSite(url))
+ RecordPageviewEvent(PAGEVIEW_EVENT_TOP_SITE_NEW_URL);
if (!tab_->delegate())
return; // PrerenderManager needs a delegate to handle the swap.
PrerenderManager* prerender_manager = MaybeGetPrerenderManager();
@@ -205,6 +221,10 @@
bool has_opener_set,
const GURL& url) {
if (is_main_frame) {
+ RecordPageviewEvent(PAGEVIEW_EVENT_LOAD_START);
+ if (IsTopSite(url))
+ RecordPageviewEvent(PAGEVIEW_EVENT_TOP_SITE_LOAD_START);
+
// Record the beginning of a new PPLT navigation.
pplt_load_start_ = base::TimeTicks::Now();
@@ -241,7 +261,7 @@
pplt_load_start_ = base::TimeTicks();
}
-PrerenderManager* PrerenderObserver::MaybeGetPrerenderManager() {
+PrerenderManager* PrerenderObserver::MaybeGetPrerenderManager() const {
Profile* profile =
Profile::FromBrowserContext(tab_contents()->browser_context());
return profile->GetPrerenderManager();
@@ -303,4 +323,9 @@
current_hover_url_ = GURL();
}
+bool PrerenderObserver::IsTopSite(const GURL& url) const {
+ PrerenderManager* pm = MaybeGetPrerenderManager();
+ return (pm && pm->IsTopSite(url));
+}
+
} // namespace prerender
« no previous file with comments | « chrome/browser/prerender/prerender_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698