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" |
13 | 14 |
14 class GURL; | 15 class GURL; |
15 class Profile; | 16 class Profile; |
16 | 17 |
17 // This namespace provides various helpers around handling Google-related URLs | 18 // This namespace provides various helpers around handling Google-related URLs |
18 // and state relating to Google Chrome distributions (such as RLZ). | 19 // and state relating to Google Chrome distributions (such as RLZ). |
19 namespace google_util { | 20 namespace google_util { |
20 | 21 |
21 extern const char kLinkDoctorBaseURL[]; | 22 extern const char kLinkDoctorBaseURL[]; |
22 | 23 |
(...skipping 10 matching lines...) Expand all Loading... |
33 | 34 |
34 // Returns in |brand| the brand code or distribution tag that has been | 35 // Returns in |brand| the brand code or distribution tag that has been |
35 // assigned to a partner. Returns false if the information is not available. | 36 // assigned to a partner. Returns false if the information is not available. |
36 bool GetBrand(std::string* brand); | 37 bool GetBrand(std::string* brand); |
37 | 38 |
38 // Returns in |brand| the reactivation brand code or distribution tag | 39 // Returns in |brand| the reactivation brand code or distribution tag |
39 // that has been assigned to a partner for reactivating a dormant chrome | 40 // that has been assigned to a partner for reactivating a dormant chrome |
40 // install. Returns false if the information is not available. | 41 // install. Returns false if the information is not available. |
41 bool GetReactivationBrand(std::string* brand); | 42 bool GetReactivationBrand(std::string* brand); |
42 | 43 |
| 44 // Returns in the search terms used to create the Google search URL |url|. |
| 45 string16 GetSearchTermsFromGoogleSearchURL(const GURL& url); |
| 46 |
43 // WARNING: The following IsGoogleXXX() functions use heuristics to rule out | 47 // WARNING: The following IsGoogleXXX() functions use heuristics to rule out |
44 // "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 |
45 // 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 |
46 // 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 |
47 // domains, use TransportSecurityState::IsGooglePinnedProperty() instead. | 51 // domains, use TransportSecurityState::IsGooglePinnedProperty() instead. |
48 | 52 |
49 // 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 |
50 // subdomains, or only "www" and empty subdomains. | 54 // subdomains, or only "www" and empty subdomains. |
51 enum SubdomainPermission { | 55 enum SubdomainPermission { |
52 ALLOW_SUBDOMAIN, | 56 ALLOW_SUBDOMAIN, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 ~BrandForTesting(); | 92 ~BrandForTesting(); |
89 | 93 |
90 private: | 94 private: |
91 std::string brand_; | 95 std::string brand_; |
92 DISALLOW_COPY_AND_ASSIGN(BrandForTesting); | 96 DISALLOW_COPY_AND_ASSIGN(BrandForTesting); |
93 }; | 97 }; |
94 | 98 |
95 } // namespace google_util | 99 } // namespace google_util |
96 | 100 |
97 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ | 101 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ |
OLD | NEW |