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

Side by Side Diff: chrome/browser/google/google_search_counter_android.cc

Issue 342053002: Add UMA metrics for Android Chrome Google Search. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed dupe check and updated omnibox search accesspoint check. Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/google/google_search_counter_android.h"
6
7 #include "base/logging.h"
8 #include "chrome/browser/google/google_search_counter.h"
9 #include "chrome/browser/google/google_util.h"
10 #include "chrome/browser/prerender/prerender_manager.h"
11 #include "chrome/browser/prerender/prerender_manager_factory.h"
12 #include "components/google/core/browser/google_search_metrics.h"
13 #include "content/public/browser/navigation_details.h"
14 #include "content/public/browser/navigation_entry.h"
15 #include "content/public/browser/notification_service.h"
16 #include "content/public/browser/notification_types.h"
17
18 GoogleSearchCounterAndroid::GoogleSearchCounterAndroid(Profile* profile)
19 : profile_(profile) {
20 // We always listen for all COMMITTED navigations from all sources, as any
21 // one of them could be a navigation of interest.
22 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
23 content::NotificationService::AllSources());
24 }
25
26 GoogleSearchCounterAndroid::~GoogleSearchCounterAndroid() {
27 }
28
29 void GoogleSearchCounterAndroid::ProcessCommittedEntry(
30 const content::NotificationSource& source,
31 const content::NotificationDetails& details) {
32 GoogleSearchCounter* counter = GoogleSearchCounter::GetInstance();
33 DCHECK(counter);
34 if (!counter->ShouldRecordCommittedDetails(details))
35 return;
36
37 const content::LoadCommittedDetails* commit =
38 content::Details<content::LoadCommittedDetails>(details).ptr();
39 const content::NavigationEntry& entry = *commit->entry;
Peter Kasting 2014/06/20 01:23:18 Nit: Could just be: const content::NavigationEn
kmadhusu 2014/06/20 01:40:50 Done.
40 prerender::PrerenderManager* prerender_manager =
41 prerender::PrerenderManagerFactory::GetForProfile(profile_);
42 DCHECK(prerender_manager);
43 counter->search_metrics()->RecordAndroidGoogleSearch(
44 google_util::GetGoogleSearchAccessPointForSearchNavEntry(entry),
45 prerender_manager->IsEnabled());
46 }
47
48 void GoogleSearchCounterAndroid::Observe(
49 int type,
50 const content::NotificationSource& source,
51 const content::NotificationDetails& details) {
52 DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_COMMITTED, type);
53 ProcessCommittedEntry(source, details);
54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698