| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_GOOGLE_CORE_BROWSER_GOOGLE_UTIL_H_ | 7 #ifndef COMPONENTS_GOOGLE_CORE_BROWSER_GOOGLE_UTIL_H_ |
| 8 #define COMPONENTS_GOOGLE_CORE_BROWSER_GOOGLE_UTIL_H_ | 8 #define COMPONENTS_GOOGLE_CORE_BROWSER_GOOGLE_UTIL_H_ |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
| 13 | 13 |
| 14 class GURL; | 14 class GURL; |
| 15 | 15 |
| 16 // This namespace provides various helpers around handling Google-related URLs. | 16 // This namespace provides various helpers around handling Google-related URLs. |
| 17 namespace google_util { | 17 namespace google_util { |
| 18 | 18 |
| 19 // True iff |str| contains a "q=" or "as_q=" query parameter with a non-empty | 19 // True iff |str| contains a "q=" or "as_q=" query parameter with a non-empty |
| 20 // value. |str| should be a query or a hash fragment, without the ? or # (as | 20 // value. |str| should be a query or a hash fragment, without the ? or # (as |
| 21 // returned by GURL::query() or GURL::ref(). | 21 // returned by GURL::query() or GURL::ref(). |
| 22 bool HasGoogleSearchQueryParam(base::StringPiece str); | 22 bool HasGoogleSearchQueryParam(base::StringPiece str); |
| 23 | 23 |
| 24 // The query key that identifies a Google Extended API request for Instant. | 24 // The query key that identifies a Google Extended API request for Instant. |
| 25 const char kInstantExtendedAPIParam[] = "espv"; | 25 const char kInstantExtendedAPIParam[] = "espv"; |
| 26 | 26 |
| 27 constexpr char kGoogleInstantExtendedEnabledKey[] = |
| 28 "google:instantExtendedEnabledKey"; |
| 29 constexpr char kGoogleInstantExtendedEnabledKeyFull[] = |
| 30 "{google:instantExtendedEnabledKey}"; |
| 31 |
| 27 GURL LinkDoctorBaseURL(); | 32 GURL LinkDoctorBaseURL(); |
| 28 void SetMockLinkDoctorBaseURLForTesting(); | 33 void SetMockLinkDoctorBaseURLForTesting(); |
| 29 | 34 |
| 30 // Returns the Google locale corresponding to |application_locale|. This is | 35 // Returns the Google locale corresponding to |application_locale|. This is |
| 31 // the same string as AppendGoogleLocaleParam adds to the URL, only without the | 36 // the same string as AppendGoogleLocaleParam adds to the URL, only without the |
| 32 // leading "hl". | 37 // leading "hl". |
| 33 std::string GetGoogleLocale(const std::string& application_locale); | 38 std::string GetGoogleLocale(const std::string& application_locale); |
| 34 | 39 |
| 35 // Adds the Google locale string to the URL (e.g., hl=en-US). This does not | 40 // Adds the Google locale string to the URL (e.g., hl=en-US). This does not |
| 36 // check to see if the param already exists. | 41 // check to see if the param already exists. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 // True if |url| is a valid youtube.<TLD> URL. If |port_permission| is | 108 // True if |url| is a valid youtube.<TLD> URL. If |port_permission| is |
| 104 // DISALLOW_NON_STANDARD_PORTS, this also requires |url| to use the standard | 109 // DISALLOW_NON_STANDARD_PORTS, this also requires |url| to use the standard |
| 105 // port for its scheme (80 for HTTP, 443 for HTTPS). | 110 // port for its scheme (80 for HTTP, 443 for HTTPS). |
| 106 bool IsYoutubeDomainUrl(const GURL& url, | 111 bool IsYoutubeDomainUrl(const GURL& url, |
| 107 SubdomainPermission subdomain_permission, | 112 SubdomainPermission subdomain_permission, |
| 108 PortPermission port_permission); | 113 PortPermission port_permission); |
| 109 | 114 |
| 110 } // namespace google_util | 115 } // namespace google_util |
| 111 | 116 |
| 112 #endif // COMPONENTS_GOOGLE_CORE_BROWSER_GOOGLE_UTIL_H_ | 117 #endif // COMPONENTS_GOOGLE_CORE_BROWSER_GOOGLE_UTIL_H_ |
| OLD | NEW |