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 #pragma once | 9 #pragma once |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 // that has been assigned to a partner for reactivating a dormant chrome | 39 // that has been assigned to a partner for reactivating a dormant chrome |
40 // install. Returns false if the information is not available. | 40 // install. Returns false if the information is not available. |
41 bool GetReactivationBrand(std::string* brand); | 41 bool GetReactivationBrand(std::string* brand); |
42 | 42 |
43 // WARNING: The following IsGoogleXXX() functions use heuristics to rule out | 43 // WARNING: The following IsGoogleXXX() functions use heuristics to rule out |
44 // "obviously false" answers. They do NOT guarantee that the string in question | 44 // "obviously false" answers. They do NOT guarantee that the string in question |
45 // is actually on a Google-owned domain, just that it looks plausible. If you | 45 // is actually on a Google-owned domain, just that it looks plausible. If you |
46 // need to restrict some behavior to only happen on Google's officially-owned | 46 // need to restrict some behavior to only happen on Google's officially-owned |
47 // domains, use TransportSecurityState::IsGooglePinnedProperty() instead. | 47 // domains, use TransportSecurityState::IsGooglePinnedProperty() instead. |
48 | 48 |
49 // Designate whether or not a URL checking function also checks for specific | 49 // True if |host| is "[www.]google.<TLD>" with a valid TLD. |
50 // subdomains, or only "www" and empty subdomains. | 50 bool IsGoogleHostname(const std::string& host); |
51 enum SubdomainPermission { | |
52 ALLOW_SUBDOMAIN, | |
53 DISALLOW_SUBDOMAIN, | |
54 }; | |
55 | |
56 // True if |url| is an HTTP[S] request with host "[www.]google.<TLD>" and no | |
57 // explicit port. If |permission| is ALLOW_SUBDOMAIN, we check against host | |
58 // "*.google.<TLD>" instead. | |
59 bool IsGoogleDomainUrl(const std::string& url, SubdomainPermission permission); | |
60 // True if |host| is "[www.]google.<TLD>" with a valid TLD. If | |
61 // |permission| is ALLOW_SUBDOMAIN, we check against host "*.google.<TLD>" | |
62 // instead. | |
63 bool IsGoogleHostname(const std::string& host, SubdomainPermission permission); | |
64 // True if |url| represents a valid Google home page URL. | 51 // True if |url| represents a valid Google home page URL. |
65 bool IsGoogleHomePageUrl(const std::string& url); | 52 bool IsGoogleHomePageUrl(const std::string& url); |
66 // True if |url| represents a valid Google search URL. | 53 // True if |url| represents a valid Google search URL. |
67 bool IsGoogleSearchUrl(const std::string& url); | 54 bool IsGoogleSearchUrl(const std::string& url); |
68 | 55 |
69 // True if a build is strictly organic, according to its brand code. | 56 // True if a build is strictly organic, according to its brand code. |
70 bool IsOrganic(const std::string& brand); | 57 bool IsOrganic(const std::string& brand); |
71 | 58 |
72 // True if a build should run as organic during first run. This uses | 59 // True if a build should run as organic during first run. This uses |
73 // a slightly different set of brand codes from the standard IsOrganic | 60 // a slightly different set of brand codes from the standard IsOrganic |
(...skipping 11 matching lines...) Expand all Loading... |
85 ~BrandForTesting(); | 72 ~BrandForTesting(); |
86 | 73 |
87 private: | 74 private: |
88 std::string brand_; | 75 std::string brand_; |
89 DISALLOW_COPY_AND_ASSIGN(BrandForTesting); | 76 DISALLOW_COPY_AND_ASSIGN(BrandForTesting); |
90 }; | 77 }; |
91 | 78 |
92 } // namespace google_util | 79 } // namespace google_util |
93 | 80 |
94 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ | 81 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ |
OLD | NEW |