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 // Some Google related utility functions. | 5 // Some Google related utility functions. |
6 | 6 |
7 #ifndef CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ | 7 #ifndef CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ |
8 #define CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ | 8 #define CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "components/google/core/browser/google_search_metrics.h" |
13 | 14 |
14 class GURL; | 15 class GURL; |
15 | 16 |
| 17 namespace content { |
| 18 class NavigationEntry; |
| 19 } |
| 20 |
16 // This namespace provides various helpers around handling Google-related URLs. | 21 // This namespace provides various helpers around handling Google-related URLs. |
17 namespace google_util { | 22 namespace google_util { |
18 | 23 |
19 // True iff |str| contains a "q=" query parameter with a non-empty value. | 24 // True iff |str| contains a "q=" query parameter with a non-empty value. |
20 // |str| should be a query or a hash fragment, without the ? or # (as | 25 // |str| should be a query or a hash fragment, without the ? or # (as |
21 // returned by GURL::query() or GURL::ref(). | 26 // returned by GURL::query() or GURL::ref(). |
22 bool HasGoogleSearchQueryParam(const std::string& str); | 27 bool HasGoogleSearchQueryParam(const std::string& str); |
23 | 28 |
24 // The query key that identifies a Google Extended API request for Instant. | 29 // The query key that identifies a Google Extended API request for Instant. |
25 const char kInstantExtendedAPIParam[] = "espv"; | 30 const char kInstantExtendedAPIParam[] = "espv"; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // True if |url| represents a valid Google search URL. | 107 // True if |url| represents a valid Google search URL. |
103 bool IsGoogleSearchUrl(const GURL& url); | 108 bool IsGoogleSearchUrl(const GURL& url); |
104 | 109 |
105 // True if |url| is a valid youtube.<TLD> URL. If |port_permission| is | 110 // True if |url| is a valid youtube.<TLD> URL. If |port_permission| is |
106 // DISALLOW_NON_STANDARD_PORTS, this also requires |url| to use the standard | 111 // DISALLOW_NON_STANDARD_PORTS, this also requires |url| to use the standard |
107 // port for its scheme (80 for HTTP, 443 for HTTPS). | 112 // port for its scheme (80 for HTTP, 443 for HTTPS). |
108 bool IsYoutubeDomainUrl(const GURL& url, | 113 bool IsYoutubeDomainUrl(const GURL& url, |
109 SubdomainPermission subdomain_permission, | 114 SubdomainPermission subdomain_permission, |
110 PortPermission port_permission); | 115 PortPermission port_permission); |
111 | 116 |
| 117 // Returns the Google search access point for the given |entry|. This method |
| 118 // assumes that we have already verified that |entry|'s URL is a Google search |
| 119 // URL. |
| 120 GoogleSearchMetrics::AccessPoint GetGoogleSearchAccessPointForSearchNavEntry( |
| 121 const content::NavigationEntry& entry); |
| 122 |
112 } // namespace google_util | 123 } // namespace google_util |
113 | 124 |
114 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ | 125 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ |
OLD | NEW |