Chromium Code Reviews| Index: chrome/browser/google/google_util.cc |
| diff --git a/chrome/browser/google/google_util.cc b/chrome/browser/google/google_util.cc |
| index f4d06810d7ef4a5eabb3f469bf102ff2a6bd9439..922fd9f10f1092f18738be6cf8e0e864cc2f9e72 100644 |
| --- a/chrome/browser/google/google_util.cc |
| +++ b/chrome/browser/google/google_util.cc |
| @@ -16,6 +16,7 @@ |
| #include "components/google/core/browser/google_switches.h" |
| #include "components/google/core/browser/google_url_tracker.h" |
| #include "components/url_fixer/url_fixer.h" |
| +#include "content/public/browser/navigation_entry.h" |
| #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| #include "net/base/url_util.h" |
| #include "url/gurl.h" |
| @@ -214,4 +215,23 @@ bool IsYoutubeDomainUrl(const GURL& url, |
| IsValidHostName(url.host(), "youtube", subdomain_permission); |
| } |
| +GoogleSearchMetrics::AccessPoint GetGoogleSearchAccessPointForSearchNavEntry( |
| + const content::NavigationEntry& entry) { |
| + DCHECK(google_util::IsGoogleSearchUrl(entry.GetURL())); |
| + |
| + // If the commit is a GENERATED commit with a Google search URL, we know it's |
| + // an Omnibox search. |
|
Peter Kasting
2014/06/20 01:23:18
Nit: This comment isn't quite accurate to the code
kmadhusu
2014/06/20 01:40:51
Done.
|
| + if (entry.GetTransitionType() == (content::PAGE_TRANSITION_GENERATED | |
| + content::PAGE_TRANSITION_FROM_ADDRESS_BAR)) { |
| + return GoogleSearchMetrics::AP_OMNIBOX; |
| + } |
| + |
| + // The string "source=search_app" in the |entry| URL represents a Google |
| + // search from the Google Search App. For all other cases that we have not yet |
| + // implemented or care to measure, we log a generic "catch-all" metric. |
| + return (entry.GetURL().query().find("source=search_app") != |
| + std::string::npos) ? GoogleSearchMetrics::AP_SEARCH_APP : |
| + GoogleSearchMetrics::AP_OTHER; |
|
Peter Kasting
2014/06/20 01:23:19
Nit: I think this would be more readable split up:
kmadhusu
2014/06/20 01:40:51
Done.
|
| +} |
| + |
| } // namespace google_util |