Commit 2dcec1fb authored by thestig@chromium.org's avatar thestig@chromium.org

Make the copy of GURL in src/url buildable as a component build. (try 2)

BUG=229660
TBR=brettw

Review URL: https://chromiumcodereview.appspot.com/15805003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203025 0039d316-1c4b-4281-b951-d872f2087c98
parent 1ada5673
...@@ -11,9 +11,10 @@ ...@@ -11,9 +11,10 @@
#include "base/string16.h" #include "base/string16.h"
#include "url/url_canon.h" #include "url/url_canon.h"
#include "url/url_canon_stdstring.h" #include "url/url_canon_stdstring.h"
#include "url/url_export.h"
#include "url/url_parse.h" #include "url/url_parse.h"
class GURL { class URL_EXPORT GURL {
public: public:
typedef url_canon::StdStringReplacements<std::string> Replacements; typedef url_canon::StdStringReplacements<std::string> Replacements;
typedef url_canon::StdStringReplacements<string16> ReplacementsW; typedef url_canon::StdStringReplacements<string16> ReplacementsW;
...@@ -32,10 +33,8 @@ class GURL { ...@@ -32,10 +33,8 @@ class GURL {
// encode the query parameters. It is probably sufficient for the narrow // encode the query parameters. It is probably sufficient for the narrow
// version to assume the query parameter encoding should be the same as the // version to assume the query parameter encoding should be the same as the
// input encoding. // input encoding.
explicit GURL(const std::string& url_string explicit GURL(const std::string& url_string /*, output_param_encoding*/);
/*, output_param_encoding*/); explicit GURL(const string16& url_string /*, output_param_encoding*/);
explicit GURL(const string16& url_string
/*, output_param_encoding*/);
// Constructor for URLs that have already been parsed and canonicalized. This // Constructor for URLs that have already been parsed and canonicalized. This
// is used for conversions from KURL, for example. The caller must supply all // is used for conversions from KURL, for example. The caller must supply all
...@@ -361,6 +360,6 @@ class GURL { ...@@ -361,6 +360,6 @@ class GURL {
}; };
// Stream operator so GURL can be used in assertion statements. // 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_ #endif // URL_GURL_H_
...@@ -8,8 +8,11 @@ ...@@ -8,8 +8,11 @@
}, },
'targets': [ 'targets': [
{ {
'target_name': 'url', # Note, this target_name cannot be 'url', because that will generate
'type': 'static_library', # 'url.dll' for a Windows component build, and that will confuse Windows,
# which has a system DLL with the same name.
'target_name': 'url_lib',
'type': '<(component)',
'dependencies': [ 'dependencies': [
'../base/base.gyp:base', '../base/base.gyp:base',
'../third_party/icu/icu.gyp:icudata', '../third_party/icu/icu.gyp:icudata',
...@@ -52,7 +55,7 @@ ...@@ -52,7 +55,7 @@
], ],
}, },
'defines': [ 'defines': [
'FULL_FILESYSTEM_URL_SUPPORT=1', 'URL_IMPLEMENTATION',
], ],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations. # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [4267, ], 'msvs_disabled_warnings': [4267, ],
...@@ -65,7 +68,7 @@ ...@@ -65,7 +68,7 @@
'../base/base.gyp:run_all_unittests', '../base/base.gyp:run_all_unittests',
'../testing/gtest.gyp:gtest', '../testing/gtest.gyp:gtest',
'../third_party/icu/icu.gyp:icuuc', '../third_party/icu/icu.gyp:icuuc',
'url', 'url_lib',
], ],
'sources': [ 'sources': [
'gurl_unittest.cc', 'gurl_unittest.cc',
...@@ -74,9 +77,6 @@ ...@@ -74,9 +77,6 @@
'url_test_utils.h', 'url_test_utils.h',
'url_util_unittest.cc', 'url_util_unittest.cc',
], ],
'defines': [
'FULL_FILESYSTEM_URL_SUPPORT=1',
],
'conditions': [ 'conditions': [
['os_posix==1 and OS!="mac" and OS!="ios"', ['os_posix==1 and OS!="mac" and OS!="ios"',
{ {
......
This diff is collapsed.
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
// ICU integration functions. // ICU integration functions.
#include "url/url_canon.h" #include "url/url_canon.h"
#include "url/url_export.h"
typedef struct UConverter UConverter; typedef struct UConverter UConverter;
...@@ -15,7 +16,7 @@ namespace url_canon { ...@@ -15,7 +16,7 @@ namespace url_canon {
// An implementation of CharsetConverter that implementations can use to // An implementation of CharsetConverter that implementations can use to
// interface the canonicalizer with ICU's conversion routines. // interface the canonicalizer with ICU's conversion routines.
class ICUCharsetConverter : public CharsetConverter { class URL_EXPORT ICUCharsetConverter : public CharsetConverter {
public: public:
// Constructs a converter using an already-existing ICU character set // Constructs a converter using an already-existing ICU character set
// converter. This converter is NOT owned by this object; the lifetime must // converter. This converter is NOT owned by this object; the lifetime must
......
...@@ -83,7 +83,7 @@ void AppendStringOfType(const char16* source, int length, ...@@ -83,7 +83,7 @@ void AppendStringOfType(const char16* source, int length,
// Maps the hex numerical values 0x0 to 0xf to the corresponding ASCII digit // Maps the hex numerical values 0x0 to 0xf to the corresponding ASCII digit
// that will be used to represent it. // 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 // This lookup table allows fast conversion between ASCII hex letters and their
// corresponding numerical value. The 8-bit range is divided up into 8 // corresponding numerical value. The 8-bit range is divided up into 8
...@@ -150,8 +150,8 @@ extern const char16 kUnicodeReplacementCharacter; ...@@ -150,8 +150,8 @@ extern const char16 kUnicodeReplacementCharacter;
// (for a single-byte ASCII character, it will not be changed). // (for a single-byte ASCII character, it will not be changed).
// //
// Implementation is in url_canon_icu.cc. // Implementation is in url_canon_icu.cc.
bool ReadUTFChar(const char* str, int* begin, int length, URL_EXPORT bool ReadUTFChar(const char* str, int* begin, int length,
unsigned* code_point_out); unsigned* code_point_out);
// Generic To-UTF-8 converter. This will call the given append method for each // 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 // character that should be appended, with the given output method. Wrappers
...@@ -227,8 +227,8 @@ inline void AppendUTF8EscapedValue(unsigned char_value, CanonOutput* output) { ...@@ -227,8 +227,8 @@ inline void AppendUTF8EscapedValue(unsigned char_value, CanonOutput* output) {
// (for a single-16-bit-word character, it will not be changed). // (for a single-16-bit-word character, it will not be changed).
// //
// Implementation is in url_canon_icu.cc. // Implementation is in url_canon_icu.cc.
bool ReadUTFChar(const char16* str, int* begin, int length, URL_EXPORT bool ReadUTFChar(const char16* str, int* begin, int length,
unsigned* code_point); unsigned* code_point);
// Equivalent to U16_APPEND_UNSAFE in ICU but uses our output method. // Equivalent to U16_APPEND_UNSAFE in ICU but uses our output method.
inline void AppendUTF16Value(unsigned code_point, inline void AppendUTF16Value(unsigned code_point,
...@@ -346,10 +346,10 @@ void AppendInvalidNarrowString(const char16* spec, int begin, int end, ...@@ -346,10 +346,10 @@ void AppendInvalidNarrowString(const char16* spec, int begin, int end,
// replacing the invalid characters with the "invalid character". It will // replacing the invalid characters with the "invalid character". It will
// return false in the failure case, and the caller should not continue as // return false in the failure case, and the caller should not continue as
// normal. // normal.
bool ConvertUTF16ToUTF8(const char16* input, int input_len, URL_EXPORT bool ConvertUTF16ToUTF8(const char16* input, int input_len,
CanonOutput* output); CanonOutput* output);
bool ConvertUTF8ToUTF16(const char* input, int input_len, URL_EXPORT bool ConvertUTF8ToUTF16(const char* input, int input_len,
CanonOutputT<char16>* output); CanonOutputT<char16>* output);
// Converts from UTF-16 to 8-bit using the character set converter. If the // Converts from UTF-16 to 8-bit using the character set converter. If the
// converter is NULL, this will use UTF-8. // converter is NULL, this will use UTF-8.
...@@ -408,9 +408,10 @@ bool CanonicalizePartialPath(const char16* spec, ...@@ -408,9 +408,10 @@ bool CanonicalizePartialPath(const char16* spec,
#ifndef WIN32 #ifndef WIN32
// Implementations of Windows' int-to-string conversions // Implementations of Windows' int-to-string conversions
int _itoa_s(int value, char* buffer, size_t size_in_chars, int radix); URL_EXPORT int _itoa_s(int value, char* buffer, size_t size_in_chars,
int _itow_s(int value, char16* buffer, size_t size_in_chars, int radix);
int radix); URL_EXPORT int _itow_s(int value, char16* buffer, size_t size_in_chars,
int radix);
// Secure template overloads for these functions // Secure template overloads for these functions
template<size_t N> template<size_t N>
......
...@@ -7,17 +7,18 @@ ...@@ -7,17 +7,18 @@
#include "base/string16.h" #include "base/string16.h"
#include "url/url_canon.h" #include "url/url_canon.h"
#include "url/url_export.h"
#include "url/url_parse.h" #include "url/url_parse.h"
namespace url_canon { namespace url_canon {
// Writes the given IPv4 address to |output|. // Writes the given IPv4 address to |output|.
void AppendIPv4Address(const unsigned char address[4], URL_EXPORT void AppendIPv4Address(const unsigned char address[4],
CanonOutput* output); CanonOutput* output);
// Writes the given IPv6 address to |output|. // Writes the given IPv6 address to |output|.
void AppendIPv6Address(const unsigned char address[16], URL_EXPORT void AppendIPv6Address(const unsigned char address[16],
CanonOutput* output); CanonOutput* output);
// Searches the host name for the portions of the IPv4 address. On success, // 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. // each component will be placed into |components| and it will return true.
...@@ -37,12 +38,12 @@ void AppendIPv6Address(const unsigned char address[16], ...@@ -37,12 +38,12 @@ void AppendIPv6Address(const unsigned char address[16],
// Mozilla), so this code path never gets hit. Our host canonicalization will // Mozilla), so this code path never gets hit. Our host canonicalization will
// notice these spaces and escape them, which will make IP address finding // notice these spaces and escape them, which will make IP address finding
// fail. This seems like better behavior than stripping after a space. // fail. This seems like better behavior than stripping after a space.
bool FindIPv4Components(const char* spec, URL_EXPORT bool FindIPv4Components(const char* spec,
const url_parse::Component& host, const url_parse::Component& host,
url_parse::Component components[4]); url_parse::Component components[4]);
bool FindIPv4Components(const char16* spec, URL_EXPORT bool FindIPv4Components(const char16* spec,
const url_parse::Component& host, const url_parse::Component& host,
url_parse::Component components[4]); url_parse::Component components[4]);
// Converts an IPv4 address to a 32-bit number (network byte order). // Converts an IPv4 address to a 32-bit number (network byte order).
// //
...@@ -55,12 +56,12 @@ bool FindIPv4Components(const char16* spec, ...@@ -55,12 +56,12 @@ bool FindIPv4Components(const char16* spec,
// //
// On success, |num_ipv4_components| will be populated with the number of // On success, |num_ipv4_components| will be populated with the number of
// components in the IPv4 address. // components in the IPv4 address.
CanonHostInfo::Family IPv4AddressToNumber( URL_EXPORT CanonHostInfo::Family IPv4AddressToNumber(
const char* spec, const char* spec,
const url_parse::Component& host, const url_parse::Component& host,
unsigned char address[4], unsigned char address[4],
int* num_ipv4_components); int* num_ipv4_components);
CanonHostInfo::Family IPv4AddressToNumber( URL_EXPORT CanonHostInfo::Family IPv4AddressToNumber(
const char16* spec, const char16* spec,
const url_parse::Component& host, const url_parse::Component& host,
unsigned char address[4], unsigned char address[4],
...@@ -71,12 +72,12 @@ CanonHostInfo::Family IPv4AddressToNumber( ...@@ -71,12 +72,12 @@ CanonHostInfo::Family IPv4AddressToNumber(
// //
// NOTE that |host| is expected to be surrounded by square brackets. // NOTE that |host| is expected to be surrounded by square brackets.
// i.e. "[::1]" rather than "::1". // i.e. "[::1]" rather than "::1".
bool IPv6AddressToNumber(const char* spec, URL_EXPORT bool IPv6AddressToNumber(const char* spec,
const url_parse::Component& host, const url_parse::Component& host,
unsigned char address[16]); unsigned char address[16]);
bool IPv6AddressToNumber(const char16* spec, URL_EXPORT bool IPv6AddressToNumber(const char16* spec,
const url_parse::Component& host, const url_parse::Component& host,
unsigned char address[16]); unsigned char address[16]);
} // namespace url_canon } // namespace url_canon
......
// 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 // define(COMPONENT_BUILD)
#endif // URL_URL_EXPORT_H_
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/string16.h" #include "base/string16.h"
#include "url/url_export.h"
namespace url_parse { namespace url_parse {
...@@ -80,7 +81,7 @@ inline Component MakeRange(int begin, int end) { ...@@ -80,7 +81,7 @@ inline Component MakeRange(int begin, int end) {
// else // else
// url_parse::ParsePathURL(url, url_len, &parsed); // url_parse::ParsePathURL(url, url_len, &parsed);
// //
struct Parsed { struct URL_EXPORT Parsed {
// Identifies different components. // Identifies different components.
enum ComponentType { enum ComponentType {
SCHEME, SCHEME,
...@@ -134,8 +135,7 @@ struct Parsed { ...@@ -134,8 +135,7 @@ struct Parsed {
// *QUERY: 14 15 <- // *QUERY: 14 15 <-
// *REF: 20 20 // *REF: 20 20
// //
int CountCharactersBefore(ComponentType type, int CountCharactersBefore(ComponentType type, bool include_delimiter) const;
bool include_delimiter) const;
// Scheme without the colon: "http://foo"/ would have a scheme of "http". // 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 // The length will be -1 if no scheme is specified ("foo.com"), or 0 if there
...@@ -220,32 +220,36 @@ struct Parsed { ...@@ -220,32 +220,36 @@ struct Parsed {
// StandardURL is for when the scheme is known to be one that has an // 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 // authority (host) like "http". This function will not handle weird ones
// like "about:" and "javascript:", or do the right thing for "file:" URLs. // like "about:" and "javascript:", or do the right thing for "file:" URLs.
void ParseStandardURL(const char* url, int url_len, Parsed* parsed); URL_EXPORT void ParseStandardURL(const char* url,
void ParseStandardURL(const char16* url, int url_len, Parsed* parsed); 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) // 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 // 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 // everything after the scheme is considered as the path. This is used for
// things like "about:" and "javascript:" // things like "about:" and "javascript:"
void ParsePathURL(const char* url, int url_len, Parsed* parsed); URL_EXPORT 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 char16* url, int url_len, Parsed* parsed);
// FileURL is for file URLs. There are some special rules for interpreting // FileURL is for file URLs. There are some special rules for interpreting
// these. // these.
void ParseFileURL(const char* url, int url_len, Parsed* parsed); URL_EXPORT 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 char16* url, int url_len, Parsed* parsed);
// Filesystem URLs are structured differently than other URLs. // Filesystem URLs are structured differently than other URLs.
void ParseFileSystemURL(const char* url, URL_EXPORT void ParseFileSystemURL(const char* url,
int url_len, int url_len,
Parsed* parsed); Parsed* parsed);
void ParseFileSystemURL(const char16* url, URL_EXPORT void ParseFileSystemURL(const char16* url,
int url_len, int url_len,
Parsed* parsed); Parsed* parsed);
// MailtoURL is for mailto: urls. They are made up scheme,path,query // MailtoURL is for mailto: urls. They are made up scheme,path,query
void ParseMailtoURL(const char* url, int url_len, Parsed* parsed); URL_EXPORT 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 char16* url, int url_len, Parsed* parsed);
// Helper functions ----------------------------------------------------------- // Helper functions -----------------------------------------------------------
...@@ -269,27 +273,31 @@ void ParseMailtoURL(const char16* url, int url_len, Parsed* parsed); ...@@ -269,27 +273,31 @@ void ParseMailtoURL(const char16* url, int url_len, Parsed* parsed);
// end of the string). // end of the string).
// //
// The 8-bit version requires UTF-8 encoding. // The 8-bit version requires UTF-8 encoding.
bool ExtractScheme(const char* url, int url_len, Component* scheme); URL_EXPORT bool ExtractScheme(const char* url,
bool ExtractScheme(const char16* url, int url_len, Component* scheme); 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 // Returns true if ch is a character that terminates the authority segment
// of a URL. // 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 // Does a best effort parse of input |spec|, in range |auth|. If a particular
// component is not found, it will be set to invalid. // component is not found, it will be set to invalid.
void ParseAuthority(const char* spec, URL_EXPORT void ParseAuthority(const char* spec,
const Component& auth, const Component& auth,
Component* username, Component* username,
Component* password, Component* password,
Component* hostname, Component* hostname,
Component* port_num); Component* port_num);
void ParseAuthority(const char16* spec, URL_EXPORT void ParseAuthority(const char16* spec,
const Component& auth, const Component& auth,
Component* username, Component* username,
Component* password, Component* password,
Component* hostname, Component* hostname,
Component* port_num); Component* port_num);
// Computes the integer port value from the given port component. The port // Computes the integer port value from the given port component. The port
// component should have been identified by one of the init functions on // component should have been identified by one of the init functions on
...@@ -298,8 +306,8 @@ void ParseAuthority(const char16* spec, ...@@ -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 return value will be a positive integer between 0 and 64K, or one of
// the two special values below. // the two special values below.
enum SpecialPort { PORT_UNSPECIFIED = -1, PORT_INVALID = -2 }; enum SpecialPort { PORT_UNSPECIFIED = -1, PORT_INVALID = -2 };
int ParsePort(const char* url, const Component& port); URL_EXPORT int ParsePort(const char* url, const Component& port);
int ParsePort(const char16* 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 // 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 // already have been computed by the parse function, and the matching URL
...@@ -311,12 +319,12 @@ int ParsePort(const char16* url, const Component& port); ...@@ -311,12 +319,12 @@ int ParsePort(const char16* url, const Component& port);
// following the last slash. // following the last slash.
// //
// The 8-bit version requires UTF-8 encoding. // The 8-bit version requires UTF-8 encoding.
void ExtractFileName(const char* url, URL_EXPORT void ExtractFileName(const char* url,
const Component& path, const Component& path,
Component* file_name); Component* file_name);
void ExtractFileName(const char16* url, URL_EXPORT void ExtractFileName(const char16* url,
const Component& path, const Component& path,
Component* file_name); Component* file_name);
// Extract the first key/value from the range defined by |*query|. Updates // 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 // |*query| to start at the end of the extracted key/value pair. This is
...@@ -333,14 +341,14 @@ void ExtractFileName(const char16* url, ...@@ -333,14 +341,14 @@ void ExtractFileName(const char16* url,
// //
// If no key/value are found |*key| and |*value| will be unchanged and it will // If no key/value are found |*key| and |*value| will be unchanged and it will
// return false. // return false.
bool ExtractQueryKeyValue(const char* url, URL_EXPORT bool ExtractQueryKeyValue(const char* url,
Component* query, Component* query,
Component* key, Component* key,
Component* value); Component* value);
bool ExtractQueryKeyValue(const char16* url, URL_EXPORT bool ExtractQueryKeyValue(const char16* url,
Component* query, Component* query,
Component* key, Component* key,
Component* value); Component* value);
} // namespace url_parse } // namespace url_parse
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/string16.h" #include "base/string16.h"
#include "url/url_canon.h" #include "url/url_canon.h"
#include "url/url_export.h"
#include "url/url_parse.h" #include "url/url_parse.h"
namespace url_util { namespace url_util {
...@@ -26,13 +27,13 @@ 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", unless Shutdown() was called in the mean time. This will also be a
// "noop" if other calls to the library have forced an initialization // "noop" if other calls to the library have forced an initialization
// beforehand. // beforehand.
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
// applications, this is fine. If you're using it in a library that may get // 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 // loaded and unloaded, you'll want to unload to properly clean up your
// library. // library.
void Shutdown(); URL_EXPORT void Shutdown();
// Schemes -------------------------------------------------------------------- // Schemes --------------------------------------------------------------------
...@@ -40,7 +41,7 @@ void Shutdown(); ...@@ -40,7 +41,7 @@ void Shutdown();
// schemes. This function is not threadsafe and can not be called concurrently // 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 // with any other url_util function. It will assert if the list of standard
// schemes has been locked (see LockStandardSchemes). // 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. // Sets a flag to prevent future calls to AddStandardScheme from succeeding.
// //
...@@ -54,7 +55,7 @@ void AddStandardScheme(const char* new_scheme); ...@@ -54,7 +55,7 @@ void AddStandardScheme(const char* new_scheme);
// We could have had AddStandardScheme use a lock instead, but that would add // 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 // some platform-specific dependencies we don't otherwise have now, and is
// overkill considering the normal usage is so simple. // 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|, // 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. // which may be NULL to indicate the caller does not care about the range.
...@@ -62,14 +63,14 @@ void LockStandardSchemes(); ...@@ -62,14 +63,14 @@ void LockStandardSchemes();
// Returns whether the given |compare| scheme matches the scheme found in the // 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 // input (if any). The |compare| scheme must be a valid canonical scheme or
// the result of the comparison is undefined. // the result of the comparison is undefined.
bool FindAndCompareScheme(const char* str, URL_EXPORT bool FindAndCompareScheme(const char* str,
int str_len, int str_len,
const char* compare, const char* compare,
url_parse::Component* found_scheme); url_parse::Component* found_scheme);
bool FindAndCompareScheme(const char16* str, URL_EXPORT bool FindAndCompareScheme(const char16* str,
int str_len, int str_len,
const char* compare, const char* compare,
url_parse::Component* found_scheme); url_parse::Component* found_scheme);
inline bool FindAndCompareScheme(const std::string& str, inline bool FindAndCompareScheme(const std::string& str,
const char* compare, const char* compare,
url_parse::Component* found_scheme) { url_parse::Component* found_scheme) {
...@@ -85,10 +86,10 @@ inline bool FindAndCompareScheme(const string16& str, ...@@ -85,10 +86,10 @@ inline bool FindAndCompareScheme(const string16& str,
// Returns true if the given string represents a standard URL. This means that // Returns true if the given string represents a standard URL. This means that
// either the scheme is in the list of known standard schemes. // either the scheme is in the list of known standard schemes.
bool IsStandard(const char* spec, URL_EXPORT bool IsStandard(const char* spec,
const url_parse::Component& scheme); const url_parse::Component& scheme);
bool IsStandard(const char16* spec, URL_EXPORT bool IsStandard(const char16* spec,
const url_parse::Component& scheme); const url_parse::Component& scheme);
// TODO(brettw) remove this. This is a temporary compatibility hack to avoid // TODO(brettw) remove this. This is a temporary compatibility hack to avoid
// breaking the WebKit build when this version is synced via Chrome. // breaking the WebKit build when this version is synced via Chrome.
...@@ -109,16 +110,16 @@ inline bool IsStandard(const char* spec, int spec_len, ...@@ -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 // 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, // output and parsed structures will still be filled and will be consistent,
// but they will not represent a loadable URL. // but they will not represent a loadable URL.
bool Canonicalize(const char* spec, URL_EXPORT bool Canonicalize(const char* spec,
int spec_len, int spec_len,
url_canon::CharsetConverter* charset_converter, url_canon::CharsetConverter* charset_converter,
url_canon::CanonOutput* output, url_canon::CanonOutput* output,
url_parse::Parsed* output_parsed); url_parse::Parsed* output_parsed);
bool Canonicalize(const char16* spec, URL_EXPORT bool Canonicalize(const char16* spec,
int spec_len, int spec_len,
url_canon::CharsetConverter* charset_converter, url_canon::CharsetConverter* charset_converter,
url_canon::CanonOutput* output, url_canon::CanonOutput* output,
url_parse::Parsed* output_parsed); url_parse::Parsed* output_parsed);
// Resolves a potentially relative URL relative to the given parsed base URL. // Resolves a potentially relative URL relative to the given parsed base URL.
// The base MUST be valid. The resulting canonical URL and parsed information // The base MUST be valid. The resulting canonical URL and parsed information
...@@ -130,28 +131,28 @@ bool Canonicalize(const char16* spec, ...@@ -130,28 +131,28 @@ bool Canonicalize(const char16* spec,
// //
// Returns true if the output is valid, false if the input could not produce // Returns true if the output is valid, false if the input could not produce
// a valid URL. // a valid URL.
bool ResolveRelative(const char* base_spec, URL_EXPORT bool ResolveRelative(const char* base_spec,
int base_spec_len, int base_spec_len,
const url_parse::Parsed& base_parsed, const url_parse::Parsed& base_parsed,
const char* relative, const char* relative,
int relative_length, int relative_length,
url_canon::CharsetConverter* charset_converter, url_canon::CharsetConverter* charset_converter,
url_canon::CanonOutput* output, url_canon::CanonOutput* output,
url_parse::Parsed* output_parsed); url_parse::Parsed* output_parsed);
bool ResolveRelative(const char* base_spec, URL_EXPORT bool ResolveRelative(const char* base_spec,
int base_spec_len, int base_spec_len,
const url_parse::Parsed& base_parsed, const url_parse::Parsed& base_parsed,
const char16* relative, const char16* relative,
int relative_length, int relative_length,
url_canon::CharsetConverter* charset_converter, url_canon::CharsetConverter* charset_converter,
url_canon::CanonOutput* output, url_canon::CanonOutput* output,
url_parse::Parsed* output_parsed); url_parse::Parsed* output_parsed);
// Replaces components in the given VALID input url. The new canonical URL info // Replaces components in the given VALID input url. The new canonical URL info
// is written to output and out_parsed. // is written to output and out_parsed.
// //
// Returns true if the resulting URL is valid. // Returns true if the resulting URL is valid.
bool ReplaceComponents( URL_EXPORT bool ReplaceComponents(
const char* spec, const char* spec,
int spec_len, int spec_len,
const url_parse::Parsed& parsed, const url_parse::Parsed& parsed,
...@@ -159,7 +160,7 @@ bool ReplaceComponents( ...@@ -159,7 +160,7 @@ bool ReplaceComponents(
url_canon::CharsetConverter* charset_converter, url_canon::CharsetConverter* charset_converter,
url_canon::CanonOutput* output, url_canon::CanonOutput* output,
url_parse::Parsed* out_parsed); url_parse::Parsed* out_parsed);
bool ReplaceComponents( URL_EXPORT bool ReplaceComponents(
const char* spec, const char* spec,
int spec_len, int spec_len,
const url_parse::Parsed& parsed, const url_parse::Parsed& parsed,
...@@ -176,25 +177,25 @@ bool ReplaceComponents( ...@@ -176,25 +177,25 @@ bool ReplaceComponents(
// //
// The versions of this function that don't take a b_end assume that the b // The versions of this function that don't take a b_end assume that the b
// string is NULL terminated. // string is NULL terminated.
bool LowerCaseEqualsASCII(const char* a_begin, URL_EXPORT bool LowerCaseEqualsASCII(const char* a_begin,
const char* a_end, const char* a_end,
const char* b); const char* b);
bool LowerCaseEqualsASCII(const char* a_begin, URL_EXPORT bool LowerCaseEqualsASCII(const char* a_begin,
const char* a_end, const char* a_end,
const char* b_begin, const char* b_begin,
const char* b_end); const char* b_end);
bool LowerCaseEqualsASCII(const char16* a_begin, URL_EXPORT bool LowerCaseEqualsASCII(const char16* a_begin,
const char16* a_end, const char16* a_end,
const char* b); const char* b);
// Unescapes the given string using URL escaping rules. // Unescapes the given string using URL escaping rules.
void DecodeURLEscapeSequences(const char* input, int length, URL_EXPORT void DecodeURLEscapeSequences(const char* input, int length,
url_canon::CanonOutputW* output); url_canon::CanonOutputW* output);
// Escapes the given string as defined by the JS method encodeURIComponent. See // Escapes the given string as defined by the JS method encodeURIComponent. See
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/encodeURIComponent // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/encodeURIComponent
void EncodeURIComponent(const char* input, int length, URL_EXPORT void EncodeURIComponent(const char* input, int length,
url_canon::CanonOutput* output); url_canon::CanonOutput* output);
} // namespace url_util } // namespace url_util
......
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