| 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" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 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). |
| 33 if (entry.GetTransitionType() == (content::PAGE_TRANSITION_GENERATED | | 33 if (entry.GetTransitionType() == (ui::PAGE_TRANSITION_GENERATED | |
| 34 content::PAGE_TRANSITION_FROM_ADDRESS_BAR)) { | 34 ui::PAGE_TRANSITION_FROM_ADDRESS_BAR)) { |
| 35 return GoogleSearchMetrics::AP_OMNIBOX; | 35 return GoogleSearchMetrics::AP_OMNIBOX; |
| 36 } | 36 } |
| 37 | 37 |
| 38 // The string "source=search_app" in the |entry| URL represents a Google | 38 // The string "source=search_app" in the |entry| URL represents a Google |
| 39 // search from the Google Search App. | 39 // search from the Google Search App. |
| 40 if (entry.GetURL().query().find("source=search_app") != std::string::npos) | 40 if (entry.GetURL().query().find("source=search_app") != std::string::npos) |
| 41 return GoogleSearchMetrics::AP_SEARCH_APP; | 41 return GoogleSearchMetrics::AP_SEARCH_APP; |
| 42 | 42 |
| 43 // For all other cases that we have not yet implemented or care to measure, we | 43 // For all other cases that we have not yet implemented or care to measure, we |
| 44 // log a generic "catch-all" metric. | 44 // log a generic "catch-all" metric. |
| (...skipping 46 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 |