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

Unified Diff: chrome/browser/metrics/metrics_service.cc

Issue 21395002: [InstantExtended] Fixing how PageLoadSRP is emitted. Previously it was emitted only for Instant sea… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: last upload didn't seem to work Created 7 years, 5 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: chrome/browser/metrics/metrics_service.cc
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc
index d48eb7b747a3fd64c839d25958b888d10d4cbce1..5f587c80b1f681a6d501aa5bb191dff3f5fcef0d 100644
--- a/chrome/browser/metrics/metrics_service.cc
+++ b/chrome/browser/metrics/metrics_service.cc
@@ -188,6 +188,8 @@
#include "chrome/browser/omnibox/omnibox_log.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/search_engines/template_url_service.h"
+#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_otr_state.h"
#include "chrome/browser/ui/search/search_tab_helper.h"
@@ -1516,12 +1518,15 @@ void MetricsService::LogLoadStarted(content::WebContents* web_contents) {
// Track whether the page loaded is a search results page.
if (web_contents) {
- SearchTabHelper* search_tab_helper =
- SearchTabHelper::FromWebContents(web_contents);
- if (search_tab_helper) {
- if (search_tab_helper->model()->mode().is_search_results())
- content::RecordAction(content::UserMetricsAction("PageLoadSRP"));
- }
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents->GetBrowserContext());
+ bool is_search_results =
+ TemplateURLServiceFactory::GetForProfile(profile)->
+ IsSearchResultsPageFromDefaultSearchProvider(
+ web_contents->GetLastCommittedURL());
rpetterson 2013/07/31 22:49:21 My biggest dilemma is here. I have available the L
Mark P 2013/07/31 23:16:49 What do you mean by this? I know we emit PageLoad
Peter Kasting 2013/07/31 23:56:51 What you want depends on what this metric means an
+ if (is_search_results)
+ content::RecordAction(
+ content::UserMetricsAction("PageLoadSRPonDefaultSearchProvider"));
}
}

Powered by Google App Engine
This is Rietveld 408576698