summaryrefslogtreecommitdiffstats
path: root/url/url_util.h
diff options
context:
space:
mode:
authortyoshino <tyoshino@chromium.org>2015-08-18 05:50:45 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-18 12:51:15 +0000
commit1ac9ec7bccd1b5178b18338b10149f36292f5fb6 (patch)
treea257a5763665b93a2edd8bb9fbcbf26e3dd7046a /url/url_util.h
parent897bb847ac903313cdcabd976155e2d15ef8ad79 (diff)
downloadchromium_src-1ac9ec7bccd1b5178b18338b10149f36292f5fb6.zip
chromium_src-1ac9ec7bccd1b5178b18338b10149f36292f5fb6.tar.gz
chromium_src-1ac9ec7bccd1b5178b18338b10149f36292f5fb6.tar.bz2
Allow url::SchemeHostPort to hold non-file scheme without port
WebSockets use url::Origin to pass origin info between renderer and browser. Currently, it cannot hold an origin with non-file scheme and no port. Chrome extensions have been using such origins, so we need to keep the channel to convey origin info work for such origins. BUG=516971 R=sleevi,brettw Review URL: https://codereview.chromium.org/1272113002 Cr-Commit-Position: refs/heads/master@{#343895}
Diffstat (limited to 'url/url_util.h')
-rw-r--r--url/url_util.h33
1 files changed, 30 insertions, 3 deletions
diff --git a/url/url_util.h b/url/url_util.h
index 5817044..36e7814 100644
--- a/url/url_util.h
+++ b/url/url_util.h
@@ -37,6 +37,25 @@ URL_EXPORT void Shutdown();
// Schemes --------------------------------------------------------------------
+// Types of a scheme representing the requirements on the data represented by
+// the authority component of a URL with the scheme.
+enum URL_EXPORT SchemeType {
+ // The authority component of a URL with the scheme, if any, has the port
+ // (the default values may be omitted in a serialization).
+ SCHEME_WITH_PORT,
+ // The authority component of a URL with the scheme, if any, doesn't have a
+ // port.
+ SCHEME_WITHOUT_PORT,
+ // A URL with the scheme doesn't have the authority component.
+ SCHEME_WITHOUT_AUTHORITY,
+};
+
+// A pair for representing a standard scheme name and the SchemeType for it.
+struct URL_EXPORT SchemeWithType {
+ const char* scheme;
+ SchemeType type;
+};
+
// Adds an application-defined scheme to the internal list of "standard-format"
// URL schemes. A standard-format scheme adheres to what RFC 3986 calls "generic
// URI syntax" (https://tools.ietf.org/html/rfc3986#section-3).
@@ -44,7 +63,8 @@ URL_EXPORT void Shutdown();
// This function is not threadsafe and can not be called concurrently with any
// other url_util function. It will assert if the list of standard schemes has
// been locked (see LockStandardSchemes).
-URL_EXPORT void AddStandardScheme(const char* new_scheme);
+URL_EXPORT void AddStandardScheme(const char* new_scheme,
+ SchemeType scheme_type);
// Sets a flag to prevent future calls to AddStandardScheme from succeeding.
//
@@ -87,11 +107,18 @@ inline bool FindAndCompareScheme(const base::string16& str,
compare, found_scheme);
}
-// Returns true if the given string represents a URL whose scheme is in the list
-// of known standard-format schemes (see AddStandardScheme).
+// Returns true if the given scheme identified by |scheme| within |spec| is in
+// the list of known standard-format schemes (see AddStandardScheme).
URL_EXPORT bool IsStandard(const char* spec, const Component& scheme);
URL_EXPORT bool IsStandard(const base::char16* spec, const Component& scheme);
+// Returns true and sets |type| to the SchemeType of the given scheme
+// identified by |scheme| within |spec| if the scheme is in the list of known
+// standard-format schemes (see AddStandardScheme).
+URL_EXPORT bool GetStandardSchemeType(const char* spec,
+ const Component& scheme,
+ SchemeType* type);
+
// URL library wrappers -------------------------------------------------------
// Parses the given spec according to the extracted scheme type. Normal users