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

Unified Diff: url/url_util.h

Issue 1139923005: Clarify the documentation for url::{AddStandardScheme,IsStandard}. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tighten the definition by referring to RFC 3986. Created 5 years, 7 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/gurl.h ('k') | no next file » | 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 458d1e83ae929900a46501dcbde9418f8d2d0243..a700286936f78c7b1c7f075b5633c658df91d7b6 100644
--- a/url/url_util.h
+++ b/url/url_util.h
@@ -20,14 +20,13 @@ namespace url {
// Initialization is NOT required, it will be implicitly initialized when first
// used. However, this implicit initialization is NOT threadsafe. If you are
// using this library in a threaded environment and don't have a consistent
-// "first call" (an example might be calling "AddStandardScheme" with your
-// special application-specific schemes) then you will want to call initialize
-// before spawning any threads.
+// "first call" (an example might be calling AddStandardScheme with your special
+// application-specific schemes) then you will want to call initialize before
+// spawning any threads.
//
-// It is OK to call this function more than once, subsequent calls will simply
-// "noop", unless Shutdown() was called in the mean time. This will also be a
-// "noop" if other calls to the library have forced an initialization
-// beforehand.
+// It is OK to call this function more than once, subsequent calls will be
+// no-ops, unless Shutdown was called in the mean time. This will also be a
+// no-op if other calls to the library have forced an initialization beforehand.
URL_EXPORT void Initialize();
// Cleanup is not required, except some strings may leak. For most user
@@ -38,10 +37,13 @@ URL_EXPORT void Shutdown();
// Schemes --------------------------------------------------------------------
-// Adds an application-defined scheme to the internal list of "standard" URL
-// schemes. 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).
+// 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).
+//
+// 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);
// Sets a flag to prevent future calls to AddStandardScheme from succeeding.
@@ -85,19 +87,11 @@ inline bool FindAndCompareScheme(const base::string16& str,
compare, found_scheme);
}
-// Returns true if the given string represents a standard URL. This means that
-// either the scheme is in the list of known standard schemes.
+// Returns true if the given string represents a URL whose scheme 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);
-// TODO(brettw) remove this. This is a temporary compatibility hack to avoid
-// breaking the WebKit build when this version is synced via Chrome.
-inline bool IsStandard(const char* spec,
- int spec_len,
- const Component& scheme) {
- return IsStandard(spec, scheme);
-}
-
// URL library wrappers -------------------------------------------------------
// Parses the given spec according to the extracted scheme type. Normal users
« no previous file with comments | « url/gurl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698