| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/google/google_search_counter.h" | 5 #include "chrome/browser/google/google_search_counter.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "components/google/core/browser/google_util.h" | 8 #include "components/google/core/browser/google_util.h" |
| 9 #include "content/public/browser/navigation_controller.h" | 9 #include "content/public/browser/navigation_controller.h" |
| 10 #include "content/public/browser/navigation_details.h" | 10 #include "content/public/browser/navigation_details.h" |
| 11 #include "content/public/browser/navigation_entry.h" | 11 #include "content/public/browser/navigation_entry.h" |
| 12 #include "content/public/browser/notification_service.h" | 12 #include "content/public/browser/notification_service.h" |
| 13 #include "content/public/browser/notification_types.h" | 13 #include "content/public/browser/notification_types.h" |
| 14 | 14 |
| 15 // static | 15 // static |
| 16 void GoogleSearchCounter::RegisterForNotifications() { | 16 void GoogleSearchCounter::RegisterForNotifications() { |
| 17 GoogleSearchCounter::GetInstance()->RegisterForNotificationsInternal(); | 17 GoogleSearchCounter::GetInstance()->RegisterForNotificationsInternal(); |
| 18 } | 18 } |
| 19 | 19 |
| 20 // static | 20 // static |
| 21 GoogleSearchCounter* GoogleSearchCounter::GetInstance() { | 21 GoogleSearchCounter* GoogleSearchCounter::GetInstance() { |
| 22 return Singleton<GoogleSearchCounter>::get(); | 22 return base::Singleton<GoogleSearchCounter>::get(); |
| 23 } | 23 } |
| 24 | 24 |
| 25 GoogleSearchMetrics::AccessPoint | 25 GoogleSearchMetrics::AccessPoint |
| 26 GoogleSearchCounter::GetGoogleSearchAccessPointForSearchNavEntry( | 26 GoogleSearchCounter::GetGoogleSearchAccessPointForSearchNavEntry( |
| 27 const content::NavigationEntry& entry) const { | 27 const content::NavigationEntry& entry) const { |
| 28 DCHECK(google_util::IsGoogleSearchUrl(entry.GetURL())); | 28 DCHECK(google_util::IsGoogleSearchUrl(entry.GetURL())); |
| 29 | 29 |
| 30 // If the |entry| is FROM_ADDRESS_BAR, it comes from the omnibox; if it's | 30 // If the |entry| is FROM_ADDRESS_BAR, it comes from the omnibox; if it's |
| 31 // GENERATED, the user was doing a search, rather than doing a navigation to a | 31 // GENERATED, the user was doing a search, rather than doing a navigation to a |
| 32 // search URL (e.g. from hisotry, or pasted in). | 32 // search URL (e.g. from hisotry, or pasted in). |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 const content::NotificationSource& source, | 91 const content::NotificationSource& source, |
| 92 const content::NotificationDetails& details) { | 92 const content::NotificationDetails& details) { |
| 93 switch (type) { | 93 switch (type) { |
| 94 case content::NOTIFICATION_NAV_ENTRY_COMMITTED: | 94 case content::NOTIFICATION_NAV_ENTRY_COMMITTED: |
| 95 ProcessCommittedEntry(source, details); | 95 ProcessCommittedEntry(source, details); |
| 96 break; | 96 break; |
| 97 default: | 97 default: |
| 98 NOTREACHED(); | 98 NOTREACHED(); |
| 99 } | 99 } |
| 100 } | 100 } |
| OLD | NEW |