| 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 |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); |
| 51 // True if |url| represents a valid Google home page URL. | 64 // True if |url| represents a valid Google home page URL. |
| 52 bool IsGoogleHomePageUrl(const std::string& url); | 65 bool IsGoogleHomePageUrl(const std::string& url); |
| 53 // True if |url| represents a valid Google search URL. | 66 // True if |url| represents a valid Google search URL. |
| 54 bool IsGoogleSearchUrl(const std::string& url); | 67 bool IsGoogleSearchUrl(const std::string& url); |
| 55 | 68 |
| 56 // True if a build is strictly organic, according to its brand code. | 69 // True if a build is strictly organic, according to its brand code. |
| 57 bool IsOrganic(const std::string& brand); | 70 bool IsOrganic(const std::string& brand); |
| 58 | 71 |
| 59 // True if a build should run as organic during first run. This uses | 72 // 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 | 73 // a slightly different set of brand codes from the standard IsOrganic |
| (...skipping 11 matching lines...) Expand all Loading... |
| 72 ~BrandForTesting(); | 85 ~BrandForTesting(); |
| 73 | 86 |
| 74 private: | 87 private: |
| 75 std::string brand_; | 88 std::string brand_; |
| 76 DISALLOW_COPY_AND_ASSIGN(BrandForTesting); | 89 DISALLOW_COPY_AND_ASSIGN(BrandForTesting); |
| 77 }; | 90 }; |
| 78 | 91 |
| 79 } // namespace google_util | 92 } // namespace google_util |
| 80 | 93 |
| 81 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ | 94 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ |
| OLD | NEW |