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> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/string16.h" | |
14 | 13 |
15 class GURL; | 14 class GURL; |
16 class Profile; | 15 class Profile; |
17 | 16 |
18 // This namespace provides various helpers around handling Google-related URLs | 17 // This namespace provides various helpers around handling Google-related URLs |
19 // and state relating to Google Chrome distributions (such as RLZ). | 18 // and state relating to Google Chrome distributions (such as RLZ). |
20 namespace google_util { | 19 namespace google_util { |
21 | 20 |
22 // The query key that identifies a Google Extended API request for Instant. | 21 // The query key that identifies a Google Extended API request for Instant. |
23 const char kInstantExtendedAPIParam[] = "espv"; | 22 const char kInstantExtendedAPIParam[] = "espv"; |
(...skipping 14 matching lines...) Expand all Loading... |
38 | 37 |
39 // Returns in |brand| the brand code or distribution tag that has been | 38 // Returns in |brand| the brand code or distribution tag that has been |
40 // assigned to a partner. Returns false if the information is not available. | 39 // assigned to a partner. Returns false if the information is not available. |
41 bool GetBrand(std::string* brand); | 40 bool GetBrand(std::string* brand); |
42 | 41 |
43 // Returns in |brand| the reactivation brand code or distribution tag | 42 // Returns in |brand| the reactivation brand code or distribution tag |
44 // that has been assigned to a partner for reactivating a dormant chrome | 43 // that has been assigned to a partner for reactivating a dormant chrome |
45 // install. Returns false if the information is not available. | 44 // install. Returns false if the information is not available. |
46 bool GetReactivationBrand(std::string* brand); | 45 bool GetReactivationBrand(std::string* brand); |
47 | 46 |
48 // Returns in the search terms used to create the Google search URL |url|. | |
49 string16 GetSearchTermsFromGoogleSearchURL(const std::string& url); | |
50 | |
51 // WARNING: The following IsGoogleXXX() functions use heuristics to rule out | 47 // WARNING: The following IsGoogleXXX() functions use heuristics to rule out |
52 // "obviously false" answers. They do NOT guarantee that the string in question | 48 // "obviously false" answers. They do NOT guarantee that the string in question |
53 // is actually on a Google-owned domain, just that it looks plausible. If you | 49 // is actually on a Google-owned domain, just that it looks plausible. If you |
54 // need to restrict some behavior to only happen on Google's officially-owned | 50 // need to restrict some behavior to only happen on Google's officially-owned |
55 // domains, use TransportSecurityState::IsGooglePinnedProperty() instead. | 51 // domains, use TransportSecurityState::IsGooglePinnedProperty() instead. |
56 | 52 |
57 // Designate whether or not a URL checking function also checks for specific | 53 // Designate whether or not a URL checking function also checks for specific |
58 // subdomains, or only "www" and empty subdomains. | 54 // subdomains, or only "www" and empty subdomains. |
59 enum SubdomainPermission { | 55 enum SubdomainPermission { |
60 ALLOW_SUBDOMAIN, | 56 ALLOW_SUBDOMAIN, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 ~BrandForTesting(); | 103 ~BrandForTesting(); |
108 | 104 |
109 private: | 105 private: |
110 std::string brand_; | 106 std::string brand_; |
111 DISALLOW_COPY_AND_ASSIGN(BrandForTesting); | 107 DISALLOW_COPY_AND_ASSIGN(BrandForTesting); |
112 }; | 108 }; |
113 | 109 |
114 } // namespace google_util | 110 } // namespace google_util |
115 | 111 |
116 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ | 112 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ |
OLD | NEW |