Chromium Code Reviews| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 59 // "*.google.<TLD>" instead. | 59 // "*.google.<TLD>" instead. |
| 60 bool IsGoogleDomainUrl(const std::string& url, SubdomainPermission permission); | 60 bool IsGoogleDomainUrl(const std::string& url, SubdomainPermission permission); |
| 61 // True if |host| is "[www.]google.<TLD>" with a valid TLD. If | 61 // True if |host| is "[www.]google.<TLD>" with a valid TLD. If |
| 62 // |permission| is ALLOW_SUBDOMAIN, we check against host "*.google.<TLD>" | 62 // |permission| is ALLOW_SUBDOMAIN, we check against host "*.google.<TLD>" |
| 63 // instead. | 63 // instead. |
| 64 bool IsGoogleHostname(const std::string& host, SubdomainPermission permission); | 64 bool IsGoogleHostname(const std::string& host, SubdomainPermission permission); |
| 65 // True if |url| represents a valid Google home page URL. | 65 // True if |url| represents a valid Google home page URL. |
| 66 bool IsGoogleHomePageUrl(const std::string& url); | 66 bool IsGoogleHomePageUrl(const std::string& url); |
| 67 // True if |url| represents a valid Google search URL. | 67 // True if |url| represents a valid Google search URL. |
| 68 bool IsGoogleSearchUrl(const std::string& url); | 68 bool IsGoogleSearchUrl(const std::string& url); |
| 69 // True if |url| represents a valid Google embedded search URL. Used for | |
| 70 // the Instant extended API. | |
| 71 bool IsEmbeddedGoogleSearchUrl(const std::string& url); | |
|
Ilya Sherman
2012/06/21 17:46:58
nit: The notion of "embedded search" is not very c
dhollowa
2012/06/21 22:16:43
Agreed. I've renamed to use the "Instant Extended
| |
| 69 | 72 |
| 70 // True if a build is strictly organic, according to its brand code. | 73 // True if a build is strictly organic, according to its brand code. |
| 71 bool IsOrganic(const std::string& brand); | 74 bool IsOrganic(const std::string& brand); |
| 72 | 75 |
| 73 // True if a build should run as organic during first run. This uses | 76 // True if a build should run as organic during first run. This uses |
| 74 // a slightly different set of brand codes from the standard IsOrganic | 77 // a slightly different set of brand codes from the standard IsOrganic |
| 75 // method. | 78 // method. |
| 76 bool IsOrganicFirstRun(const std::string& brand); | 79 bool IsOrganicFirstRun(const std::string& brand); |
| 77 | 80 |
| 78 // True if |brand| is an internet cafe brand code. | 81 // True if |brand| is an internet cafe brand code. |
| 79 bool IsInternetCafeBrandCode(const std::string& brand); | 82 bool IsInternetCafeBrandCode(const std::string& brand); |
| 80 | 83 |
| 81 // This class is meant to be used only from test code, and sets the brand | 84 // This class is meant to be used only from test code, and sets the brand |
| 82 // code returned by the function GetBrand() above while the object exists. | 85 // code returned by the function GetBrand() above while the object exists. |
| 83 class BrandForTesting { | 86 class BrandForTesting { |
| 84 public: | 87 public: |
| 85 explicit BrandForTesting(const std::string& brand); | 88 explicit BrandForTesting(const std::string& brand); |
| 86 ~BrandForTesting(); | 89 ~BrandForTesting(); |
| 87 | 90 |
| 88 private: | 91 private: |
| 89 std::string brand_; | 92 std::string brand_; |
| 90 DISALLOW_COPY_AND_ASSIGN(BrandForTesting); | 93 DISALLOW_COPY_AND_ASSIGN(BrandForTesting); |
| 91 }; | 94 }; |
| 92 | 95 |
| 93 } // namespace google_util | 96 } // namespace google_util |
| 94 | 97 |
| 95 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ | 98 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ |
| OLD | NEW |