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 // True if |host| is "[www.]google.<TLD>" with a valid TLD. | 49 // Designate whether or not a URL checking function also checks for specific |
50 bool IsGoogleHostname(const std::string& host); | 50 // subdomains, or only "www" and empty subdomains. |
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 |allow_subdomain| is true, we check against host | |
MAD
2012/04/17 18:16:28
Maybe fix this comment to the new param type not b
SteveT
2012/04/17 18:20:46
Done.
| |
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 // |allow_subdomain| is true, we check against host "*.google.<TLD>" instead. | |
MAD
2012/04/17 18:16:28
Same here...
SteveT
2012/04/17 18:20:46
Done.
| |
62 bool IsGoogleHostname(const std::string& host, SubdomainPermission permission); | |
51 // True if |url| represents a valid Google home page URL. | 63 // True if |url| represents a valid Google home page URL. |
52 bool IsGoogleHomePageUrl(const std::string& url); | 64 bool IsGoogleHomePageUrl(const std::string& url); |
53 // True if |url| represents a valid Google search URL. | 65 // True if |url| represents a valid Google search URL. |
54 bool IsGoogleSearchUrl(const std::string& url); | 66 bool IsGoogleSearchUrl(const std::string& url); |
55 | 67 |
56 // True if a build is strictly organic, according to its brand code. | 68 // True if a build is strictly organic, according to its brand code. |
57 bool IsOrganic(const std::string& brand); | 69 bool IsOrganic(const std::string& brand); |
58 | 70 |
59 // True if a build should run as organic during first run. This uses | 71 // True if a build should run as organic during first run. This uses |
60 // a slightly different set of brand codes from the standard IsOrganic | 72 // a slightly different set of brand codes from the standard IsOrganic |
(...skipping 11 matching lines...) Expand all Loading... | |
72 ~BrandForTesting(); | 84 ~BrandForTesting(); |
73 | 85 |
74 private: | 86 private: |
75 std::string brand_; | 87 std::string brand_; |
76 DISALLOW_COPY_AND_ASSIGN(BrandForTesting); | 88 DISALLOW_COPY_AND_ASSIGN(BrandForTesting); |
77 }; | 89 }; |
78 | 90 |
79 } // namespace google_util | 91 } // namespace google_util |
80 | 92 |
81 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ | 93 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ |
OLD | NEW |