diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-23 06:58:45 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-23 06:58:45 +0000 |
commit | 232005abbc32dfaf8498ef8ee9c15e4f30d1e7e7 (patch) | |
tree | 90aca67984c699badc26fb4553651a6c8b272810 /url | |
parent | bf911527b7e20eecef2f24ab3bfe05b723f585c1 (diff) | |
download | chromium_src-232005abbc32dfaf8498ef8ee9c15e4f30d1e7e7.zip chromium_src-232005abbc32dfaf8498ef8ee9c15e4f30d1e7e7.tar.gz chromium_src-232005abbc32dfaf8498ef8ee9c15e4f30d1e7e7.tar.bz2 |
Make the copy of GURL in src/url buildable as a component build.
BUG=229660
Review URL: https://chromiumcodereview.appspot.com/15255009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201723 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'url')
-rw-r--r-- | url/gurl.h | 64 | ||||
-rw-r--r-- | url/url.gyp | 7 | ||||
-rw-r--r-- | url/url_canon.h | 487 | ||||
-rw-r--r-- | url/url_canon_icu.h | 3 | ||||
-rw-r--r-- | url/url_canon_internal.h | 25 | ||||
-rw-r--r-- | url/url_canon_ip.h | 37 | ||||
-rw-r--r-- | url/url_export.h | 33 | ||||
-rw-r--r-- | url/url_parse.h | 104 | ||||
-rw-r--r-- | url/url_util.h | 117 |
9 files changed, 463 insertions, 414 deletions
@@ -11,6 +11,7 @@ #include "base/string16.h" #include "url/url_canon.h" #include "url/url_canon_stdstring.h" +#include "url/url_export.h" #include "url/url_parse.h" class GURL { @@ -19,11 +20,11 @@ class GURL { typedef url_canon::StdStringReplacements<string16> ReplacementsW; // Creates an empty, invalid URL. - GURL(); + URL_EXPORT GURL(); // Copy construction is relatively inexpensive, with most of the time going // to reallocating the string. It does not re-parse. - GURL(const GURL& other); + URL_EXPORT GURL(const GURL& other); // The narrow version requires the input be UTF-8. Invalid UTF-8 input will // result in an invalid URL. @@ -32,20 +33,20 @@ class GURL { // encode the query parameters. It is probably sufficient for the narrow // version to assume the query parameter encoding should be the same as the // input encoding. - explicit GURL(const std::string& url_string - /*, output_param_encoding*/); - explicit GURL(const string16& url_string - /*, output_param_encoding*/); + URL_EXPORT explicit GURL(const std::string& url_string + /*, output_param_encoding*/); + URL_EXPORT explicit GURL(const string16& url_string + /*, output_param_encoding*/); // Constructor for URLs that have already been parsed and canonicalized. This // is used for conversions from KURL, for example. The caller must supply all // information associated with the URL, which must be correct and consistent. - GURL(const char* canonical_spec, size_t canonical_spec_len, - const url_parse::Parsed& parsed, bool is_valid); + URL_EXPORT GURL(const char* canonical_spec, size_t canonical_spec_len, + const url_parse::Parsed& parsed, bool is_valid); - ~GURL(); + URL_EXPORT ~GURL(); - GURL& operator=(const GURL& other); + URL_EXPORT GURL& operator=(const GURL& other); // Returns true when this object represents a valid parsed URL. When not // valid, other functions will still succeed, but you will not get canonical @@ -77,7 +78,7 @@ class GURL { // Used invalid_spec() below to get the unusable spec of an invalid URL. This // separation is designed to prevent errors that may cause security problems // that could result from the mistaken use of an invalid URL. - const std::string& spec() const; + URL_EXPORT const std::string& spec() const; // Returns the potentially invalid spec for a the URL. This spec MUST NOT be // modified or sent over the network. It is designed to be displayed in error @@ -129,8 +130,8 @@ class GURL { // // It is an error to resolve a URL relative to an invalid URL. The result // will be the empty URL. - GURL Resolve(const std::string& relative) const; - GURL Resolve(const string16& relative) const; + URL_EXPORT GURL Resolve(const std::string& relative) const; + URL_EXPORT GURL Resolve(const string16& relative) const; // Like Resolve() above but takes a character set encoder which will be used // for any query text specified in the input. The charset converter parameter @@ -139,10 +140,10 @@ class GURL { // TODO(brettw): These should be replaced with versions that take something // more friendly than a raw CharsetConverter (maybe like an ICU character set // name). - GURL ResolveWithCharsetConverter( + URL_EXPORT GURL ResolveWithCharsetConverter( const std::string& relative, url_canon::CharsetConverter* charset_converter) const; - GURL ResolveWithCharsetConverter( + URL_EXPORT GURL ResolveWithCharsetConverter( const string16& relative, url_canon::CharsetConverter* charset_converter) const; @@ -157,9 +158,9 @@ class GURL { // // Note that we use the more general url_canon::Replacements type to give // callers extra flexibility rather than our override. - GURL ReplaceComponents( + URL_EXPORT GURL ReplaceComponents( const url_canon::Replacements<char>& replacements) const; - GURL ReplaceComponents( + URL_EXPORT GURL ReplaceComponents( const url_canon::Replacements<char16>& replacements) const; // A helper function that is equivalent to replacing the path with a slash @@ -171,7 +172,7 @@ class GURL { // // It is an error to get an empty path on an invalid URL. The result // will be the empty URL. - GURL GetWithEmptyPath() const; + URL_EXPORT GURL GetWithEmptyPath() const; // A helper function to return a GURL containing just the scheme, host, // and port from a URL. Equivalent to clearing any username and password, @@ -182,19 +183,19 @@ class GURL { // // It is an error to get the origin of an invalid URL. The result // will be the empty URL. - GURL GetOrigin() const; + URL_EXPORT GURL GetOrigin() const; // Returns true if the scheme for the current URL is a known "standard" // scheme. Standard schemes have an authority and a path section. This // includes file: and filesystem:, which some callers may want to filter out // explicitly by calling SchemeIsFile[System]. - bool IsStandard() const; + URL_EXPORT bool IsStandard() const; // Returns true if the given parameter (should be lower-case ASCII to match // the canonicalized scheme) is the scheme for this URL. This call is more // efficient than getting the scheme and comparing it because no copies or // object constructions are done. - bool SchemeIs(const char* lower_ascii_scheme) const; + URL_EXPORT bool SchemeIs(const char* lower_ascii_scheme) const; // We often need to know if this is a file URL. File URLs are "standard", but // are often treated separately by some programs. @@ -216,7 +217,7 @@ class GURL { // Returns true if the hostname is an IP address. Note: this function isn't // as cheap as a simple getter because it re-parses the hostname to verify. // This currently identifies only IPv4 addresses (bug 822685). - bool HostIsIPAddress() const; + URL_EXPORT bool HostIsIPAddress() const; // Getters for various components of the URL. The returned string will be // empty if the component is empty or is not present. @@ -282,24 +283,24 @@ class GURL { // Returns a parsed version of the port. Can also be any of the special // values defined in Parsed for ExtractPort. - int IntPort() const; + URL_EXPORT int IntPort() const; // Returns the port number of the url, or the default port number. // If the scheme has no concept of port (or unknown default) returns // PORT_UNSPECIFIED. - int EffectiveIntPort() const; + URL_EXPORT int EffectiveIntPort() const; // Extracts the filename portion of the path and returns it. The filename // is everything after the last slash in the path. This may be empty. - std::string ExtractFileName() const; + URL_EXPORT std::string ExtractFileName() const; // Returns the path that should be sent to the server. This is the path, // parameter, and query portions of the URL. It is guaranteed to be ASCII. - std::string PathForRequest() const; + URL_EXPORT std::string PathForRequest() const; // Returns the host, excluding the square brackets surrounding IPv6 address // literals. This can be useful for passing to getaddrinfo(). - std::string HostNoBrackets() const; + URL_EXPORT std::string HostNoBrackets() const; // Returns true if this URL's host matches or is in the same domain as // the given input string. For example if this URL was "www.google.com", @@ -311,7 +312,8 @@ class GURL { // // If function DomainIs has parameter domain_len, which means the parameter // lower_ascii_domain does not gurantee to terminate with NULL character. - bool DomainIs(const char* lower_ascii_domain, int domain_len) const; + URL_EXPORT bool DomainIs(const char* lower_ascii_domain, + int domain_len) const; // If function DomainIs only has parameter lower_ascii_domain, which means // domain string should be terminate with NULL character. @@ -322,12 +324,12 @@ class GURL { // Swaps the contents of this GURL object with the argument without doing // any memory allocations. - void Swap(GURL* other); + URL_EXPORT void Swap(GURL* other); // Returns a reference to a singleton empty GURL. This object is for callers // who return references but don't have anything to return in some cases. // This function may be called from any thread. - static const GURL& EmptyGURL(); + URL_EXPORT static const GURL& EmptyGURL(); // Returns the inner URL of a nested URL [currently only non-null for // filesystem: URLs]. @@ -361,6 +363,6 @@ class GURL { }; // Stream operator so GURL can be used in assertion statements. -std::ostream& operator<<(std::ostream& out, const GURL& url); +URL_EXPORT std::ostream& operator<<(std::ostream& out, const GURL& url); #endif // URL_GURL_H_ diff --git a/url/url.gyp b/url/url.gyp index 0434669..d9b5807eb 100644 --- a/url/url.gyp +++ b/url/url.gyp @@ -9,7 +9,7 @@ 'targets': [ { 'target_name': 'url', - 'type': 'static_library', + 'type': '<(component)', 'dependencies': [ '../base/base.gyp:base', '../third_party/icu/icu.gyp:icudata', @@ -52,7 +52,7 @@ ], }, 'defines': [ - 'FULL_FILESYSTEM_URL_SUPPORT=1', + 'URL_IMPLEMENTATION', ], # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. 'msvs_disabled_warnings': [4267, ], @@ -74,9 +74,6 @@ 'url_test_utils.h', 'url_util_unittest.cc', ], - 'defines': [ - 'FULL_FILESYSTEM_URL_SUPPORT=1', - ], 'conditions': [ ['os_posix==1 and OS!="mac" and OS!="ios"', { diff --git a/url/url_canon.h b/url/url_canon.h index 9987b95..7d4b75a 100644 --- a/url/url_canon.h +++ b/url/url_canon.h @@ -9,6 +9,7 @@ #include <string.h> #include "base/string16.h" +#include "url/url_export.h" #include "url/url_parse.h" namespace url_canon { @@ -186,7 +187,7 @@ class RawCanonOutputW : public RawCanonOutputT<char16, fixed_capacity> {}; // // Embedders will want to see the unit test for the ICU version. -class CharsetConverter { +class URL_EXPORT CharsetConverter { public: CharsetConverter() {} virtual ~CharsetConverter() {} @@ -224,12 +225,12 @@ class CharsetConverter { // // Therefore, callers should not use the buffer, since it may actuall be empty, // use the computed pointer and |*output_len| instead. -const char* RemoveURLWhitespace(const char* input, int input_len, - CanonOutputT<char>* buffer, - int* output_len); -const char16* RemoveURLWhitespace(const char16* input, int input_len, - CanonOutputT<char16>* buffer, - int* output_len); +URL_EXPORT const char* RemoveURLWhitespace(const char* input, int input_len, + CanonOutputT<char>* buffer, + int* output_len); +URL_EXPORT const char16* RemoveURLWhitespace(const char16* input, int input_len, + CanonOutputT<char16>* buffer, + int* output_len); // IDN ------------------------------------------------------------------------ @@ -242,7 +243,9 @@ const char16* RemoveURLWhitespace(const char16* input, int input_len, // the length of the output will be set to the length of the new host name. // // On error, returns false. The output in this case is undefined. -bool IDNToASCII(const char16* src, int src_len, CanonOutputW* output); +URL_EXPORT bool IDNToASCII(const char16* src, + int src_len, + CanonOutputW* output); // Piece-by-piece canonicalizers ---------------------------------------------- // @@ -268,14 +271,14 @@ bool IDNToASCII(const char16* src, int src_len, CanonOutputW* output); // URLs. // // The 8-bit version requires UTF-8 encoding. -bool CanonicalizeScheme(const char* spec, - const url_parse::Component& scheme, - CanonOutput* output, - url_parse::Component* out_scheme); -bool CanonicalizeScheme(const char16* spec, - const url_parse::Component& scheme, - CanonOutput* output, - url_parse::Component* out_scheme); +URL_EXPORT bool CanonicalizeScheme(const char* spec, + const url_parse::Component& scheme, + CanonOutput* output, + url_parse::Component* out_scheme); +URL_EXPORT bool CanonicalizeScheme(const char16* spec, + const url_parse::Component& scheme, + CanonOutput* output, + url_parse::Component* out_scheme); // User info: username/password. If present, this will add the delimiters so // the output will be "<username>:<password>@" or "<username>@". Empty @@ -287,20 +290,20 @@ bool CanonicalizeScheme(const char16* spec, // is legal as long as the two components don't overlap. // // The 8-bit version requires UTF-8 encoding. -bool CanonicalizeUserInfo(const char* username_source, - const url_parse::Component& username, - const char* password_source, - const url_parse::Component& password, - CanonOutput* output, - url_parse::Component* out_username, - url_parse::Component* out_password); -bool CanonicalizeUserInfo(const char16* username_source, - const url_parse::Component& username, - const char16* password_source, - const url_parse::Component& password, - CanonOutput* output, - url_parse::Component* out_username, - url_parse::Component* out_password); +URL_EXPORT bool CanonicalizeUserInfo(const char* username_source, + const url_parse::Component& username, + const char* password_source, + const url_parse::Component& password, + CanonOutput* output, + url_parse::Component* out_username, + url_parse::Component* out_password); +URL_EXPORT bool CanonicalizeUserInfo(const char16* username_source, + const url_parse::Component& username, + const char16* password_source, + const url_parse::Component& password, + CanonOutput* output, + url_parse::Component* out_username, + url_parse::Component* out_password); // This structure holds detailed state exported from the IP/Host canonicalizers. @@ -353,27 +356,27 @@ struct CanonHostInfo { // // The 8-bit version requires UTF-8 encoding. Use this version when you only // need to know whether canonicalization succeeded. -bool CanonicalizeHost(const char* spec, - const url_parse::Component& host, - CanonOutput* output, - url_parse::Component* out_host); -bool CanonicalizeHost(const char16* spec, - const url_parse::Component& host, - CanonOutput* output, - url_parse::Component* out_host); +URL_EXPORT bool CanonicalizeHost(const char* spec, + const url_parse::Component& host, + CanonOutput* output, + url_parse::Component* out_host); +URL_EXPORT bool CanonicalizeHost(const char16* spec, + const url_parse::Component& host, + CanonOutput* output, + url_parse::Component* out_host); // Extended version of CanonicalizeHost, which returns additional information. // Use this when you need to know whether the hostname was an IP address. // A successful return is indicated by host_info->family != BROKEN. See the // definition of CanonHostInfo above for details. -void CanonicalizeHostVerbose(const char* spec, - const url_parse::Component& host, - CanonOutput* output, - CanonHostInfo* host_info); -void CanonicalizeHostVerbose(const char16* spec, - const url_parse::Component& host, - CanonOutput* output, - CanonHostInfo* host_info); +URL_EXPORT void CanonicalizeHostVerbose(const char* spec, + const url_parse::Component& host, + CanonOutput* output, + CanonHostInfo* host_info); +URL_EXPORT void CanonicalizeHostVerbose(const char16* spec, + const url_parse::Component& host, + CanonOutput* output, + CanonHostInfo* host_info); // IP addresses. @@ -386,34 +389,34 @@ void CanonicalizeHostVerbose(const char16* spec, // This is called AUTOMATICALLY from the host canonicalizer, which ensures that // the input is unescaped and name-prepped, etc. It should not normally be // necessary or wise to call this directly. -void CanonicalizeIPAddress(const char* spec, - const url_parse::Component& host, - CanonOutput* output, - CanonHostInfo* host_info); -void CanonicalizeIPAddress(const char16* spec, - const url_parse::Component& host, - CanonOutput* output, - CanonHostInfo* host_info); +URL_EXPORT void CanonicalizeIPAddress(const char* spec, + const url_parse::Component& host, + CanonOutput* output, + CanonHostInfo* host_info); +URL_EXPORT void CanonicalizeIPAddress(const char16* spec, + const url_parse::Component& host, + CanonOutput* output, + CanonHostInfo* host_info); // Port: this function will add the colon for the port if a port is present. // The caller can pass url_parse::PORT_UNSPECIFIED as the // default_port_for_scheme argument if there is no default port. // // The 8-bit version requires UTF-8 encoding. -bool CanonicalizePort(const char* spec, - const url_parse::Component& port, - int default_port_for_scheme, - CanonOutput* output, - url_parse::Component* out_port); -bool CanonicalizePort(const char16* spec, - const url_parse::Component& port, - int default_port_for_scheme, - CanonOutput* output, - url_parse::Component* out_port); +URL_EXPORT bool CanonicalizePort(const char* spec, + const url_parse::Component& port, + int default_port_for_scheme, + CanonOutput* output, + url_parse::Component* out_port); +URL_EXPORT bool CanonicalizePort(const char16* spec, + const url_parse::Component& port, + int default_port_for_scheme, + CanonOutput* output, + url_parse::Component* out_port); // Returns the default port for the given canonical scheme, or PORT_UNSPECIFIED // if the scheme is unknown. -int DefaultPortForScheme(const char* scheme, int scheme_len); +URL_EXPORT int DefaultPortForScheme(const char* scheme, int scheme_len); // Path. If the input does not begin in a slash (including if the input is // empty), we'll prepend a slash to the path to make it canonical. @@ -424,14 +427,14 @@ int DefaultPortForScheme(const char* scheme, int scheme_len); // an issue. Somebody giving us an 8-bit path is responsible for generating // the path that the server expects (we'll escape high-bit characters), so // if something is invalid, it's their problem. -bool CanonicalizePath(const char* spec, - const url_parse::Component& path, - CanonOutput* output, - url_parse::Component* out_path); -bool CanonicalizePath(const char16* spec, - const url_parse::Component& path, - CanonOutput* output, - url_parse::Component* out_path); +URL_EXPORT bool CanonicalizePath(const char* spec, + const url_parse::Component& path, + CanonOutput* output, + url_parse::Component* out_path); +URL_EXPORT bool CanonicalizePath(const char16* spec, + const url_parse::Component& path, + CanonOutput* output, + url_parse::Component* out_path); // Canonicalizes the input as a file path. This is like CanonicalizePath except // that it also handles Windows drive specs. For example, the path can begin @@ -439,14 +442,14 @@ bool CanonicalizePath(const char16* spec, // The string will be appended to |*output| and |*out_path| will be updated. // // The 8-bit version requires UTF-8 encoding. -bool FileCanonicalizePath(const char* spec, - const url_parse::Component& path, - CanonOutput* output, - url_parse::Component* out_path); -bool FileCanonicalizePath(const char16* spec, - const url_parse::Component& path, - CanonOutput* output, - url_parse::Component* out_path); +URL_EXPORT bool FileCanonicalizePath(const char* spec, + const url_parse::Component& path, + CanonOutput* output, + url_parse::Component* out_path); +URL_EXPORT bool FileCanonicalizePath(const char16* spec, + const url_parse::Component& path, + CanonOutput* output, + url_parse::Component* out_path); // Query: Prepends the ? if needed. // @@ -460,16 +463,16 @@ bool FileCanonicalizePath(const char16* spec, // if necessary, for ASCII input, no conversions are necessary. // // The converter can be NULL. In this case, the output encoding will be UTF-8. -void CanonicalizeQuery(const char* spec, - const url_parse::Component& query, - CharsetConverter* converter, - CanonOutput* output, - url_parse::Component* out_query); -void CanonicalizeQuery(const char16* spec, - const url_parse::Component& query, - CharsetConverter* converter, - CanonOutput* output, - url_parse::Component* out_query); +URL_EXPORT void CanonicalizeQuery(const char* spec, + const url_parse::Component& query, + CharsetConverter* converter, + CanonOutput* output, + url_parse::Component* out_query); +URL_EXPORT void CanonicalizeQuery(const char16* spec, + const url_parse::Component& query, + CharsetConverter* converter, + CanonOutput* output, + url_parse::Component* out_query); // Ref: Prepends the # if needed. The output will be UTF-8 (this is the only // canonicalizer that does not produce ASCII output). The output is @@ -477,14 +480,14 @@ void CanonicalizeQuery(const char16* spec, // // This function will not fail. If the input is invalid UTF-8/UTF-16, we'll use // the "Unicode replacement character" for the confusing bits and copy the rest. -void CanonicalizeRef(const char* spec, - const url_parse::Component& path, - CanonOutput* output, - url_parse::Component* out_path); -void CanonicalizeRef(const char16* spec, - const url_parse::Component& path, - CanonOutput* output, - url_parse::Component* out_path); +URL_EXPORT void CanonicalizeRef(const char* spec, + const url_parse::Component& path, + CanonOutput* output, + url_parse::Component* out_path); +URL_EXPORT void CanonicalizeRef(const char16* spec, + const url_parse::Component& path, + CanonOutput* output, + url_parse::Component* out_path); // Full canonicalizer --------------------------------------------------------- // @@ -497,75 +500,75 @@ void CanonicalizeRef(const char16* spec, // The 8-bit versions require UTF-8 encoding. // Use for standard URLs with authorities and paths. -bool CanonicalizeStandardURL(const char* spec, - int spec_len, - const url_parse::Parsed& parsed, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* new_parsed); -bool CanonicalizeStandardURL(const char16* spec, - int spec_len, - const url_parse::Parsed& parsed, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* new_parsed); +URL_EXPORT bool CanonicalizeStandardURL(const char* spec, + int spec_len, + const url_parse::Parsed& parsed, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* new_parsed); +URL_EXPORT bool CanonicalizeStandardURL(const char16* spec, + int spec_len, + const url_parse::Parsed& parsed, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* new_parsed); // Use for file URLs. -bool CanonicalizeFileURL(const char* spec, - int spec_len, - const url_parse::Parsed& parsed, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* new_parsed); -bool CanonicalizeFileURL(const char16* spec, - int spec_len, - const url_parse::Parsed& parsed, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* new_parsed); +URL_EXPORT bool CanonicalizeFileURL(const char* spec, + int spec_len, + const url_parse::Parsed& parsed, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* new_parsed); +URL_EXPORT bool CanonicalizeFileURL(const char16* spec, + int spec_len, + const url_parse::Parsed& parsed, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* new_parsed); // Use for filesystem URLs. -bool CanonicalizeFileSystemURL(const char* spec, - int spec_len, - const url_parse::Parsed& parsed, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* new_parsed); -bool CanonicalizeFileSystemURL(const char16* spec, - int spec_len, - const url_parse::Parsed& parsed, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* new_parsed); +URL_EXPORT bool CanonicalizeFileSystemURL(const char* spec, + int spec_len, + const url_parse::Parsed& parsed, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* new_parsed); +URL_EXPORT bool CanonicalizeFileSystemURL(const char16* spec, + int spec_len, + const url_parse::Parsed& parsed, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* new_parsed); // Use for path URLs such as javascript. This does not modify the path in any // way, for example, by escaping it. -bool CanonicalizePathURL(const char* spec, - int spec_len, - const url_parse::Parsed& parsed, - CanonOutput* output, - url_parse::Parsed* new_parsed); -bool CanonicalizePathURL(const char16* spec, - int spec_len, - const url_parse::Parsed& parsed, - CanonOutput* output, - url_parse::Parsed* new_parsed); +URL_EXPORT bool CanonicalizePathURL(const char* spec, + int spec_len, + const url_parse::Parsed& parsed, + CanonOutput* output, + url_parse::Parsed* new_parsed); +URL_EXPORT bool CanonicalizePathURL(const char16* spec, + int spec_len, + const url_parse::Parsed& parsed, + CanonOutput* output, + url_parse::Parsed* new_parsed); // Use for mailto URLs. This "canonicalizes" the url into a path and query // component. It does not attempt to merge "to" fields. It uses UTF-8 for // the query encoding if there is a query. This is because a mailto URL is // really intended for an external mail program, and the encoding of a page, // etc. which would influence a query encoding normally are irrelevant. -bool CanonicalizeMailtoURL(const char* spec, - int spec_len, - const url_parse::Parsed& parsed, - CanonOutput* output, - url_parse::Parsed* new_parsed); -bool CanonicalizeMailtoURL(const char16* spec, - int spec_len, - const url_parse::Parsed& parsed, - CanonOutput* output, - url_parse::Parsed* new_parsed); +URL_EXPORT bool CanonicalizeMailtoURL(const char* spec, + int spec_len, + const url_parse::Parsed& parsed, + CanonOutput* output, + url_parse::Parsed* new_parsed); +URL_EXPORT bool CanonicalizeMailtoURL(const char16* spec, + int spec_len, + const url_parse::Parsed& parsed, + CanonOutput* output, + url_parse::Parsed* new_parsed); // Part replacer -------------------------------------------------------------- @@ -750,74 +753,74 @@ class Replacements { }; // The base must be an 8-bit canonical URL. -bool ReplaceStandardURL(const char* base, - const url_parse::Parsed& base_parsed, - const Replacements<char>& replacements, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* new_parsed); -bool ReplaceStandardURL(const char* base, - const url_parse::Parsed& base_parsed, - const Replacements<char16>& replacements, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* new_parsed); +URL_EXPORT bool ReplaceStandardURL(const char* base, + const url_parse::Parsed& base_parsed, + const Replacements<char>& replacements, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* new_parsed); +URL_EXPORT bool ReplaceStandardURL(const char* base, + const url_parse::Parsed& base_parsed, + const Replacements<char16>& replacements, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* new_parsed); // Filesystem URLs can only have the path, query, or ref replaced. // All other components will be ignored. -bool ReplaceFileSystemURL(const char* base, - const url_parse::Parsed& base_parsed, - const Replacements<char>& replacements, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* new_parsed); -bool ReplaceFileSystemURL(const char* base, - const url_parse::Parsed& base_parsed, - const Replacements<char16>& replacements, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* new_parsed); +URL_EXPORT bool ReplaceFileSystemURL(const char* base, + const url_parse::Parsed& base_parsed, + const Replacements<char>& replacements, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* new_parsed); +URL_EXPORT bool ReplaceFileSystemURL(const char* base, + const url_parse::Parsed& base_parsed, + const Replacements<char16>& replacements, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* new_parsed); // Replacing some parts of a file URL is not permitted. Everything except // the host, path, query, and ref will be ignored. -bool ReplaceFileURL(const char* base, - const url_parse::Parsed& base_parsed, - const Replacements<char>& replacements, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* new_parsed); -bool ReplaceFileURL(const char* base, - const url_parse::Parsed& base_parsed, - const Replacements<char16>& replacements, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* new_parsed); +URL_EXPORT bool ReplaceFileURL(const char* base, + const url_parse::Parsed& base_parsed, + const Replacements<char>& replacements, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* new_parsed); +URL_EXPORT bool ReplaceFileURL(const char* base, + const url_parse::Parsed& base_parsed, + const Replacements<char16>& replacements, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* new_parsed); // Path URLs can only have the scheme and path replaced. All other components // will be ignored. -bool ReplacePathURL(const char* base, - const url_parse::Parsed& base_parsed, - const Replacements<char>& replacements, - CanonOutput* output, - url_parse::Parsed* new_parsed); -bool ReplacePathURL(const char* base, - const url_parse::Parsed& base_parsed, - const Replacements<char16>& replacements, - CanonOutput* output, - url_parse::Parsed* new_parsed); +URL_EXPORT bool ReplacePathURL(const char* base, + const url_parse::Parsed& base_parsed, + const Replacements<char>& replacements, + CanonOutput* output, + url_parse::Parsed* new_parsed); +URL_EXPORT bool ReplacePathURL(const char* base, + const url_parse::Parsed& base_parsed, + const Replacements<char16>& replacements, + CanonOutput* output, + url_parse::Parsed* new_parsed); // Mailto URLs can only have the scheme, path, and query replaced. // All other components will be ignored. -bool ReplaceMailtoURL(const char* base, - const url_parse::Parsed& base_parsed, - const Replacements<char>& replacements, - CanonOutput* output, - url_parse::Parsed* new_parsed); -bool ReplaceMailtoURL(const char* base, - const url_parse::Parsed& base_parsed, - const Replacements<char16>& replacements, - CanonOutput* output, - url_parse::Parsed* new_parsed); +URL_EXPORT bool ReplaceMailtoURL(const char* base, + const url_parse::Parsed& base_parsed, + const Replacements<char>& replacements, + CanonOutput* output, + url_parse::Parsed* new_parsed); +URL_EXPORT bool ReplaceMailtoURL(const char* base, + const url_parse::Parsed& base_parsed, + const Replacements<char16>& replacements, + CanonOutput* output, + url_parse::Parsed* new_parsed); // Relative URL --------------------------------------------------------------- @@ -832,20 +835,20 @@ bool ReplaceMailtoURL(const char* base, // not). Failure means that the combination of URLs doesn't make any sense. // // The base URL should always be canonical, therefore is ASCII. -bool IsRelativeURL(const char* base, - const url_parse::Parsed& base_parsed, - const char* fragment, - int fragment_len, - bool is_base_hierarchical, - bool* is_relative, - url_parse::Component* relative_component); -bool IsRelativeURL(const char* base, - const url_parse::Parsed& base_parsed, - const char16* fragment, - int fragment_len, - bool is_base_hierarchical, - bool* is_relative, - url_parse::Component* relative_component); +URL_EXPORT bool IsRelativeURL(const char* base, + const url_parse::Parsed& base_parsed, + const char* fragment, + int fragment_len, + bool is_base_hierarchical, + bool* is_relative, + url_parse::Component* relative_component); +URL_EXPORT bool IsRelativeURL(const char* base, + const url_parse::Parsed& base_parsed, + const char16* fragment, + int fragment_len, + bool is_base_hierarchical, + bool* is_relative, + url_parse::Component* relative_component); // Given a canonical parsed source URL, a URL fragment known to be relative, // and the identified relevant portion of the relative URL (computed by @@ -865,22 +868,24 @@ bool IsRelativeURL(const char* base, // Returns true on success. On failure, the output will be "something // reasonable" that will be consistent and valid, just probably not what // was intended by the web page author or caller. -bool ResolveRelativeURL(const char* base_url, - const url_parse::Parsed& base_parsed, - bool base_is_file, - const char* relative_url, - const url_parse::Component& relative_component, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* out_parsed); -bool ResolveRelativeURL(const char* base_url, - const url_parse::Parsed& base_parsed, - bool base_is_file, - const char16* relative_url, - const url_parse::Component& relative_component, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* out_parsed); +URL_EXPORT bool ResolveRelativeURL( + const char* base_url, + const url_parse::Parsed& base_parsed, + bool base_is_file, + const char* relative_url, + const url_parse::Component& relative_component, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* out_parsed); +URL_EXPORT bool ResolveRelativeURL( + const char* base_url, + const url_parse::Parsed& base_parsed, + bool base_is_file, + const char16* relative_url, + const url_parse::Component& relative_component, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* out_parsed); } // namespace url_canon diff --git a/url/url_canon_icu.h b/url/url_canon_icu.h index d8eacbf..1f9f092 100644 --- a/url/url_canon_icu.h +++ b/url/url_canon_icu.h @@ -8,6 +8,7 @@ // ICU integration functions. #include "url/url_canon.h" +#include "url/url_export.h" typedef struct UConverter UConverter; @@ -15,7 +16,7 @@ namespace url_canon { // An implementation of CharsetConverter that implementations can use to // interface the canonicalizer with ICU's conversion routines. -class ICUCharsetConverter : public CharsetConverter { +class URL_EXPORT ICUCharsetConverter : public CharsetConverter { public: // Constructs a converter using an already-existing ICU character set // converter. This converter is NOT owned by this object; the lifetime must diff --git a/url/url_canon_internal.h b/url/url_canon_internal.h index 265bdfd..23adc9e 100644 --- a/url/url_canon_internal.h +++ b/url/url_canon_internal.h @@ -83,7 +83,7 @@ void AppendStringOfType(const char16* source, int length, // Maps the hex numerical values 0x0 to 0xf to the corresponding ASCII digit // that will be used to represent it. -extern const char kHexCharLookup[0x10]; +URL_EXPORT extern const char kHexCharLookup[0x10]; // This lookup table allows fast conversion between ASCII hex letters and their // corresponding numerical value. The 8-bit range is divided up into 8 @@ -150,8 +150,8 @@ extern const char16 kUnicodeReplacementCharacter; // (for a single-byte ASCII character, it will not be changed). // // Implementation is in url_canon_icu.cc. -bool ReadUTFChar(const char* str, int* begin, int length, - unsigned* code_point_out); +URL_EXPORT bool ReadUTFChar(const char* str, int* begin, int length, + unsigned* code_point_out); // Generic To-UTF-8 converter. This will call the given append method for each // character that should be appended, with the given output method. Wrappers @@ -227,8 +227,8 @@ inline void AppendUTF8EscapedValue(unsigned char_value, CanonOutput* output) { // (for a single-16-bit-word character, it will not be changed). // // Implementation is in url_canon_icu.cc. -bool ReadUTFChar(const char16* str, int* begin, int length, - unsigned* code_point); +URL_EXPORT bool ReadUTFChar(const char16* str, int* begin, int length, + unsigned* code_point); // Equivalent to U16_APPEND_UNSAFE in ICU but uses our output method. inline void AppendUTF16Value(unsigned code_point, @@ -346,10 +346,10 @@ void AppendInvalidNarrowString(const char16* spec, int begin, int end, // replacing the invalid characters with the "invalid character". It will // return false in the failure case, and the caller should not continue as // normal. -bool ConvertUTF16ToUTF8(const char16* input, int input_len, - CanonOutput* output); -bool ConvertUTF8ToUTF16(const char* input, int input_len, - CanonOutputT<char16>* output); +URL_EXPORT bool ConvertUTF16ToUTF8(const char16* input, int input_len, + CanonOutput* output); +URL_EXPORT bool ConvertUTF8ToUTF16(const char* input, int input_len, + CanonOutputT<char16>* output); // Converts from UTF-16 to 8-bit using the character set converter. If the // converter is NULL, this will use UTF-8. @@ -408,9 +408,10 @@ bool CanonicalizePartialPath(const char16* spec, #ifndef WIN32 // Implementations of Windows' int-to-string conversions -int _itoa_s(int value, char* buffer, size_t size_in_chars, int radix); -int _itow_s(int value, char16* buffer, size_t size_in_chars, - int radix); +URL_EXPORT int _itoa_s(int value, char* buffer, size_t size_in_chars, + int radix); +URL_EXPORT int _itow_s(int value, char16* buffer, size_t size_in_chars, + int radix); // Secure template overloads for these functions template<size_t N> diff --git a/url/url_canon_ip.h b/url/url_canon_ip.h index bf4b4ad..fd288ad 100644 --- a/url/url_canon_ip.h +++ b/url/url_canon_ip.h @@ -7,17 +7,18 @@ #include "base/string16.h" #include "url/url_canon.h" +#include "url/url_export.h" #include "url/url_parse.h" namespace url_canon { // Writes the given IPv4 address to |output|. -void AppendIPv4Address(const unsigned char address[4], - CanonOutput* output); +URL_EXPORT void AppendIPv4Address(const unsigned char address[4], + CanonOutput* output); // Writes the given IPv6 address to |output|. -void AppendIPv6Address(const unsigned char address[16], - CanonOutput* output); +URL_EXPORT void AppendIPv6Address(const unsigned char address[16], + CanonOutput* output); // Searches the host name for the portions of the IPv4 address. On success, // each component will be placed into |components| and it will return true. @@ -37,12 +38,12 @@ void AppendIPv6Address(const unsigned char address[16], // Mozilla), so this code path never gets hit. Our host canonicalization will // notice these spaces and escape them, which will make IP address finding // fail. This seems like better behavior than stripping after a space. -bool FindIPv4Components(const char* spec, - const url_parse::Component& host, - url_parse::Component components[4]); -bool FindIPv4Components(const char16* spec, - const url_parse::Component& host, - url_parse::Component components[4]); +URL_EXPORT bool FindIPv4Components(const char* spec, + const url_parse::Component& host, + url_parse::Component components[4]); +URL_EXPORT bool FindIPv4Components(const char16* spec, + const url_parse::Component& host, + url_parse::Component components[4]); // Converts an IPv4 address to a 32-bit number (network byte order). // @@ -55,12 +56,12 @@ bool FindIPv4Components(const char16* spec, // // On success, |num_ipv4_components| will be populated with the number of // components in the IPv4 address. -CanonHostInfo::Family IPv4AddressToNumber( +URL_EXPORT CanonHostInfo::Family IPv4AddressToNumber( const char* spec, const url_parse::Component& host, unsigned char address[4], int* num_ipv4_components); -CanonHostInfo::Family IPv4AddressToNumber( +URL_EXPORT CanonHostInfo::Family IPv4AddressToNumber( const char16* spec, const url_parse::Component& host, unsigned char address[4], @@ -71,12 +72,12 @@ CanonHostInfo::Family IPv4AddressToNumber( // // NOTE that |host| is expected to be surrounded by square brackets. // i.e. "[::1]" rather than "::1". -bool IPv6AddressToNumber(const char* spec, - const url_parse::Component& host, - unsigned char address[16]); -bool IPv6AddressToNumber(const char16* spec, - const url_parse::Component& host, - unsigned char address[16]); +URL_EXPORT bool IPv6AddressToNumber(const char* spec, + const url_parse::Component& host, + unsigned char address[16]); +URL_EXPORT bool IPv6AddressToNumber(const char16* spec, + const url_parse::Component& host, + unsigned char address[16]); } // namespace url_canon diff --git a/url/url_export.h b/url/url_export.h new file mode 100644 index 0000000..9766ed5 --- /dev/null +++ b/url/url_export.h @@ -0,0 +1,33 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef URL_URL_EXPORT_H_ +#define URL_URL_EXPORT_H_ + +#if defined(COMPONENT_BUILD) +#if defined(WIN32) + +#if defined(URL_IMPLEMENTATION) +#define URL_EXPORT __declspec(dllexport) +#else +#define URL_EXPORT __declspec(dllimport) +#endif // defined(URL_IMPLEMENTATION) + +#else // !defined(WIN32) + +#if defined(URL_IMPLEMENTATION) +#define URL_EXPORT __attribute__((visibility("default"))) +#else +#define URL_EXPORT +#endif // defined(URL_IMPLEMENTATION) + +#endif // defined(WIN32) + +#else // !defined(COMPONENT_BUILD) + +#define URL_EXPORT + +#endif + +#endif // URL_URL_EXPORT_H_ diff --git a/url/url_parse.h b/url/url_parse.h index 5c3643f..2170904 100644 --- a/url/url_parse.h +++ b/url/url_parse.h @@ -9,6 +9,7 @@ #include "base/basictypes.h" #include "base/string16.h" +#include "url/url_export.h" namespace url_parse { @@ -80,7 +81,7 @@ inline Component MakeRange(int begin, int end) { // else // url_parse::ParsePathURL(url, url_len, &parsed); // -struct Parsed { +struct URL_EXPORT Parsed { // Identifies different components. enum ComponentType { SCHEME, @@ -134,8 +135,7 @@ struct Parsed { // *QUERY: 14 15 <- // *REF: 20 20 // - int CountCharactersBefore(ComponentType type, - bool include_delimiter) const; + int CountCharactersBefore(ComponentType type, bool include_delimiter) const; // Scheme without the colon: "http://foo"/ would have a scheme of "http". // The length will be -1 if no scheme is specified ("foo.com"), or 0 if there @@ -220,32 +220,36 @@ struct Parsed { // StandardURL is for when the scheme is known to be one that has an // authority (host) like "http". This function will not handle weird ones // like "about:" and "javascript:", or do the right thing for "file:" URLs. -void ParseStandardURL(const char* url, int url_len, Parsed* parsed); -void ParseStandardURL(const char16* url, int url_len, Parsed* parsed); +URL_EXPORT void ParseStandardURL(const char* url, + int url_len, + Parsed* parsed); +URL_EXPORT void ParseStandardURL(const char16* url, + int url_len, + Parsed* parsed); // PathURL is for when the scheme is known not to have an authority (host) // section but that aren't file URLs either. The scheme is parsed, and // everything after the scheme is considered as the path. This is used for // things like "about:" and "javascript:" -void ParsePathURL(const char* url, int url_len, Parsed* parsed); -void ParsePathURL(const char16* url, int url_len, Parsed* parsed); +URL_EXPORT void ParsePathURL(const char* url, int url_len, Parsed* parsed); +URL_EXPORT void ParsePathURL(const char16* url, int url_len, Parsed* parsed); // FileURL is for file URLs. There are some special rules for interpreting // these. -void ParseFileURL(const char* url, int url_len, Parsed* parsed); -void ParseFileURL(const char16* url, int url_len, Parsed* parsed); +URL_EXPORT void ParseFileURL(const char* url, int url_len, Parsed* parsed); +URL_EXPORT void ParseFileURL(const char16* url, int url_len, Parsed* parsed); // Filesystem URLs are structured differently than other URLs. -void ParseFileSystemURL(const char* url, - int url_len, - Parsed* parsed); -void ParseFileSystemURL(const char16* url, - int url_len, - Parsed* parsed); +URL_EXPORT void ParseFileSystemURL(const char* url, + int url_len, + Parsed* parsed); +URL_EXPORT void ParseFileSystemURL(const char16* url, + int url_len, + Parsed* parsed); // MailtoURL is for mailto: urls. They are made up scheme,path,query -void ParseMailtoURL(const char* url, int url_len, Parsed* parsed); -void ParseMailtoURL(const char16* url, int url_len, Parsed* parsed); +URL_EXPORT void ParseMailtoURL(const char* url, int url_len, Parsed* parsed); +URL_EXPORT void ParseMailtoURL(const char16* url, int url_len, Parsed* parsed); // Helper functions ----------------------------------------------------------- @@ -269,27 +273,31 @@ void ParseMailtoURL(const char16* url, int url_len, Parsed* parsed); // end of the string). // // The 8-bit version requires UTF-8 encoding. -bool ExtractScheme(const char* url, int url_len, Component* scheme); -bool ExtractScheme(const char16* url, int url_len, Component* scheme); +URL_EXPORT bool ExtractScheme(const char* url, + int url_len, + Component* scheme); +URL_EXPORT bool ExtractScheme(const char16* url, + int url_len, + Component* scheme); // Returns true if ch is a character that terminates the authority segment // of a URL. -bool IsAuthorityTerminator(char16 ch); +URL_EXPORT bool IsAuthorityTerminator(char16 ch); // Does a best effort parse of input |spec|, in range |auth|. If a particular // component is not found, it will be set to invalid. -void ParseAuthority(const char* spec, - const Component& auth, - Component* username, - Component* password, - Component* hostname, - Component* port_num); -void ParseAuthority(const char16* spec, - const Component& auth, - Component* username, - Component* password, - Component* hostname, - Component* port_num); +URL_EXPORT void ParseAuthority(const char* spec, + const Component& auth, + Component* username, + Component* password, + Component* hostname, + Component* port_num); +URL_EXPORT void ParseAuthority(const char16* spec, + const Component& auth, + Component* username, + Component* password, + Component* hostname, + Component* port_num); // Computes the integer port value from the given port component. The port // component should have been identified by one of the init functions on @@ -298,8 +306,8 @@ void ParseAuthority(const char16* spec, // The return value will be a positive integer between 0 and 64K, or one of // the two special values below. enum SpecialPort { PORT_UNSPECIFIED = -1, PORT_INVALID = -2 }; -int ParsePort(const char* url, const Component& port); -int ParsePort(const char16* url, const Component& port); +URL_EXPORT int ParsePort(const char* url, const Component& port); +URL_EXPORT int ParsePort(const char16* url, const Component& port); // Extracts the range of the file name in the given url. The path must // already have been computed by the parse function, and the matching URL @@ -311,12 +319,12 @@ int ParsePort(const char16* url, const Component& port); // following the last slash. // // The 8-bit version requires UTF-8 encoding. -void ExtractFileName(const char* url, - const Component& path, - Component* file_name); -void ExtractFileName(const char16* url, - const Component& path, - Component* file_name); +URL_EXPORT void ExtractFileName(const char* url, + const Component& path, + Component* file_name); +URL_EXPORT void ExtractFileName(const char16* url, + const Component& path, + Component* file_name); // Extract the first key/value from the range defined by |*query|. Updates // |*query| to start at the end of the extracted key/value pair. This is @@ -333,14 +341,14 @@ void ExtractFileName(const char16* url, // // If no key/value are found |*key| and |*value| will be unchanged and it will // return false. -bool ExtractQueryKeyValue(const char* url, - Component* query, - Component* key, - Component* value); -bool ExtractQueryKeyValue(const char16* url, - Component* query, - Component* key, - Component* value); +URL_EXPORT bool ExtractQueryKeyValue(const char* url, + Component* query, + Component* key, + Component* value); +URL_EXPORT bool ExtractQueryKeyValue(const char16* url, + Component* query, + Component* key, + Component* value); } // namespace url_parse diff --git a/url/url_util.h b/url/url_util.h index 419775c..a5f5176 100644 --- a/url/url_util.h +++ b/url/url_util.h @@ -9,6 +9,7 @@ #include "base/string16.h" #include "url/url_canon.h" +#include "url/url_export.h" #include "url/url_parse.h" namespace url_util { @@ -26,13 +27,13 @@ namespace url_util { // "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. -void Initialize(); +URL_EXPORT void Initialize(); // Cleanup is not required, except some strings may leak. For most user // applications, this is fine. If you're using it in a library that may get // loaded and unloaded, you'll want to unload to properly clean up your // library. -void Shutdown(); +URL_EXPORT void Shutdown(); // Schemes -------------------------------------------------------------------- @@ -40,7 +41,7 @@ void Shutdown(); // 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). -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. // @@ -54,7 +55,7 @@ void AddStandardScheme(const char* new_scheme); // We could have had AddStandardScheme use a lock instead, but that would add // some platform-specific dependencies we don't otherwise have now, and is // overkill considering the normal usage is so simple. -void LockStandardSchemes(); +URL_EXPORT void LockStandardSchemes(); // Locates the scheme in the given string and places it into |found_scheme|, // which may be NULL to indicate the caller does not care about the range. @@ -62,14 +63,14 @@ void LockStandardSchemes(); // Returns whether the given |compare| scheme matches the scheme found in the // input (if any). The |compare| scheme must be a valid canonical scheme or // the result of the comparison is undefined. -bool FindAndCompareScheme(const char* str, - int str_len, - const char* compare, - url_parse::Component* found_scheme); -bool FindAndCompareScheme(const char16* str, - int str_len, - const char* compare, - url_parse::Component* found_scheme); +URL_EXPORT bool FindAndCompareScheme(const char* str, + int str_len, + const char* compare, + url_parse::Component* found_scheme); +URL_EXPORT bool FindAndCompareScheme(const char16* str, + int str_len, + const char* compare, + url_parse::Component* found_scheme); inline bool FindAndCompareScheme(const std::string& str, const char* compare, url_parse::Component* found_scheme) { @@ -85,10 +86,10 @@ inline bool FindAndCompareScheme(const string16& str, // Returns true if the given string represents a standard URL. This means that // either the scheme is in the list of known standard schemes. -bool IsStandard(const char* spec, - const url_parse::Component& scheme); -bool IsStandard(const char16* spec, - const url_parse::Component& scheme); +URL_EXPORT bool IsStandard(const char* spec, + const url_parse::Component& scheme); +URL_EXPORT bool IsStandard(const char16* spec, + const url_parse::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. @@ -109,16 +110,16 @@ inline bool IsStandard(const char* spec, int spec_len, // Returns true if a valid URL was produced, false if not. On failure, the // output and parsed structures will still be filled and will be consistent, // but they will not represent a loadable URL. -bool Canonicalize(const char* spec, - int spec_len, - url_canon::CharsetConverter* charset_converter, - url_canon::CanonOutput* output, - url_parse::Parsed* output_parsed); -bool Canonicalize(const char16* spec, - int spec_len, - url_canon::CharsetConverter* charset_converter, - url_canon::CanonOutput* output, - url_parse::Parsed* output_parsed); +URL_EXPORT bool Canonicalize(const char* spec, + int spec_len, + url_canon::CharsetConverter* charset_converter, + url_canon::CanonOutput* output, + url_parse::Parsed* output_parsed); +URL_EXPORT bool Canonicalize(const char16* spec, + int spec_len, + url_canon::CharsetConverter* charset_converter, + url_canon::CanonOutput* output, + url_parse::Parsed* output_parsed); // Resolves a potentially relative URL relative to the given parsed base URL. // The base MUST be valid. The resulting canonical URL and parsed information @@ -130,28 +131,28 @@ bool Canonicalize(const char16* spec, // // Returns true if the output is valid, false if the input could not produce // a valid URL. -bool ResolveRelative(const char* base_spec, - int base_spec_len, - const url_parse::Parsed& base_parsed, - const char* relative, - int relative_length, - url_canon::CharsetConverter* charset_converter, - url_canon::CanonOutput* output, - url_parse::Parsed* output_parsed); -bool ResolveRelative(const char* base_spec, - int base_spec_len, - const url_parse::Parsed& base_parsed, - const char16* relative, - int relative_length, - url_canon::CharsetConverter* charset_converter, - url_canon::CanonOutput* output, - url_parse::Parsed* output_parsed); +URL_EXPORT bool ResolveRelative(const char* base_spec, + int base_spec_len, + const url_parse::Parsed& base_parsed, + const char* relative, + int relative_length, + url_canon::CharsetConverter* charset_converter, + url_canon::CanonOutput* output, + url_parse::Parsed* output_parsed); +URL_EXPORT bool ResolveRelative(const char* base_spec, + int base_spec_len, + const url_parse::Parsed& base_parsed, + const char16* relative, + int relative_length, + url_canon::CharsetConverter* charset_converter, + url_canon::CanonOutput* output, + url_parse::Parsed* output_parsed); // Replaces components in the given VALID input url. The new canonical URL info // is written to output and out_parsed. // // Returns true if the resulting URL is valid. -bool ReplaceComponents( +URL_EXPORT bool ReplaceComponents( const char* spec, int spec_len, const url_parse::Parsed& parsed, @@ -159,7 +160,7 @@ bool ReplaceComponents( url_canon::CharsetConverter* charset_converter, url_canon::CanonOutput* output, url_parse::Parsed* out_parsed); -bool ReplaceComponents( +URL_EXPORT bool ReplaceComponents( const char* spec, int spec_len, const url_parse::Parsed& parsed, @@ -176,25 +177,25 @@ bool ReplaceComponents( // // The versions of this function that don't take a b_end assume that the b // string is NULL terminated. -bool LowerCaseEqualsASCII(const char* a_begin, - const char* a_end, - const char* b); -bool LowerCaseEqualsASCII(const char* a_begin, - const char* a_end, - const char* b_begin, - const char* b_end); -bool LowerCaseEqualsASCII(const char16* a_begin, - const char16* a_end, - const char* b); +URL_EXPORT bool LowerCaseEqualsASCII(const char* a_begin, + const char* a_end, + const char* b); +URL_EXPORT bool LowerCaseEqualsASCII(const char* a_begin, + const char* a_end, + const char* b_begin, + const char* b_end); +URL_EXPORT bool LowerCaseEqualsASCII(const char16* a_begin, + const char16* a_end, + const char* b); // Unescapes the given string using URL escaping rules. -void DecodeURLEscapeSequences(const char* input, int length, - url_canon::CanonOutputW* output); +URL_EXPORT void DecodeURLEscapeSequences(const char* input, int length, + url_canon::CanonOutputW* output); // Escapes the given string as defined by the JS method encodeURIComponent. See // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/encodeURIComponent -void EncodeURIComponent(const char* input, int length, - url_canon::CanonOutput* output); +URL_EXPORT void EncodeURIComponent(const char* input, int length, + url_canon::CanonOutput* output); } // namespace url_util |