Commit 29ae548c authored by palmer's avatar palmer Committed by Commit bot

Clarify the documentation for url::{AddStandardScheme,IsStandard}.

And GURL::IsStandard, which calls url::IsStandard.

BUG=487399
TBR=abarth

Review URL: https://codereview.chromium.org/1139923005

Cr-Commit-Position: refs/heads/master@{#330495}
parent 246e2d1e
...@@ -194,10 +194,11 @@ class URL_EXPORT GURL { ...@@ -194,10 +194,11 @@ class URL_EXPORT GURL {
// returned. // returned.
GURL GetAsReferrer() const; GURL GetAsReferrer() const;
// Returns true if the scheme for the current URL is a known "standard" // Returns true if the scheme for the current URL is a known "standard-format"
// scheme. Standard schemes have an authority and a path section. This // scheme. A standard-format scheme adheres to what RFC 3986 calls "generic
// includes file: and filesystem:, which some callers may want to filter out // URI syntax" (https://tools.ietf.org/html/rfc3986#section-3). This includes
// explicitly by calling SchemeIsFile[System]. // file: and filesystem:, which some callers may want to filter out explicitly
// by calling SchemeIsFile[System].
bool IsStandard() const; bool IsStandard() const;
// Returns true if the given parameter (should be lower-case ASCII to match // Returns true if the given parameter (should be lower-case ASCII to match
......
...@@ -20,14 +20,13 @@ namespace url { ...@@ -20,14 +20,13 @@ namespace url {
// Initialization is NOT required, it will be implicitly initialized when first // Initialization is NOT required, it will be implicitly initialized when first
// used. However, this implicit initialization is NOT threadsafe. If you are // used. However, this implicit initialization is NOT threadsafe. If you are
// using this library in a threaded environment and don't have a consistent // using this library in a threaded environment and don't have a consistent
// "first call" (an example might be calling "AddStandardScheme" with your // "first call" (an example might be calling AddStandardScheme with your special
// special application-specific schemes) then you will want to call initialize // application-specific schemes) then you will want to call initialize before
// before spawning any threads. // spawning any threads.
// //
// It is OK to call this function more than once, subsequent calls will simply // It is OK to call this function more than once, subsequent calls will be
// "noop", unless Shutdown() was called in the mean time. This will also be a // no-ops, unless Shutdown was called in the mean time. This will also be a
// "noop" if other calls to the library have forced an initialization // no-op if other calls to the library have forced an initialization beforehand.
// beforehand.
URL_EXPORT void Initialize(); URL_EXPORT void Initialize();
// Cleanup is not required, except some strings may leak. For most user // Cleanup is not required, except some strings may leak. For most user
...@@ -38,10 +37,13 @@ URL_EXPORT void Shutdown(); ...@@ -38,10 +37,13 @@ URL_EXPORT void Shutdown();
// Schemes -------------------------------------------------------------------- // Schemes --------------------------------------------------------------------
// Adds an application-defined scheme to the internal list of "standard" URL // Adds an application-defined scheme to the internal list of "standard-format"
// schemes. This function is not threadsafe and can not be called concurrently // URL schemes. A standard-format scheme adheres to what RFC 3986 calls "generic
// with any other url_util function. It will assert if the list of standard // URI syntax" (https://tools.ietf.org/html/rfc3986#section-3).
// schemes has been locked (see LockStandardSchemes). //
// 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);
// Sets a flag to prevent future calls to AddStandardScheme from succeeding. // Sets a flag to prevent future calls to AddStandardScheme from succeeding.
...@@ -85,19 +87,11 @@ inline bool FindAndCompareScheme(const base::string16& str, ...@@ -85,19 +87,11 @@ inline bool FindAndCompareScheme(const base::string16& str,
compare, found_scheme); compare, found_scheme);
} }
// Returns true if the given string represents a standard URL. This means that // Returns true if the given string represents a URL whose scheme is in the list
// either the scheme is in the list of known standard schemes. // of known standard-format schemes (see AddStandardScheme).
URL_EXPORT bool IsStandard(const char* spec, const Component& scheme); URL_EXPORT bool IsStandard(const char* spec, const Component& scheme);
URL_EXPORT bool IsStandard(const base::char16* 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 ------------------------------------------------------- // URL library wrappers -------------------------------------------------------
// Parses the given spec according to the extracted scheme type. Normal users // Parses the given spec according to the extracted scheme type. Normal users
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment