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 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 | 13 |
| 14 class GURL; | 14 class GURL; |
| 15 class Profile; | |
| 16 | 15 |
| 17 // This namespace provides various helpers around handling Google-related URLs | 16 // This namespace provides various helpers around handling Google-related URLs |
| 18 // and state relating to Google Chrome distributions (such as RLZ). | 17 // and state relating to Google Chrome distributions (such as RLZ). |
| 19 namespace google_util { | 18 namespace google_util { |
| 20 | 19 |
| 21 // True iff |str| contains a "q=" query parameter with a non-empty value. | 20 // True iff |str| contains a "q=" query parameter with a non-empty value. |
| 22 // |str| should be a query or a hash fragment, without the ? or # (as | 21 // |str| should be a query or a hash fragment, without the ? or # (as |
| 23 // returned by GURL::query() or GURL::ref(). | 22 // returned by GURL::query() or GURL::ref(). |
| 24 bool HasGoogleSearchQueryParam(const std::string& str); | 23 bool HasGoogleSearchQueryParam(const std::string& str); |
| 25 | 24 |
| 26 // The query key that identifies a Google Extended API request for Instant. | 25 // The query key that identifies a Google Extended API request for Instant. |
| 27 const char kInstantExtendedAPIParam[] = "espv"; | 26 const char kInstantExtendedAPIParam[] = "espv"; |
| 28 | 27 |
| 29 GURL LinkDoctorBaseURL(); | 28 GURL LinkDoctorBaseURL(); |
| 30 void SetMockLinkDoctorBaseURLForTesting(); | 29 void SetMockLinkDoctorBaseURLForTesting(); |
| 31 | 30 |
| 32 // Returns the Google locale. This is the same string as | 31 // Returns the Google locale. This is the same string as |
| 33 // AppendGoogleLocaleParam adds to the URL, only without the leading "hl". | 32 // AppendGoogleLocaleParam adds to the URL, only without the leading "hl". |
| 34 std::string GetGoogleLocale(); | 33 std::string GetGoogleLocale(); |
| 35 | 34 |
| 36 // Adds the Google locale string to the URL (e.g., hl=en-US). This does not | 35 // Adds the Google locale string to the URL (e.g., hl=en-US). This does not |
| 37 // check to see if the param already exists. | 36 // check to see if the param already exists. |
| 38 GURL AppendGoogleLocaleParam(const GURL& url); | 37 GURL AppendGoogleLocaleParam(const GURL& url); |
| 39 | 38 |
| 40 // String version of AppendGoogleLocaleParam. | 39 // String version of AppendGoogleLocaleParam. |
| 41 std::string StringAppendGoogleLocaleParam(const std::string& url); | 40 std::string StringAppendGoogleLocaleParam(const std::string& url); |
| 42 | 41 |
| 43 // Returns the Google country code string for the given profile. | 42 // Returns the Google country code string for the given Google homepage URL. |
| 44 std::string GetGoogleCountryCode(Profile* profile); | 43 std::string GetGoogleCountryCode(GURL google_homepage_url); |
|
Peter Kasting
2014/05/30 20:50:39
Nit: Pass GURL by const ref (2 places)
blundell
2014/06/02 15:42:26
Functions removed entirely.
On 2014/05/30 20:50:3
| |
| 45 | 44 |
| 46 // Returns the Google search URL for the given profile. | 45 // Returns the Google search URL for the given Google homepage URL. |
| 47 GURL GetGoogleSearchURL(Profile* profile); | 46 GURL GetGoogleSearchURL(GURL google_homepage_url); |
| 48 | 47 |
| 49 // Returns in |brand| the brand code or distribution tag that has been | 48 // Returns in |brand| the brand code or distribution tag that has been |
| 50 // assigned to a partner. Returns false if the information is not available. | 49 // assigned to a partner. Returns false if the information is not available. |
| 51 bool GetBrand(std::string* brand); | 50 bool GetBrand(std::string* brand); |
| 52 | 51 |
| 53 // Returns in |brand| the reactivation brand code or distribution tag | 52 // Returns in |brand| the reactivation brand code or distribution tag |
| 54 // that has been assigned to a partner for reactivating a dormant chrome | 53 // that has been assigned to a partner for reactivating a dormant chrome |
| 55 // install. Returns false if the information is not available. | 54 // install. Returns false if the information is not available. |
| 56 bool GetReactivationBrand(std::string* brand); | 55 bool GetReactivationBrand(std::string* brand); |
| 57 | 56 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 ~BrandForTesting(); | 132 ~BrandForTesting(); |
| 134 | 133 |
| 135 private: | 134 private: |
| 136 std::string brand_; | 135 std::string brand_; |
| 137 DISALLOW_COPY_AND_ASSIGN(BrandForTesting); | 136 DISALLOW_COPY_AND_ASSIGN(BrandForTesting); |
| 138 }; | 137 }; |
| 139 | 138 |
| 140 } // namespace google_util | 139 } // namespace google_util |
| 141 | 140 |
| 142 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ | 141 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ |
| OLD | NEW |