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> |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 DISALLOW_SUBDOMAIN, | 62 DISALLOW_SUBDOMAIN, |
63 }; | 63 }; |
64 | 64 |
65 // Designate whether or not a URL checking function also checks for standard | 65 // Designate whether or not a URL checking function also checks for standard |
66 // ports (80 for http, 443 for https), or if it allows all port numbers. | 66 // ports (80 for http, 443 for https), or if it allows all port numbers. |
67 enum PortPermission { | 67 enum PortPermission { |
68 ALLOW_NON_STANDARD_PORTS, | 68 ALLOW_NON_STANDARD_PORTS, |
69 DISALLOW_NON_STANDARD_PORTS, | 69 DISALLOW_NON_STANDARD_PORTS, |
70 }; | 70 }; |
71 | 71 |
| 72 // True if |host| is "[www.]google.<TLD>" with a valid TLD. If |
| 73 // |subdomain_permission| is ALLOW_SUBDOMAIN, we check against host |
| 74 // "*.google.<TLD>" instead. |
| 75 bool IsGoogleHostname(const std::string& host, |
| 76 SubdomainPermission subdomain_permission); |
72 // True if |url| is a valid URL with a host that returns true for | 77 // True if |url| is a valid URL with a host that returns true for |
73 // IsGoogleHostname(), and an HTTP or HTTPS scheme. If |port_permission| is | 78 // IsGoogleHostname(), and an HTTP or HTTPS scheme. If |port_permission| is |
74 // DISALLOW_NON_STANDARD_PORTS, this also requires |url| to use the standard | 79 // DISALLOW_NON_STANDARD_PORTS, this also requires |url| to use the standard |
75 // port for its scheme (80 for HTTP, 443 for HTTPS). | 80 // port for its scheme (80 for HTTP, 443 for HTTPS). |
76 bool IsGoogleDomainUrl(const GURL& url, | 81 bool IsGoogleDomainUrl(const GURL& url, |
77 SubdomainPermission subdomain_permission, | 82 SubdomainPermission subdomain_permission, |
78 PortPermission port_permission); | 83 PortPermission port_permission); |
79 // True if |host| is "[www.]google.<TLD>" with a valid TLD. If | |
80 // |subdomain_permission| is ALLOW_SUBDOMAIN, we check against host | |
81 // "*.google.<TLD>" instead. | |
82 bool IsGoogleHostname(const std::string& host, | |
83 SubdomainPermission subdomain_permission); | |
84 // True if |url| represents a valid Google home page URL. | 84 // True if |url| represents a valid Google home page URL. |
85 bool IsGoogleHomePageUrl(const GURL& url); | 85 bool IsGoogleHomePageUrl(const GURL& url); |
86 // True if |url| represents a valid Google search URL. | 86 // True if |url| represents a valid Google search URL. |
87 bool IsGoogleSearchUrl(const GURL& url); | 87 bool IsGoogleSearchUrl(const GURL& url); |
88 | 88 |
89 // True if a build is strictly organic, according to its brand code. | 89 // True if a build is strictly organic, according to its brand code. |
90 bool IsOrganic(const std::string& brand); | 90 bool IsOrganic(const std::string& brand); |
91 | 91 |
92 // True if a build should run as organic during first run. This uses | 92 // True if a build should run as organic during first run. This uses |
93 // a slightly different set of brand codes from the standard IsOrganic | 93 // a slightly different set of brand codes from the standard IsOrganic |
(...skipping 11 matching lines...) Expand all Loading... |
105 ~BrandForTesting(); | 105 ~BrandForTesting(); |
106 | 106 |
107 private: | 107 private: |
108 std::string brand_; | 108 std::string brand_; |
109 DISALLOW_COPY_AND_ASSIGN(BrandForTesting); | 109 DISALLOW_COPY_AND_ASSIGN(BrandForTesting); |
110 }; | 110 }; |
111 | 111 |
112 } // namespace google_util | 112 } // namespace google_util |
113 | 113 |
114 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ | 114 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ |
OLD | NEW |