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 #include <vector> |
11 | 12 |
12 #include "base/strings/string_piece.h" | 13 #include "base/strings/string_piece.h" |
13 | 14 |
14 class GURL; | 15 class GURL; |
15 | 16 |
16 // This namespace provides various helpers around handling Google-related URLs. | 17 // This namespace provides various helpers around handling Google-related URLs. |
17 namespace google_util { | 18 namespace google_util { |
18 | 19 |
19 // True iff |str| contains a "q=" or "as_q=" query parameter with a non-empty | 20 // 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 | 21 // value. |str| should be a query or a hash fragment, without the ? or # (as |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 // True if |url| represents a valid Google search URL. | 106 // True if |url| represents a valid Google search URL. |
106 bool IsGoogleSearchUrl(const GURL& url); | 107 bool IsGoogleSearchUrl(const GURL& url); |
107 | 108 |
108 // True if |url| is a valid youtube.<TLD> URL. If |port_permission| is | 109 // True if |url| is a valid youtube.<TLD> URL. If |port_permission| is |
109 // DISALLOW_NON_STANDARD_PORTS, this also requires |url| to use the standard | 110 // DISALLOW_NON_STANDARD_PORTS, this also requires |url| to use the standard |
110 // port for its scheme (80 for HTTP, 443 for HTTPS). | 111 // port for its scheme (80 for HTTP, 443 for HTTPS). |
111 bool IsYoutubeDomainUrl(const GURL& url, | 112 bool IsYoutubeDomainUrl(const GURL& url, |
112 SubdomainPermission subdomain_permission, | 113 SubdomainPermission subdomain_permission, |
113 PortPermission port_permission); | 114 PortPermission port_permission); |
114 | 115 |
| 116 // Returns the list of all Google's registerable domains, i.e. domains named |
| 117 // google.<eTLD> owned by Google. |
| 118 // TODO(msramek): This is currently only used to ensure the deletion of Google |
| 119 // service workers on signout. Remove this once we have other options to do it, |
| 120 // such as service workers discovering that signin cookies are missing and |
| 121 // unregistering themselves. |
| 122 const std::vector<std::string>& GetGoogleRegistrableDomains(); |
| 123 |
115 } // namespace google_util | 124 } // namespace google_util |
116 | 125 |
117 #endif // COMPONENTS_GOOGLE_CORE_BROWSER_GOOGLE_UTIL_H_ | 126 #endif // COMPONENTS_GOOGLE_CORE_BROWSER_GOOGLE_UTIL_H_ |
OLD | NEW |