Chromium Code Reviews| Index: content/public/common/origin_util.h |
| diff --git a/content/public/common/origin_util.h b/content/public/common/origin_util.h |
| index bb050c94327f26842ecbc7e0c274a8d4152346bd..a2d80c0637de18eaa9c29e82f8978b8519997887 100644 |
| --- a/content/public/common/origin_util.h |
| +++ b/content/public/common/origin_util.h |
| @@ -5,6 +5,8 @@ |
| #ifndef CONTENT_PUBLIC_COMMON_ORIGIN_UTIL_H_ |
| #define CONTENT_PUBLIC_COMMON_ORIGIN_UTIL_H_ |
| +#include <string> |
| + |
| #include "content/common/content_export.h" |
| class GURL; |
| @@ -25,6 +27,26 @@ bool CONTENT_EXPORT OriginCanAccessServiceWorkers(const GURL& url); |
| // Resets the internal schemes/origins whitelist. Used only for testing. |
| void CONTENT_EXPORT ResetSchemesAndOriginsWhitelistForTesting(); |
| +// Utility functions for extracting Suborigin information from a URL that a |
| +// Suborigin has been serialized into. See |
| +// https://w3c.github.io/webappsec-suborigins/ for more information on |
| +// Suborigins. |
| +// |
| +// Returns true if the url has a serialized Suborigin in the host. Otherwise, |
| +// returns false. |
| +bool CONTENT_EXPORT HasSuborigin(const GURL& url); |
| + |
| +// If the host in the URL has a Suborigin serialized into it, returns the name. |
| +// Otherwise, returns the empty string. |
| +std::string CONTENT_EXPORT SuboriginFromUrl(const GURL& url); |
| + |
| +// If the URL has a suborigin serialized into it, returns the same URL with the |
| +// suborigin stripped. Otherwise, returns the empty string. |
| +// |
| +// For example, if given the URL https-so://foobar.example.com, the returned URL |
| +// would be https://example.com. |
| +GURL CONTENT_EXPORT UrlStripSuborigin(const GURL& url); |
|
nasko
2016/09/26 22:54:55
nit: StripSuboriginFromUrl? It indicates that the
jww
2016/09/28 23:35:15
Done.
|
| + |
| } // namespace content |
| #endif // CONTENT_PUBLIC_COMMON_ORIGIN_UTIL_H_ |