Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Unified Diff: url/url_util.h

Issue 1272113002: Allow url::SchemeHostPort to hold non-file scheme without port (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « url/scheme_host_port.cc ('k') | url/url_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: url/url_util.h
diff --git a/url/url_util.h b/url/url_util.h
index 58170447674eedb20193309273c8be140f53886f..36e781433d428f61a8f0ec71ae4c72bc4dca082a 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
« no previous file with comments | « url/scheme_host_port.cc ('k') | url/url_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698