diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-29 19:58:57 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-29 19:58:57 +0000 |
commit | 42cba2fb14b47a0c9463763b7c8c83f36d2fcef5 (patch) | |
tree | ef873bab10a838d28cc81c0e927f156ee6b55b5e /net | |
parent | b82d265634ced5b6457dac631868e7270963fa7e (diff) | |
download | chromium_src-42cba2fb14b47a0c9463763b7c8c83f36d2fcef5.zip chromium_src-42cba2fb14b47a0c9463763b7c8c83f36d2fcef5.tar.gz chromium_src-42cba2fb14b47a0c9463763b7c8c83f36d2fcef5.tar.bz2 |
Convert net to use base::string16 instead of string16.
This is just a search-and-replace.
BUG=
Review URL: https://codereview.chromium.org/13329004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191432 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
98 files changed, 552 insertions, 518 deletions
diff --git a/net/base/auth.cc b/net/base/auth.cc index cef2e25..332e188 100644 --- a/net/base/auth.cc +++ b/net/base/auth.cc @@ -29,8 +29,8 @@ AuthData::~AuthData() { AuthCredentials::AuthCredentials() { } -AuthCredentials::AuthCredentials(const string16& username, - const string16& password) +AuthCredentials::AuthCredentials(const base::string16& username, + const base::string16& password) : username_(username), password_(password) { } @@ -38,7 +38,8 @@ AuthCredentials::AuthCredentials(const string16& username, AuthCredentials::~AuthCredentials() { } -void AuthCredentials::Set(const string16& username, const string16& password) { +void AuthCredentials::Set(const base::string16& username, + const base::string16& password) { username_ = username; password_ = password; } diff --git a/net/base/auth.h b/net/base/auth.h index 46ea8d0..2656ce6 100644 --- a/net/base/auth.h +++ b/net/base/auth.h @@ -46,11 +46,12 @@ class NET_EXPORT AuthChallengeInfo : class NET_EXPORT AuthCredentials { public: AuthCredentials(); - AuthCredentials(const string16& username, const string16& password); + AuthCredentials(const base::string16& username, + const base::string16& password); ~AuthCredentials(); // Set the |username| and |password|. - void Set(const string16& username, const string16& password); + void Set(const base::string16& username, const base::string16& password); // Determines if |this| is equivalent to |other|. bool Equals(const AuthCredentials& other) const; @@ -62,19 +63,19 @@ class NET_EXPORT AuthCredentials { // it's paged out to disk. void Zap(); - const string16& username() const { return username_; } - const string16& password() const { return password_; } + const base::string16& username() const { return username_; } + const base::string16& password() const { return password_; } private: // The username to provide, possibly empty. This should be ASCII only to // minimize compatibility problems, but arbitrary UTF-16 strings are allowed // and will be attempted. - string16 username_; + base::string16 username_; // The password to provide, possibly empty. This should be ASCII only to // minimize compatibility problems, but arbitrary UTF-16 strings are allowed // and will be attempted. - string16 password_; + base::string16 password_; // Intentionally allowing the implicit copy constructor and assignment // operators. diff --git a/net/base/escape.cc b/net/base/escape.cc index 7c80edc..d4371f8 100644 --- a/net/base/escape.cc +++ b/net/base/escape.cc @@ -275,7 +275,7 @@ std::string EscapeForHTML(const std::string& input) { return EscapeForHTMLImpl(input); } -string16 EscapeForHTML(const string16& input) { +base::string16 EscapeForHTML(const base::string16& input) { return EscapeForHTMLImpl(input); } @@ -284,29 +284,30 @@ std::string UnescapeURLComponent(const std::string& escaped_text, return UnescapeURLWithOffsetsImpl(escaped_text, rules, NULL); } -string16 UnescapeURLComponent(const string16& escaped_text, - UnescapeRule::Type rules) { +base::string16 UnescapeURLComponent(const base::string16& escaped_text, + UnescapeRule::Type rules) { return UnescapeURLWithOffsetsImpl(escaped_text, rules, NULL); } -string16 UnescapeAndDecodeUTF8URLComponent(const std::string& text, - UnescapeRule::Type rules, - size_t* offset_for_adjustment) { +base::string16 UnescapeAndDecodeUTF8URLComponent( + const std::string& text, + UnescapeRule::Type rules, + size_t* offset_for_adjustment) { std::vector<size_t> offsets; if (offset_for_adjustment) offsets.push_back(*offset_for_adjustment); - string16 result = + base::string16 result = UnescapeAndDecodeUTF8URLComponentWithOffsets(text, rules, &offsets); if (offset_for_adjustment) *offset_for_adjustment = offsets[0]; return result; } -string16 UnescapeAndDecodeUTF8URLComponentWithOffsets( +base::string16 UnescapeAndDecodeUTF8URLComponentWithOffsets( const std::string& text, UnescapeRule::Type rules, std::vector<size_t>* offsets_for_adjustment) { - string16 result; + base::string16 result; std::vector<size_t> original_offsets; if (offsets_for_adjustment) original_offsets = *offsets_for_adjustment; @@ -324,7 +325,7 @@ string16 UnescapeAndDecodeUTF8URLComponentWithOffsets( return base::UTF8ToUTF16AndAdjustOffsets(text, offsets_for_adjustment); } -string16 UnescapeForHTML(const string16& input) { +base::string16 UnescapeForHTML(const base::string16& input) { static const struct { const char* ampersand_code; const char replacement; @@ -339,9 +340,10 @@ string16 UnescapeForHTML(const string16& input) { if (input.find(ASCIIToUTF16("&")) == std::string::npos) return input; - string16 ampersand_chars[ARRAYSIZE_UNSAFE(kEscapeToChars)]; - string16 text(input); - for (string16::iterator iter = text.begin(); iter != text.end(); ++iter) { + base::string16 ampersand_chars[ARRAYSIZE_UNSAFE(kEscapeToChars)]; + base::string16 text(input); + for (base::string16::iterator iter = text.begin(); + iter != text.end(); ++iter) { if (*iter == '&') { // Potential ampersand encode char. size_t index = iter - text.begin(); @@ -366,7 +368,7 @@ AdjustEncodingOffset::AdjustEncodingOffset(const Adjustments& adjustments) void AdjustEncodingOffset::operator()(size_t& offset) { // For each encoded character occurring before an offset subtract 2. - if (offset == string16::npos) + if (offset == base::string16::npos) return; size_t adjusted_offset = offset; for (Adjustments::const_iterator i = adjustments.begin(); @@ -377,7 +379,7 @@ void AdjustEncodingOffset::operator()(size_t& offset) { return; } if (offset <= (location + 2)) { - offset = string16::npos; + offset = base::string16::npos; return; } adjusted_offset -= 2; diff --git a/net/base/escape.h b/net/base/escape.h index 8771212..a889cb6 100644 --- a/net/base/escape.h +++ b/net/base/escape.h @@ -25,7 +25,7 @@ NET_EXPORT std::string EscapeQueryParamValue(const std::string& text, // Escapes a partial or complete file/pathname. This includes: // non-printable, non-7bit, and (including space) "#%:<>?[\]^`{|} -// For the string16 version, we attempt a conversion to |codepage| before +// For the base::string16 version, we attempt a conversion to |codepage| before // encoding the string. If this conversion fails, we return false. NET_EXPORT std::string EscapePath(const std::string& path); @@ -51,7 +51,7 @@ NET_EXPORT void AppendEscapedCharForHTML(char c, std::string* output); // Escapes chars that might cause this text to be interpretted as HTML tags. NET_EXPORT std::string EscapeForHTML(const std::string& text); -NET_EXPORT string16 EscapeForHTML(const string16& text); +NET_EXPORT base::string16 EscapeForHTML(const base::string16& text); // Unescaping ------------------------------------------------------------------ @@ -107,30 +107,31 @@ class UnescapeRule { // conversions need to take place, it only unescapes. NET_EXPORT std::string UnescapeURLComponent(const std::string& escaped_text, UnescapeRule::Type rules); -NET_EXPORT string16 UnescapeURLComponent(const string16& escaped_text, - UnescapeRule::Type rules); +NET_EXPORT base::string16 UnescapeURLComponent( + const base::string16& escaped_text, + UnescapeRule::Type rules); // Unescapes the given substring as a URL, and then tries to interpret the // result as being encoded as UTF-8. If the result is convertable into UTF-8, it // will be returned as converted. If it is not, the original escaped string will -// be converted into a string16 and returned. (|offset[s]_for_adjustment|) +// be converted into a base::string16 and returned. (|offset[s]_for_adjustment|) // specifies one or more offsets into the source strings; each offset will be // adjusted to point at the same logical place in the result strings during // decoding. If this isn't possible because an offset points past the end of // the source strings or into the middle of a multibyte sequence, the offending // offset will be set to string16::npos. |offset[s]_for_adjustment| may be NULL. -NET_EXPORT string16 UnescapeAndDecodeUTF8URLComponent( +NET_EXPORT base::string16 UnescapeAndDecodeUTF8URLComponent( const std::string& text, UnescapeRule::Type rules, size_t* offset_for_adjustment); -NET_EXPORT string16 UnescapeAndDecodeUTF8URLComponentWithOffsets( +NET_EXPORT base::string16 UnescapeAndDecodeUTF8URLComponentWithOffsets( const std::string& text, UnescapeRule::Type rules, std::vector<size_t>* offsets_for_adjustment); // Unescapes the following ampersand character codes from |text|: // < > & " ' -NET_EXPORT string16 UnescapeForHTML(const string16& text); +NET_EXPORT base::string16 UnescapeForHTML(const base::string16& text); namespace internal { diff --git a/net/base/escape_unittest.cc b/net/base/escape_unittest.cc index b34b38c..f654b2d 100644 --- a/net/base/escape_unittest.cc +++ b/net/base/escape_unittest.cc @@ -17,7 +17,7 @@ namespace net { namespace { -const size_t kNpos = string16::npos; +const size_t kNpos = base::string16::npos; struct EscapeCase { const char* input; @@ -250,19 +250,19 @@ TEST(EscapeTest, UnescapeURLComponent) { }; for (size_t i = 0; i < arraysize(unescape_cases); i++) { - string16 str(WideToUTF16(unescape_cases[i].input)); + base::string16 str(WideToUTF16(unescape_cases[i].input)); EXPECT_EQ(WideToUTF16(unescape_cases[i].output), UnescapeURLComponent(str, unescape_cases[i].rules)); } // Test the NULL character unescaping (which wouldn't work above since those // are just char pointers). - string16 input(WideToUTF16(L"Null")); + base::string16 input(WideToUTF16(L"Null")); input.push_back(0); // Also have a NULL in the input. input.append(WideToUTF16(L"%00%39Test")); // When we're unescaping NULLs - string16 expected(WideToUTF16(L"Null")); + base::string16 expected(WideToUTF16(L"Null")); expected.push_back(0); expected.push_back(0); expected.append(ASCIIToUTF16("9Test")); @@ -329,7 +329,7 @@ TEST(EscapeTest, UnescapeAndDecodeUTF8URLComponent) { EXPECT_EQ(std::string(unescape_cases[i].query_unescaped), unescaped); // TODO: Need to test unescape_spaces and unescape_percent. - string16 decoded = UnescapeAndDecodeUTF8URLComponent( + base::string16 decoded = UnescapeAndDecodeUTF8URLComponent( unescape_cases[i].input, UnescapeRule::NORMAL, NULL); EXPECT_EQ(WideToUTF16(unescape_cases[i].decoded), decoded); } @@ -385,7 +385,7 @@ TEST(EscapeTest, UnescapeForHTML) { { "& &", "& &" }, }; for (size_t i = 0; i < arraysize(tests); ++i) { - string16 result = UnescapeForHTML(ASCIIToUTF16(tests[i].input)); + base::string16 result = UnescapeForHTML(ASCIIToUTF16(tests[i].input)); EXPECT_EQ(ASCIIToUTF16(tests[i].expected_output), result); } } diff --git a/net/base/load_states.h b/net/base/load_states.h index 762cbba..b444794e 100644 --- a/net/base/load_states.h +++ b/net/base/load_states.h @@ -24,9 +24,9 @@ enum LoadState { // This class provides an easy way to hold a load state with an extra parameter. struct LoadStateWithParam { LoadState state; - string16 param; + base::string16 param; LoadStateWithParam() : state(LOAD_STATE_IDLE) {} - LoadStateWithParam(LoadState state, const string16& param) + LoadStateWithParam(LoadState state, const base::string16& param) : state(state), param(param) {} }; diff --git a/net/base/net_log.cc b/net/base/net_log.cc index d6b6f39..12cfd81 100644 --- a/net/base/net_log.cc +++ b/net/base/net_log.cc @@ -64,7 +64,7 @@ Value* NetLogStringCallback(const char* name, } Value* NetLogString16Callback(const char* name, - const string16* value, + const base::string16* value, NetLog::LogLevel /* log_level */) { DictionaryValue* event_params = new DictionaryValue(); event_params->SetString(name, *value); @@ -296,7 +296,7 @@ NetLog::ParametersCallback NetLog::StringCallback(const char* name, // static NetLog::ParametersCallback NetLog::StringCallback(const char* name, - const string16* value) { + const base::string16* value) { DCHECK(value); return base::Bind(&NetLogString16Callback, name, value); } diff --git a/net/base/net_log.h b/net/base/net_log.h index dc0b1ec..0dd97ee 100644 --- a/net/base/net_log.h +++ b/net/base/net_log.h @@ -282,7 +282,7 @@ class NET_EXPORT NetLog { // Same as above, but takes in a UTF16 string. static ParametersCallback StringCallback(const char* name, - const string16* value); + const base::string16* value); protected: // Child classes should respond to the new entry here. This includes diff --git a/net/base/net_util.cc b/net/base/net_util.cc index b7998c8..066812c 100644 --- a/net/base/net_util.cc +++ b/net/base/net_util.cc @@ -412,7 +412,7 @@ bool IsIDNComponentSafe(const char16* str, bool IDNToUnicodeOneComponent(const char16* comp, size_t comp_len, const std::string& languages, - string16* out) { + base::string16* out) { DCHECK(out); if (comp_len == 0) return false; @@ -454,12 +454,12 @@ bool IDNToUnicodeOneComponent(const char16* comp, } // Clamps the offsets in |offsets_for_adjustment| to the length of |str|. -void LimitOffsets(const string16& str, +void LimitOffsets(const base::string16& str, std::vector<size_t>* offsets_for_adjustment) { if (offsets_for_adjustment) { std::for_each(offsets_for_adjustment->begin(), offsets_for_adjustment->end(), - base::LimitOffset<string16>(str.length())); + base::LimitOffset<base::string16>(str.length())); } } @@ -470,17 +470,18 @@ void LimitOffsets(const string16& str, // // We may want to skip this step in the case of file URLs to allow unicode // UNC hostnames regardless of encodings. -string16 IDNToUnicodeWithOffsets(const std::string& host, - const std::string& languages, - std::vector<size_t>* offsets_for_adjustment) { - // Convert the ASCII input to a string16 for ICU. - string16 input16; +base::string16 IDNToUnicodeWithOffsets( + const std::string& host, + const std::string& languages, + std::vector<size_t>* offsets_for_adjustment) { + // Convert the ASCII input to a base::string16 for ICU. + base::string16 input16; input16.reserve(host.length()); input16.insert(input16.end(), host.begin(), host.end()); // Do each component of the host separately, since we enforce script matching // on a per-component basis. - string16 out16; + base::string16 out16; { base::OffsetAdjuster offset_adjuster(offsets_for_adjustment); for (size_t component_start = 0, component_end; @@ -488,7 +489,7 @@ string16 IDNToUnicodeWithOffsets(const std::string& host, component_start = component_end + 1) { // Find the end of the component. component_end = input16.find('.', component_start); - if (component_end == string16::npos) + if (component_end == base::string16::npos) component_end = input16.length(); // For getting the last component. size_t component_length = component_end - component_start; size_t new_component_start = out16.length(); @@ -550,7 +551,7 @@ void AdjustForComponentTransform( DCHECK_NE(std::string::npos, original_component_begin); DCHECK_NE(std::string::npos, original_component_end); - DCHECK_NE(string16::npos, output_component_begin); + DCHECK_NE(base::string16::npos, output_component_begin); size_t offsets_size = offsets_for_adjustment->size(); DCHECK_EQ(offsets_size, original_offsets.size()); DCHECK_EQ(offsets_size, transformed_offsets.size()); @@ -559,8 +560,9 @@ void AdjustForComponentTransform( if ((original_offset >= original_component_begin) && (original_offset < original_component_end)) { size_t transformed_offset = transformed_offsets[i]; - (*offsets_for_adjustment)[i] = (transformed_offset == string16::npos) ? - string16::npos : (output_component_begin + transformed_offset); + (*offsets_for_adjustment)[i] = + (transformed_offset == base::string16::npos) ? + base::string16::npos : (output_component_begin + transformed_offset); } } } @@ -586,14 +588,15 @@ void AdjustComponents(int delta, url_parse::Parsed* parsed) { } // Helper for FormatUrlWithOffsets(). -string16 FormatViewSourceUrl(const GURL& url, - const std::vector<size_t>& original_offsets, - const std::string& languages, - FormatUrlTypes format_types, - UnescapeRule::Type unescape_rules, - url_parse::Parsed* new_parsed, - size_t* prefix_end, - std::vector<size_t>* offsets_for_adjustment) { +base::string16 FormatViewSourceUrl( + const GURL& url, + const std::vector<size_t>& original_offsets, + const std::string& languages, + FormatUrlTypes format_types, + UnescapeRule::Type unescape_rules, + url_parse::Parsed* new_parsed, + size_t* prefix_end, + std::vector<size_t>* offsets_for_adjustment) { DCHECK(new_parsed); const char kViewSource[] = "view-source:"; const size_t kViewSourceLength = arraysize(kViewSource) - 1; @@ -601,7 +604,7 @@ string16 FormatViewSourceUrl(const GURL& url, OffsetsIntoComponent(original_offsets, kViewSourceLength)); GURL real_url(url.possibly_invalid_spec().substr(kViewSourceLength)); - string16 result(ASCIIToUTF16(kViewSource) + + base::string16 result(ASCIIToUTF16(kViewSource) + FormatUrlWithOffsets(real_url, languages, format_types, unescape_rules, new_parsed, prefix_end, &offsets_into_url)); @@ -628,7 +631,7 @@ class AppendComponentTransform { AppendComponentTransform() {} virtual ~AppendComponentTransform() {} - virtual string16 Execute( + virtual base::string16 Execute( const std::string& component_text, std::vector<size_t>* offsets_into_component) const = 0; @@ -644,7 +647,7 @@ class HostComponentTransform : public AppendComponentTransform { } private: - virtual string16 Execute( + virtual base::string16 Execute( const std::string& component_text, std::vector<size_t>* offsets_into_component) const OVERRIDE { return IDNToUnicodeWithOffsets(component_text, languages_, @@ -661,7 +664,7 @@ class NonHostComponentTransform : public AppendComponentTransform { } private: - virtual string16 Execute( + virtual base::string16 Execute( const std::string& component_text, std::vector<size_t>* offsets_into_component) const OVERRIDE { return (unescape_rules_ == UnescapeRule::NONE) ? @@ -678,7 +681,7 @@ void AppendFormattedComponent(const std::string& spec, const url_parse::Component& original_component, const std::vector<size_t>& original_offsets, const AppendComponentTransform& transform, - string16* output, + base::string16* output, url_parse::Component* output_component, std::vector<size_t>* offsets_for_adjustment) { DCHECK(output); @@ -751,7 +754,7 @@ std::string GetFileNameFromURL(const GURL& url, if (!IsStringUTF8(decoded_filename)) { // TODO(jshin): this is probably not robust enough. To be sure, we need // encoding detection. - string16 utf16_output; + base::string16 utf16_output; if (!referrer_charset.empty() && base::CodepageToUTF16(unescaped_url_filename, referrer_charset.c_str(), @@ -773,8 +776,8 @@ std::string GetFileNameFromURL(const GURL& url, #if defined(OS_WIN) // Returns whether the specified extension is automatically integrated into the // windows shell. -bool IsShellIntegratedExtension(const string16& extension) { - string16 extension_lower = StringToLowerASCII(extension); +bool IsShellIntegratedExtension(const base::string16& extension) { + base::string16 extension_lower = StringToLowerASCII(extension); static const wchar_t* const integrated_extensions[] = { // See <http://msdn.microsoft.com/en-us/library/ms811694.aspx>. @@ -801,7 +804,7 @@ bool IsShellIntegratedExtension(const string16& extension) { // Returns whether the specified file name is a reserved name on windows. // This includes names like "com2.zip" (which correspond to devices) and // desktop.ini and thumbs.db which have special meaning to the windows shell. -bool IsReservedName(const string16& filename) { +bool IsReservedName(const base::string16& filename) { // This list is taken from the MSDN article "Naming a file" // http://msdn2.microsoft.com/en-us/library/aa365247(VS.85).aspx // I also added clock$ because GetSaveFileName seems to consider it as a @@ -811,14 +814,14 @@ bool IsReservedName(const string16& filename) { L"com6", L"com7", L"com8", L"com9", L"lpt1", L"lpt2", L"lpt3", L"lpt4", L"lpt5", L"lpt6", L"lpt7", L"lpt8", L"lpt9", L"clock$" }; - string16 filename_lower = StringToLowerASCII(filename); + base::string16 filename_lower = StringToLowerASCII(filename); for (int i = 0; i < arraysize(known_devices); ++i) { // Exact match. if (filename_lower == known_devices[i]) return true; // Starts with "DEVICE.". - if (filename_lower.find(string16(known_devices[i]) + L".") == 0) + if (filename_lower.find(base::string16(known_devices[i]) + L".") == 0) return true; } @@ -975,8 +978,8 @@ std::string GetSpecificHeader(const std::string& headers, return ret; } -string16 IDNToUnicode(const std::string& host, - const std::string& languages) { +base::string16 IDNToUnicode(const std::string& host, + const std::string& languages) { return IDNToUnicodeWithOffsets(host, languages, NULL); } @@ -1003,7 +1006,7 @@ std::string CanonicalizeHost(const std::string& host, return canon_host; } -std::string GetDirectoryListingHeader(const string16& title) { +std::string GetDirectoryListingHeader(const base::string16& title) { static const base::StringPiece header( NetModule::GetResource(IDR_DIR_HEADER_HTML)); // This can be null in unit tests. @@ -1067,7 +1070,7 @@ bool IsCanonicalizedHostCompliant(const std::string& host, (!desired_tld.empty() && IsHostCharAlpha(desired_tld[0])); } -std::string GetDirectoryListingEntry(const string16& name, +std::string GetDirectoryListingEntry(const base::string16& name, const std::string& raw_bytes, bool is_dir, int64 size, @@ -1089,14 +1092,14 @@ std::string GetDirectoryListingEntry(const string16& name, } // Negative size means unknown or not applicable (e.g. directory). - string16 size_string; + base::string16 size_string; if (size >= 0) size_string = FormatBytesUnlocalized(size); base::JsonDoubleQuote(size_string, true, &result); result.append(","); - string16 modified_str; + base::string16 modified_str; // |modified| can be NULL in FTP listings. if (!modified.is_null()) { modified_str = base::TimeFormatShortDateAndTime(modified); @@ -1108,12 +1111,12 @@ std::string GetDirectoryListingEntry(const string16& name, return result; } -string16 StripWWW(const string16& text) { - const string16 www(ASCIIToUTF16("www.")); +base::string16 StripWWW(const base::string16& text) { + const base::string16 www(ASCIIToUTF16("www.")); return StartsWith(text, www, true) ? text.substr(www.length()) : text; } -string16 StripWWWFromHost(const GURL& url) { +base::string16 StripWWWFromHost(const GURL& url) { DCHECK(url.is_valid()); return StripWWW(ASCIIToUTF16(url.host())); } @@ -1140,12 +1143,12 @@ void GenerateSafeFileName(const std::string& mime_type, #endif } -string16 GetSuggestedFilename(const GURL& url, - const std::string& content_disposition, - const std::string& referrer_charset, - const std::string& suggested_name, - const std::string& mime_type, - const std::string& default_name) { +base::string16 GetSuggestedFilename(const GURL& url, + const std::string& content_disposition, + const std::string& referrer_charset, + const std::string& suggested_name, + const std::string& mime_type, + const std::string& default_name) { // TODO: this function to be updated to match the httpbis recommendations. // Talk to abarth for the latest news. @@ -1197,12 +1200,12 @@ string16 GetSuggestedFilename(const GURL& url, } #if defined(OS_WIN) - string16 path = UTF8ToUTF16(filename.empty() ? default_name : filename); + base::string16 path = UTF8ToUTF16(filename.empty() ? default_name : filename); // On Windows we want to preserve or replace all characters including // whitespace to prevent file extension obfuscation on trusted websites // e.g. Gmail might think evil.exe. is safe, so we don't want it to become // evil.exe when we download it - string16::size_type path_length_before_trim = path.length(); + base::string16::size_type path_length_before_trim = path.length(); TrimWhitespace(path, TRIM_TRAILING, &path); trimmed_trailing_character_count += path_length_before_trim - path.length(); file_util::ReplaceIllegalCharactersInPath(&path, '-'); @@ -1225,12 +1228,12 @@ base::FilePath GenerateFileName(const GURL& url, const std::string& suggested_name, const std::string& mime_type, const std::string& default_file_name) { - string16 file_name = GetSuggestedFilename(url, - content_disposition, - referrer_charset, - suggested_name, - mime_type, - default_file_name); + base::string16 file_name = GetSuggestedFilename(url, + content_disposition, + referrer_charset, + suggested_name, + mime_type, + default_file_name); #if defined(OS_WIN) base::FilePath generated_name(file_name); @@ -1473,8 +1476,8 @@ std::string GetHostName() { } void GetIdentityFromURL(const GURL& url, - string16* username, - string16* password) { + base::string16* username, + base::string16* password) { UnescapeRule::Type flags = UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS; *username = UnescapeAndDecodeUTF8URLComponent(url.username(), flags, NULL); @@ -1487,20 +1490,21 @@ std::string GetHostOrSpecFromURL(const GURL& url) { void AppendFormattedHost(const GURL& url, const std::string& languages, - string16* output) { + base::string16* output) { std::vector<size_t> offsets; AppendFormattedComponent(url.possibly_invalid_spec(), url.parsed_for_possibly_invalid_spec().host, offsets, HostComponentTransform(languages), output, NULL, NULL); } -string16 FormatUrlWithOffsets(const GURL& url, - const std::string& languages, - FormatUrlTypes format_types, - UnescapeRule::Type unescape_rules, - url_parse::Parsed* new_parsed, - size_t* prefix_end, - std::vector<size_t>* offsets_for_adjustment) { +base::string16 FormatUrlWithOffsets( + const GURL& url, + const std::string& languages, + FormatUrlTypes format_types, + UnescapeRule::Type unescape_rules, + url_parse::Parsed* new_parsed, + size_t* prefix_end, + std::vector<size_t>* offsets_for_adjustment) { url_parse::Parsed parsed_temp; if (!new_parsed) new_parsed = &parsed_temp; @@ -1527,7 +1531,7 @@ string16 FormatUrlWithOffsets(const GURL& url, const url_parse::Parsed& parsed = url.parsed_for_possibly_invalid_spec(); // Scheme & separators. These are ASCII. - string16 url_string; + base::string16 url_string; url_string.insert(url_string.end(), spec.begin(), spec.begin() + parsed.CountCharactersBefore(url_parse::Parsed::USERNAME, true)); @@ -1681,17 +1685,17 @@ string16 FormatUrlWithOffsets(const GURL& url, return url_string; } -string16 FormatUrl(const GURL& url, - const std::string& languages, - FormatUrlTypes format_types, - UnescapeRule::Type unescape_rules, - url_parse::Parsed* new_parsed, - size_t* prefix_end, - size_t* offset_for_adjustment) { +base::string16 FormatUrl(const GURL& url, + const std::string& languages, + FormatUrlTypes format_types, + UnescapeRule::Type unescape_rules, + url_parse::Parsed* new_parsed, + size_t* prefix_end, + size_t* offset_for_adjustment) { std::vector<size_t> offsets; if (offset_for_adjustment) offsets.push_back(*offset_for_adjustment); - string16 result = FormatUrlWithOffsets(url, languages, format_types, + base::string16 result = FormatUrlWithOffsets(url, languages, format_types, unescape_rules, new_parsed, prefix_end, &offsets); if (offset_for_adjustment) *offset_for_adjustment = offsets[0]; diff --git a/net/base/net_util.h b/net/base/net_util.h index 9bbec55..30584a7 100644 --- a/net/base/net_util.h +++ b/net/base/net_util.h @@ -161,8 +161,8 @@ NET_EXPORT std::string GetHostName(); // Extracts the unescaped username/password from |url|, saving the results // into |*username| and |*password|. NET_EXPORT_PRIVATE void GetIdentityFromURL(const GURL& url, - string16* username, - string16* password); + base::string16* username, + base::string16* password); // Returns either the host from |url|, or, if the host is empty, the full spec. NET_EXPORT std::string GetHostOrSpecFromURL(const GURL& url); @@ -188,7 +188,7 @@ NET_EXPORT std::string GetSpecificHeader(const std::string& headers, // Latin letters in the ASCII range can be mixed with a limited set of // script-language pairs (currently Han, Kana and Hangul for zh,ja and ko). // When |languages| is empty, even that mixing is not allowed. -NET_EXPORT string16 IDNToUnicode(const std::string& host, +NET_EXPORT base::string16 IDNToUnicode(const std::string& host, const std::string& languages); // Canonicalizes |host| and returns it. Also fills |host_info| with @@ -217,7 +217,7 @@ NET_EXPORT bool IsCanonicalizedHostCompliant(const std::string& host, // Call these functions to get the html snippet for a directory listing. // The return values of both functions are in UTF-8. -NET_EXPORT std::string GetDirectoryListingHeader(const string16& title); +NET_EXPORT std::string GetDirectoryListingHeader(const base::string16& title); // Given the name of a file in a directory (ftp or local) and // other information (is_dir, size, modification time), it returns @@ -231,17 +231,17 @@ NET_EXPORT std::string GetDirectoryListingHeader(const string16& title); // will be used. // // Both |name| and |raw_bytes| are escaped internally. -NET_EXPORT std::string GetDirectoryListingEntry(const string16& name, +NET_EXPORT std::string GetDirectoryListingEntry(const base::string16& name, const std::string& raw_bytes, bool is_dir, int64 size, base::Time modified); // If text starts with "www." it is removed, otherwise text is returned // unmodified. -NET_EXPORT string16 StripWWW(const string16& text); +NET_EXPORT base::string16 StripWWW(const base::string16& text); // Runs |url|'s host through StripWWW(). |url| must be valid. -NET_EXPORT string16 StripWWWFromHost(const GURL& url); +NET_EXPORT base::string16 StripWWWFromHost(const GURL& url); // Generates a filename using the first successful method from the following (in // order): @@ -270,12 +270,13 @@ NET_EXPORT string16 StripWWWFromHost(const GURL& url); // // Note: |mime_type| should only be specified if this function is called from a // thread that allows IO. -NET_EXPORT string16 GetSuggestedFilename(const GURL& url, - const std::string& content_disposition, - const std::string& referrer_charset, - const std::string& suggested_name, - const std::string& mime_type, - const std::string& default_name); +NET_EXPORT base::string16 GetSuggestedFilename( + const GURL& url, + const std::string& content_disposition, + const std::string& referrer_charset, + const std::string& suggested_name, + const std::string& mime_type, + const std::string& default_name); // Similar to GetSuggestedFilename(), but returns a FilePath. NET_EXPORT base::FilePath GenerateFileName( @@ -326,7 +327,7 @@ NET_EXPORT int SetNonBlocking(int fd); // takes the same accept languages component as ElideURL(). NET_EXPORT void AppendFormattedHost(const GURL& url, const std::string& languages, - string16* output); + base::string16* output); // Creates a string representation of |url|. The IDN host name may be in Unicode // if |languages| accepts the Unicode representation. |format_type| is a bitmask @@ -348,15 +349,15 @@ NET_EXPORT void AppendFormattedHost(const GURL& url, // be 8. If an offset cannot be successfully adjusted (e.g. because it points // into the middle of a component that was entirely removed, past the end of the // string, or into the middle of an encoding sequence), it will be set to -// string16::npos. -NET_EXPORT string16 FormatUrl(const GURL& url, - const std::string& languages, - FormatUrlTypes format_types, - UnescapeRule::Type unescape_rules, - url_parse::Parsed* new_parsed, - size_t* prefix_end, - size_t* offset_for_adjustment); -NET_EXPORT string16 FormatUrlWithOffsets( +// base::string16::npos. +NET_EXPORT base::string16 FormatUrl(const GURL& url, + const std::string& languages, + FormatUrlTypes format_types, + UnescapeRule::Type unescape_rules, + url_parse::Parsed* new_parsed, + size_t* prefix_end, + size_t* offset_for_adjustment); +NET_EXPORT base::string16 FormatUrlWithOffsets( const GURL& url, const std::string& languages, FormatUrlTypes format_types, @@ -369,7 +370,7 @@ NET_EXPORT string16 FormatUrlWithOffsets( // format_types = kFormatUrlOmitAll and unescape = SPACES. This is the typical // set of flags for "URLs to display to the user". You should be cautious about // using this for URLs which will be parsed or sent to other applications. -inline string16 FormatUrl(const GURL& url, const std::string& languages) { +inline base::string16 FormatUrl(const GURL& url, const std::string& languages) { return FormatUrl(url, languages, kFormatUrlOmitAll, UnescapeRule::SPACES, NULL, NULL, NULL); } diff --git a/net/base/net_util_unittest.cc b/net/base/net_util_unittest.cc index 14b6711..8512d09 100644 --- a/net/base/net_util_unittest.cc +++ b/net/base/net_util_unittest.cc @@ -25,7 +25,7 @@ namespace net { namespace { -static const size_t kNpos = string16::npos; +static const size_t kNpos = base::string16::npos; struct FileCase { const wchar_t* file; @@ -430,9 +430,9 @@ void MakeIPv6Address(const uint8* bytes, int port, SockaddrStorage* storage) { // Append "::<language list>" to |expected| and |actual| to make it // easy to tell which sub-case fails without debugging. void AppendLanguagesToOutputs(const char* languages, - string16* expected, - string16* actual) { - string16 to_append = ASCIIToUTF16("::") + ASCIIToUTF16(languages); + base::string16* expected, + base::string16* actual) { + base::string16 to_append = ASCIIToUTF16("::") + ASCIIToUTF16(languages); expected->append(to_append); actual->append(to_append); } @@ -442,7 +442,7 @@ void VerboseExpect(size_t expected, size_t actual, const std::string& original_url, size_t position, - const string16& formatted_url) { + const base::string16& formatted_url) { EXPECT_EQ(expected, actual) << "Original URL: " << original_url << " (at char " << position << ")\nFormatted URL: " << formatted_url; } @@ -457,7 +457,7 @@ void CheckAdjustedOffsets(const std::string& url_string, GURL url(url_string); for (size_t i = 0; i < num_cases; ++i) { size_t offset = cases[i].input_offset; - string16 formatted_url = FormatUrl(url, languages, format_types, + base::string16 formatted_url = FormatUrl(url, languages, format_types, unescape_rules, NULL, NULL, &offset); VerboseExpect(cases[i].output_offset, offset, url_string, i, formatted_url); } @@ -466,8 +466,8 @@ void CheckAdjustedOffsets(const std::string& url_string, std::vector<size_t> offsets; for (size_t i = 0; i < url_size + 1; ++i) offsets.push_back(i); - string16 formatted_url = FormatUrlWithOffsets(url, languages, format_types, - unescape_rules, NULL, NULL, &offsets); + base::string16 formatted_url = FormatUrlWithOffsets(url, languages, + format_types, unescape_rules, NULL, NULL, &offsets); for (size_t i = 0; i < url_size; ++i) VerboseExpect(all_offsets[i], offsets[i], url_string, i, formatted_url); VerboseExpect(kNpos, offsets[url_size], url_string, url_size, formatted_url); @@ -652,7 +652,7 @@ TEST(NetUtilTest, GetIdentityFromURL) { tests[i].input_url)); GURL url(tests[i].input_url); - string16 username, password; + base::string16 username, password; GetIdentityFromURL(url, &username, &password); EXPECT_EQ(ASCIIToUTF16(tests[i].expected_username), username); @@ -668,7 +668,7 @@ TEST(NetUtilTest, GetIdentityFromURL_UTF8) { EXPECT_EQ("%E4%BD%A0%E5%A5%BD", url.password()); // Extract the unescaped identity. - string16 username, password; + base::string16 username, password; GetIdentityFromURL(url, &username, &password); // Verify that it was decoded as UTF8. @@ -728,8 +728,8 @@ TEST(NetUtilTest, IDNToUnicodeFast) { // ja || zh-TW,en || ko,ja -> IDNToUnicodeSlow if (j == 3 || j == 17 || j == 18) continue; - string16 output(IDNToUnicode(idn_cases[i].input, kLanguages[j])); - string16 expected(idn_cases[i].unicode_allowed[j] ? + base::string16 output(IDNToUnicode(idn_cases[i].input, kLanguages[j])); + base::string16 expected(idn_cases[i].unicode_allowed[j] ? WideToUTF16(idn_cases[i].unicode_output) : ASCIIToUTF16(idn_cases[i].input)); AppendLanguagesToOutputs(kLanguages[j], &expected, &output); @@ -744,8 +744,8 @@ TEST(NetUtilTest, IDNToUnicodeSlow) { // !(ja || zh-TW,en || ko,ja) -> IDNToUnicodeFast if (!(j == 3 || j == 17 || j == 18)) continue; - string16 output(IDNToUnicode(idn_cases[i].input, kLanguages[j])); - string16 expected(idn_cases[i].unicode_allowed[j] ? + base::string16 output(IDNToUnicode(idn_cases[i].input, kLanguages[j])); + base::string16 expected(idn_cases[i].unicode_allowed[j] ? WideToUTF16(idn_cases[i].unicode_output) : ASCIIToUTF16(idn_cases[i].input)); AppendLanguagesToOutputs(kLanguages[j], &expected, &output); @@ -792,8 +792,8 @@ TEST(NetUtilTest, CompliantHost) { } TEST(NetUtilTest, StripWWW) { - EXPECT_EQ(string16(), StripWWW(string16())); - EXPECT_EQ(string16(), StripWWW(ASCIIToUTF16("www."))); + EXPECT_EQ(base::string16(), StripWWW(base::string16())); + EXPECT_EQ(base::string16(), StripWWW(ASCIIToUTF16("www."))); EXPECT_EQ(ASCIIToUTF16("blah"), StripWWW(ASCIIToUTF16("www.blah"))); EXPECT_EQ(ASCIIToUTF16("blah"), StripWWW(ASCIIToUTF16("blah"))); } @@ -2517,7 +2517,7 @@ TEST(NetUtilTest, FormatUrl) { for (size_t i = 0; i < arraysize(tests); ++i) { size_t prefix_len; - string16 formatted = FormatUrl( + base::string16 formatted = FormatUrl( GURL(tests[i].input), tests[i].languages, tests[i].format_types, tests[i].escape_rules, NULL, &prefix_len, NULL); EXPECT_EQ(WideToUTF16(tests[i].output), formatted) << tests[i].description; @@ -2528,7 +2528,7 @@ TEST(NetUtilTest, FormatUrl) { TEST(NetUtilTest, FormatUrlParsed) { // No unescape case. url_parse::Parsed parsed; - string16 formatted = FormatUrl( + base::string16 formatted = FormatUrl( GURL("http://\xE3\x82\xB0:\xE3\x83\xBC@xn--qcka1pmc.jp:8080/" "%E3%82%B0/?q=%E3%82%B0#\xE3\x82\xB0"), "ja", kFormatUrlOmitNothing, UnescapeRule::NONE, &parsed, NULL, @@ -2682,7 +2682,7 @@ TEST(NetUtilTest, FormatUrlRoundTripPathASCII) { GURL url(std::string("http://www.google.com/") + static_cast<char>(test_char)); size_t prefix_len; - string16 formatted = FormatUrl( + base::string16 formatted = FormatUrl( url, "", kFormatUrlOmitUsernamePassword, UnescapeRule::NORMAL, NULL, &prefix_len, NULL); EXPECT_EQ(url.spec(), GURL(formatted).spec()); @@ -2699,7 +2699,7 @@ TEST(NetUtilTest, FormatUrlRoundTripPathEscaped) { GURL url(original_url); size_t prefix_len; - string16 formatted = FormatUrl( + base::string16 formatted = FormatUrl( url, "", kFormatUrlOmitUsernamePassword, UnescapeRule::NORMAL, NULL, &prefix_len, NULL); EXPECT_EQ(url.spec(), GURL(formatted).spec()); @@ -2713,7 +2713,7 @@ TEST(NetUtilTest, FormatUrlRoundTripQueryASCII) { GURL url(std::string("http://www.google.com/?") + static_cast<char>(test_char)); size_t prefix_len; - string16 formatted = FormatUrl( + base::string16 formatted = FormatUrl( url, "", kFormatUrlOmitUsernamePassword, UnescapeRule::NORMAL, NULL, &prefix_len, NULL); EXPECT_EQ(url.spec(), GURL(formatted).spec()); @@ -2734,7 +2734,7 @@ TEST(NetUtilTest, FormatUrlRoundTripQueryEscaped) { GURL url(original_url); size_t prefix_len; - string16 formatted = FormatUrl( + base::string16 formatted = FormatUrl( url, "", kFormatUrlOmitUsernamePassword, UnescapeRule::NORMAL, NULL, &prefix_len, NULL); @@ -2749,7 +2749,7 @@ TEST(NetUtilTest, FormatUrlRoundTripQueryEscaped) { TEST(NetUtilTest, FormatUrlWithOffsets) { const AdjustOffsetCase null_cases[] = { - {0, string16::npos}, + {0, base::string16::npos}, }; CheckAdjustedOffsets(std::string(), "en", kFormatUrlOmitNothing, UnescapeRule::NORMAL, null_cases, arraysize(null_cases), NULL); @@ -2764,9 +2764,9 @@ TEST(NetUtilTest, FormatUrlWithOffsets) { {22, 22}, {23, 23}, {25, 25}, - {26, string16::npos}, - {500000, string16::npos}, - {string16::npos, string16::npos}, + {26, base::string16::npos}, + {500000, base::string16::npos}, + {base::string16::npos, base::string16::npos}, }; const size_t basic_offsets[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25}; @@ -2776,11 +2776,11 @@ TEST(NetUtilTest, FormatUrlWithOffsets) { const AdjustOffsetCase omit_auth_cases_1[] = { {6, 6}, - {7, string16::npos}, - {8, string16::npos}, - {10, string16::npos}, - {12, string16::npos}, - {14, string16::npos}, + {7, base::string16::npos}, + {8, base::string16::npos}, + {10, base::string16::npos}, + {12, base::string16::npos}, + {14, base::string16::npos}, {15, 7}, {25, 17}, }; @@ -2792,7 +2792,7 @@ TEST(NetUtilTest, FormatUrlWithOffsets) { arraysize(omit_auth_cases_1), omit_auth_offsets_1); const AdjustOffsetCase omit_auth_cases_2[] = { - {9, string16::npos}, + {9, base::string16::npos}, {11, 7}, }; const size_t omit_auth_offsets_2[] = {0, 1, 2, 3, 4, 5, 6, kNpos, kNpos, @@ -2804,10 +2804,10 @@ TEST(NetUtilTest, FormatUrlWithOffsets) { // "http://foo\x30B0:\x30B0bar@www.google.com" const AdjustOffsetCase dont_omit_auth_cases[] = { {0, 0}, - /*{3, string16::npos}, + /*{3, base::string16::npos}, {7, 0}, {11, 4}, - {12, string16::npos}, + {12, base::string16::npos}, {20, 5}, {24, 9},*/ }; @@ -2826,11 +2826,11 @@ TEST(NetUtilTest, FormatUrlWithOffsets) { {12, 12}, {13, 13}, {18, 18}, - {19, string16::npos}, - {20, string16::npos}, + {19, base::string16::npos}, + {20, base::string16::npos}, {23, 19}, {26, 22}, - {string16::npos, string16::npos}, + {base::string16::npos, base::string16::npos}, }; const size_t view_source_offsets[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, kNpos, kNpos, kNpos, kNpos, 19, 20, 21, 22, @@ -2841,9 +2841,9 @@ TEST(NetUtilTest, FormatUrlWithOffsets) { // "http://\x671d\x65e5\x3042\x3055\x3072.jp/foo/" const AdjustOffsetCase idn_hostname_cases_1[] = { - {8, string16::npos}, - {16, string16::npos}, - {24, string16::npos}, + {8, base::string16::npos}, + {16, base::string16::npos}, + {24, base::string16::npos}, {25, 12}, {30, 17}, }; @@ -2860,18 +2860,18 @@ TEST(NetUtilTest, FormatUrlWithOffsets) { {9, 9}, {11, 11}, {12, 12}, - {13, string16::npos}, - {23, string16::npos}, + {13, base::string16::npos}, + {23, base::string16::npos}, {24, 14}, {25, 15}, - {26, string16::npos}, - {32, string16::npos}, + {26, base::string16::npos}, + {32, base::string16::npos}, {41, 19}, {42, 20}, {45, 23}, {46, 24}, - {47, string16::npos}, - {string16::npos, string16::npos}, + {47, base::string16::npos}, + {base::string16::npos, base::string16::npos}, }; const size_t idn_hostname_offsets_2[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, kNpos, kNpos, kNpos, kNpos, kNpos, kNpos, kNpos, kNpos, kNpos, kNpos, @@ -2885,15 +2885,15 @@ TEST(NetUtilTest, FormatUrlWithOffsets) { // "http://www.google.com/foo bar/\x30B0\x30FC\x30B0\x30EB" const AdjustOffsetCase unescape_cases[] = { {25, 25}, - {26, string16::npos}, - {27, string16::npos}, + {26, base::string16::npos}, + {27, base::string16::npos}, {28, 26}, - {35, string16::npos}, + {35, base::string16::npos}, {41, 31}, {59, 33}, - {60, string16::npos}, - {67, string16::npos}, - {68, string16::npos}, + {60, base::string16::npos}, + {67, base::string16::npos}, + {68, base::string16::npos}, }; const size_t unescape_offsets[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, kNpos, kNpos, 26, 27, @@ -2910,11 +2910,11 @@ TEST(NetUtilTest, FormatUrlWithOffsets) { const AdjustOffsetCase ref_cases[] = { {30, 30}, {31, 31}, - {32, string16::npos}, + {32, base::string16::npos}, {34, 32}, - {35, string16::npos}, + {35, base::string16::npos}, {37, 33}, - {38, string16::npos}, + {38, base::string16::npos}, }; const size_t ref_offsets[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, @@ -2925,8 +2925,8 @@ TEST(NetUtilTest, FormatUrlWithOffsets) { arraysize(ref_cases), ref_offsets); const AdjustOffsetCase omit_http_cases[] = { - {0, string16::npos}, - {3, string16::npos}, + {0, base::string16::npos}, + {3, base::string16::npos}, {7, 0}, {8, 1}, }; @@ -2951,8 +2951,8 @@ TEST(NetUtilTest, FormatUrlWithOffsets) { const AdjustOffsetCase omit_all_cases[] = { {12, 0}, {13, 1}, - {0, string16::npos}, - {3, string16::npos}, + {0, base::string16::npos}, + {3, base::string16::npos}, }; const size_t omit_all_offsets[] = {kNpos, kNpos, kNpos, kNpos, kNpos, kNpos, kNpos, kNpos, kNpos, kNpos, kNpos, kNpos, 0, 1, 2, 3, 4, 5, 6, kNpos}; diff --git a/net/base/network_delegate.cc b/net/base/network_delegate.cc index 59953a8..a973247 100644 --- a/net/base/network_delegate.cc +++ b/net/base/network_delegate.cc @@ -78,7 +78,7 @@ void NetworkDelegate::NotifyURLRequestDestroyed(URLRequest* request) { } void NetworkDelegate::NotifyPACScriptError(int line_number, - const string16& error) { + const base::string16& error) { DCHECK(CalledOnValidThread()); OnPACScriptError(line_number, error); } diff --git a/net/base/network_delegate.h b/net/base/network_delegate.h index f219854..520fb17 100644 --- a/net/base/network_delegate.h +++ b/net/base/network_delegate.h @@ -84,7 +84,7 @@ class NET_EXPORT NetworkDelegate : public base::NonThreadSafe { void NotifyRawBytesRead(const URLRequest& request, int bytes_read); void NotifyCompleted(URLRequest* request, bool started); void NotifyURLRequestDestroyed(URLRequest* request); - void NotifyPACScriptError(int line_number, const string16& error); + void NotifyPACScriptError(int line_number, const base::string16& error); AuthRequiredResponse NotifyAuthRequired(URLRequest* request, const AuthChallengeInfo& auth_info, const AuthCallback& callback, @@ -175,7 +175,8 @@ class NET_EXPORT NetworkDelegate : public base::NonThreadSafe { virtual void OnURLRequestDestroyed(URLRequest* request) = 0; // Corresponds to ProxyResolverJSBindings::OnError. - virtual void OnPACScriptError(int line_number, const string16& error) = 0; + virtual void OnPACScriptError(int line_number, + const base::string16& error) = 0; // Called when a request receives an authentication challenge // specified by |auth_info|, and is unable to respond using cached diff --git a/net/base/nss_cert_database.cc b/net/base/nss_cert_database.cc index 4834af2..1cfb212 100644 --- a/net/base/nss_cert_database.cc +++ b/net/base/nss_cert_database.cc @@ -116,7 +116,7 @@ void NSSCertDatabase::ListModules(CryptoModuleList* modules, int NSSCertDatabase::ImportFromPKCS12( CryptoModule* module, const std::string& data, - const string16& password, + const base::string16& password, bool is_extractable, net::CertificateList* imported_certs) { int result = psm::nsPKCS12Blob_Import(module->os_module_handle(), @@ -132,7 +132,7 @@ int NSSCertDatabase::ImportFromPKCS12( int NSSCertDatabase::ExportToPKCS12( const CertificateList& certs, - const string16& password, + const base::string16& password, std::string* output) const { return psm::nsPKCS12Blob_Export(output, certs, password); } diff --git a/net/base/nss_cert_database.h b/net/base/nss_cert_database.h index 9e0310d..ae8c155 100644 --- a/net/base/nss_cert_database.h +++ b/net/base/nss_cert_database.h @@ -114,14 +114,15 @@ class NET_EXPORT NSSCertDatabase { // of certs that were imported. int ImportFromPKCS12(CryptoModule* module, const std::string& data, - const string16& password, + const base::string16& password, bool is_extractable, CertificateList* imported_certs); // Export the given certificates and private keys into a PKCS #12 blob, // storing into |output|. // Returns the number of certificates successfully exported. - int ExportToPKCS12(const CertificateList& certs, const string16& password, + int ExportToPKCS12(const CertificateList& certs, + const base::string16& password, std::string* output) const; // Uses similar logic to nsNSSCertificateDB::handleCACertDownload to find the diff --git a/net/base/nss_cert_database_unittest.cc b/net/base/nss_cert_database_unittest.cc index 1110bf3..8564ec7 100644 --- a/net/base/nss_cert_database_unittest.cc +++ b/net/base/nss_cert_database_unittest.cc @@ -141,7 +141,7 @@ TEST_F(CertDatabaseNSSTest, ImportFromPKCS12WrongPassword) { EXPECT_EQ(ERR_PKCS12_IMPORT_BAD_PASSWORD, cert_db_->ImportFromPKCS12(slot_, pkcs12_data, - string16(), + base::string16(), true, // is_extractable NULL)); @@ -251,7 +251,7 @@ TEST_F(CertDatabaseNSSTest, ImportFromPKCS12InvalidFile) { EXPECT_EQ(ERR_PKCS12_IMPORT_INVALID_FILE, cert_db_->ImportFromPKCS12(slot_, pkcs12_data, - string16(), + base::string16(), true, // is_extractable NULL)); diff --git a/net/base/x509_cert_types_mac.cc b/net/base/x509_cert_types_mac.cc index f96802c..a3eec5e 100644 --- a/net/base/x509_cert_types_mac.cc +++ b/net/base/x509_cert_types_mac.cc @@ -112,7 +112,7 @@ std::string DataToString(CSSM_DATA data) { // Converts raw CSSM_DATA in ISO-8859-1 to a std::string in UTF-8. std::string Latin1DataToUTF8String(CSSM_DATA data) { - string16 utf16; + base::string16 utf16; if (!CodepageToUTF16(DataToString(data), base::kCodepageLatin1, base::OnStringConversionError::FAIL, &utf16)) return ""; diff --git a/net/base/zap.cc b/net/base/zap.cc index 8bcf015..e2d3ffb 100644 --- a/net/base/zap.cc +++ b/net/base/zap.cc @@ -15,7 +15,7 @@ void ZapString(std::string* s) { ZapBuf(&(*s)[0], s->length() * sizeof(char)); } -void ZapString(string16* s) { +void ZapString(base::string16* s) { if (!s->empty()) ZapBuf(&(*s)[0], s->length() * sizeof(char16)); } diff --git a/net/base/zap.h b/net/base/zap.h index 82e1800..9145129 100644 --- a/net/base/zap.h +++ b/net/base/zap.h @@ -19,8 +19,8 @@ void ZapBuf(void* buf, size_t buf_len); // Overwrite a string's internal buffer with 0's. void ZapString(std::string* s); -// Overwrite a string16's internal buffer with 0's. -void ZapString(string16* s); +// Overwrite a base::string16's internal buffer with 0's. +void ZapString(base::string16* s); } // net diff --git a/net/dns/dns_config_service_win.cc b/net/dns/dns_config_service_win.cc index 64a254d..127746e 100644 --- a/net/dns/dns_config_service_win.cc +++ b/net/dns/dns_config_service_win.cc @@ -119,10 +119,10 @@ scoped_ptr_malloc<IP_ADAPTER_ADDRESSES> ReadIpHelper(ULONG flags) { return out.Pass(); } -// Converts a string16 domain name to ASCII, possibly using punycode. +// Converts a base::string16 domain name to ASCII, possibly using punycode. // Returns true if the conversion succeeds and output is not empty. In case of // failure, |domain| might become dirty. -bool ParseDomainASCII(const string16& widestr, std::string* domain) { +bool ParseDomainASCII(const base::string16& widestr, std::string* domain) { DCHECK(domain); if (widestr.empty()) return false; @@ -340,7 +340,8 @@ base::FilePath GetHostsPath() { FILE_PATH_LITERAL("drivers\\etc\\hosts")); } -bool ParseSearchList(const string16& value, std::vector<std::string>* output) { +bool ParseSearchList(const base::string16& value, + std::vector<std::string>* output) { DCHECK(output); if (value.empty()) return false; @@ -351,12 +352,12 @@ bool ParseSearchList(const string16& value, std::vector<std::string>* output) { // Although nslookup and network connection property tab ignore such // fragments ("a,b,,c" becomes ["a", "b", "c"]), our reference is getaddrinfo // (which sees ["a", "b"]). WMI queries also return a matching search list. - std::vector<string16> woutput; + std::vector<base::string16> woutput; base::SplitString(value, ',', &woutput); for (size_t i = 0; i < woutput.size(); ++i) { // Convert non-ASCII to punycode, although getaddrinfo does not properly // handle such suffixes. - const string16& t = woutput[i]; + const base::string16& t = woutput[i]; std::string parsed; if (!ParseDomainASCII(t, &parsed)) break; diff --git a/net/dns/dns_config_service_win.h b/net/dns/dns_config_service_win.h index bd04aaf..d6613e7 100644 --- a/net/dns/dns_config_service_win.h +++ b/net/dns/dns_config_service_win.h @@ -51,7 +51,7 @@ base::FilePath GetHostsPath(); // a registry key and stores it in |out|. Returns true on success. Empty // entries (e.g., "chromium.org,,org") terminate the list. Non-ascii hostnames // are converted to punycode. -bool NET_EXPORT_PRIVATE ParseSearchList(const string16& value, +bool NET_EXPORT_PRIVATE ParseSearchList(const base::string16& value, std::vector<std::string>* out); // All relevant settings read from registry and IP Helper. This isolates our @@ -61,7 +61,7 @@ struct NET_EXPORT_PRIVATE DnsSystemSettings { // The |set| flag distinguishes between empty and unset values. struct RegString { bool set; - string16 value; + base::string16 value; }; struct RegDword { diff --git a/net/ftp/ftp_auth_cache_unittest.cc b/net/ftp/ftp_auth_cache_unittest.cc index 33ce553..e036635 100644 --- a/net/ftp/ftp_auth_cache_unittest.cc +++ b/net/ftp/ftp_auth_cache_unittest.cc @@ -15,17 +15,17 @@ using net::FtpAuthCache; namespace { -const string16 kBogus(ASCIIToUTF16("bogus")); -const string16 kOthername(ASCIIToUTF16("othername")); -const string16 kOtherword(ASCIIToUTF16("otherword")); -const string16 kPassword(ASCIIToUTF16("password")); -const string16 kPassword1(ASCIIToUTF16("password1")); -const string16 kPassword2(ASCIIToUTF16("password2")); -const string16 kPassword3(ASCIIToUTF16("password3")); -const string16 kUsername(ASCIIToUTF16("username")); -const string16 kUsername1(ASCIIToUTF16("username1")); -const string16 kUsername2(ASCIIToUTF16("username2")); -const string16 kUsername3(ASCIIToUTF16("username3")); +const base::string16 kBogus(ASCIIToUTF16("bogus")); +const base::string16 kOthername(ASCIIToUTF16("othername")); +const base::string16 kOtherword(ASCIIToUTF16("otherword")); +const base::string16 kPassword(ASCIIToUTF16("password")); +const base::string16 kPassword1(ASCIIToUTF16("password1")); +const base::string16 kPassword2(ASCIIToUTF16("password2")); +const base::string16 kPassword3(ASCIIToUTF16("password3")); +const base::string16 kUsername(ASCIIToUTF16("username")); +const base::string16 kUsername1(ASCIIToUTF16("username1")); +const base::string16 kUsername2(ASCIIToUTF16("username2")); +const base::string16 kUsername3(ASCIIToUTF16("username3")); } // namespace diff --git a/net/ftp/ftp_directory_listing_parser.cc b/net/ftp/ftp_directory_listing_parser.cc index b57aff9..eb322e6 100644 --- a/net/ftp/ftp_directory_listing_parser.cc +++ b/net/ftp/ftp_directory_listing_parser.cc @@ -41,13 +41,13 @@ int FillInRawName(const std::string& encoding, // Parses |text| as an FTP directory listing. Fills in |entries| // and |server_type| and returns network error code. -int ParseListing(const string16& text, - const string16& newline_separator, +int ParseListing(const base::string16& text, + const base::string16& newline_separator, const std::string& encoding, const base::Time& current_time, std::vector<FtpDirectoryListingEntry>* entries, FtpServerType* server_type) { - std::vector<string16> lines; + std::vector<base::string16> lines; base::SplitStringUsingSubstr(text, newline_separator, &lines); struct { @@ -103,7 +103,7 @@ int DecodeAndParse(const std::string& text, // Use first encoding that can be used to decode the text. for (size_t i = 0; i < encodings.size(); i++) { - string16 converted_text; + base::string16 converted_text; if (base::CodepageToUTF16(text, encodings[i].c_str(), base::OnStringConversionError::FAIL, diff --git a/net/ftp/ftp_directory_listing_parser.h b/net/ftp/ftp_directory_listing_parser.h index cc431ee..21d7932 100644 --- a/net/ftp/ftp_directory_listing_parser.h +++ b/net/ftp/ftp_directory_listing_parser.h @@ -26,7 +26,7 @@ struct FtpDirectoryListingEntry { FtpDirectoryListingEntry(); Type type; - string16 name; // Name (UTF-16-encoded). + base::string16 name; // Name (UTF-16-encoded). std::string raw_name; // Name in original character encoding. int64 size; // File size, in bytes. -1 if not applicable. diff --git a/net/ftp/ftp_directory_listing_parser_ls.cc b/net/ftp/ftp_directory_listing_parser_ls.cc index 6c5dc75..cab3101 100644 --- a/net/ftp/ftp_directory_listing_parser_ls.cc +++ b/net/ftp/ftp_directory_listing_parser_ls.cc @@ -16,13 +16,13 @@ namespace { -bool TwoColumnDateListingToTime(const string16& date, - const string16& time, +bool TwoColumnDateListingToTime(const base::string16& date, + const base::string16& time, base::Time* result) { base::Time::Exploded time_exploded = { 0 }; // Date should be in format YYYY-MM-DD. - std::vector<string16> date_parts; + std::vector<base::string16> date_parts; base::SplitString(date, '-', &date_parts); if (date_parts.size() != 3) return false; @@ -37,7 +37,7 @@ bool TwoColumnDateListingToTime(const string16& date, if (time.length() != 5) return false; - std::vector<string16> time_parts; + std::vector<base::string16> time_parts; base::SplitString(time, ':', &time_parts); if (time_parts.size() != 2) return false; @@ -56,10 +56,10 @@ bool TwoColumnDateListingToTime(const string16& date, // Returns the column index of the end of the date listing and detected // last modification time. bool DetectColumnOffsetSizeAndModificationTime( - const std::vector<string16>& columns, + const std::vector<base::string16>& columns, const base::Time& current_time, size_t* offset, - string16* size, + base::string16* size, base::Time* modification_time) { // The column offset can be arbitrarily large if some fields // like owner or group name contain spaces. Try offsets from left to right @@ -123,7 +123,7 @@ bool DetectColumnOffsetSizeAndModificationTime( namespace net { bool ParseFtpDirectoryListingLs( - const std::vector<string16>& lines, + const std::vector<base::string16>& lines, const base::Time& current_time, std::vector<FtpDirectoryListingEntry>* entries) { // True after we have received a "total n" listing header, where n is an @@ -134,7 +134,7 @@ bool ParseFtpDirectoryListingLs( if (lines[i].empty()) continue; - std::vector<string16> columns; + std::vector<base::string16> columns; base::SplitString(CollapseWhitespace(lines[i], false), ' ', &columns); // Some FTP servers put a "total n" line at the beginning of the listing @@ -157,7 +157,7 @@ bool ParseFtpDirectoryListingLs( FtpDirectoryListingEntry entry; size_t column_offset; - string16 size; + base::string16 size; if (!DetectColumnOffsetSizeAndModificationTime(columns, current_time, &column_offset, @@ -167,7 +167,7 @@ bool ParseFtpDirectoryListingLs( // All those messages have in common is the string ".:", // where "." means the current directory, and ":" separates it // from the rest of the message, which may be empty. - if (lines[i].find(ASCIIToUTF16(".:")) != string16::npos) + if (lines[i].find(ASCIIToUTF16(".:")) != base::string16::npos) continue; return false; @@ -216,11 +216,11 @@ bool ParseFtpDirectoryListingLs( column_offset + 1); if (entry.type == FtpDirectoryListingEntry::SYMLINK) { - string16::size_type pos = entry.name.rfind(ASCIIToUTF16(" -> ")); + base::string16::size_type pos = entry.name.rfind(ASCIIToUTF16(" -> ")); // We don't require the " -> " to be present. Some FTP servers don't send // the symlink target, possibly for security reasons. - if (pos != string16::npos) + if (pos != base::string16::npos) entry.name = entry.name.substr(0, pos); } diff --git a/net/ftp/ftp_directory_listing_parser_ls.h b/net/ftp/ftp_directory_listing_parser_ls.h index f3c16eb..bf481cc 100644 --- a/net/ftp/ftp_directory_listing_parser_ls.h +++ b/net/ftp/ftp_directory_listing_parser_ls.h @@ -20,7 +20,7 @@ struct FtpDirectoryListingEntry; // Parses "ls -l" FTP directory listing. Returns true on success. NET_EXPORT_PRIVATE bool ParseFtpDirectoryListingLs( - const std::vector<string16>& lines, + const std::vector<base::string16>& lines, const base::Time& current_time, std::vector<FtpDirectoryListingEntry>* entries); diff --git a/net/ftp/ftp_directory_listing_parser_netware.cc b/net/ftp/ftp_directory_listing_parser_netware.cc index bace441..3229c3e 100644 --- a/net/ftp/ftp_directory_listing_parser_netware.cc +++ b/net/ftp/ftp_directory_listing_parser_netware.cc @@ -15,7 +15,7 @@ namespace { -bool LooksLikeNetwarePermissionsListing(const string16& text) { +bool LooksLikeNetwarePermissionsListing(const base::string16& text) { if (text.length() != 10) return false; @@ -36,7 +36,7 @@ bool LooksLikeNetwarePermissionsListing(const string16& text) { namespace net { bool ParseFtpDirectoryListingNetware( - const std::vector<string16>& lines, + const std::vector<base::string16>& lines, const base::Time& current_time, std::vector<FtpDirectoryListingEntry>* entries) { if (!lines.empty() && !StartsWith(lines[0], ASCIIToUTF16("total "), true)) @@ -46,7 +46,7 @@ bool ParseFtpDirectoryListingNetware( if (lines[i].empty()) continue; - std::vector<string16> columns; + std::vector<base::string16> columns; base::SplitString(CollapseWhitespace(lines[i], false), ' ', &columns); if (columns.size() < 8) diff --git a/net/ftp/ftp_directory_listing_parser_netware.h b/net/ftp/ftp_directory_listing_parser_netware.h index a7bde93..4b087dd 100644 --- a/net/ftp/ftp_directory_listing_parser_netware.h +++ b/net/ftp/ftp_directory_listing_parser_netware.h @@ -20,7 +20,7 @@ struct FtpDirectoryListingEntry; // Parses Netware FTP directory listing. Returns true on success. NET_EXPORT_PRIVATE bool ParseFtpDirectoryListingNetware( - const std::vector<string16>& lines, + const std::vector<base::string16>& lines, const base::Time& current_time, std::vector<FtpDirectoryListingEntry>* entries); diff --git a/net/ftp/ftp_directory_listing_parser_netware_unittest.cc b/net/ftp/ftp_directory_listing_parser_netware_unittest.cc index f6715ff..e5e4211 100644 --- a/net/ftp/ftp_directory_listing_parser_netware_unittest.cc +++ b/net/ftp/ftp_directory_listing_parser_netware_unittest.cc @@ -32,7 +32,8 @@ TEST_F(FtpDirectoryListingParserNetwareTest, Good) { SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, good_cases[i].input)); - std::vector<string16> lines(GetSingleLineTestCase(good_cases[i].input)); + std::vector<base::string16> lines( + GetSingleLineTestCase(good_cases[i].input)); // The parser requires a "total n" line before accepting regular input. lines.insert(lines.begin(), ASCIIToUTF16("total 1")); @@ -59,7 +60,7 @@ TEST_F(FtpDirectoryListingParserNetwareTest, Bad) { SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, bad_cases[i])); - std::vector<string16> lines(GetSingleLineTestCase(bad_cases[i])); + std::vector<base::string16> lines(GetSingleLineTestCase(bad_cases[i])); // The parser requires a "total n" line before accepting regular input. lines.insert(lines.begin(), ASCIIToUTF16("total 1")); diff --git a/net/ftp/ftp_directory_listing_parser_os2.cc b/net/ftp/ftp_directory_listing_parser_os2.cc index 78a0d478..fd85f0d 100644 --- a/net/ftp/ftp_directory_listing_parser_os2.cc +++ b/net/ftp/ftp_directory_listing_parser_os2.cc @@ -16,13 +16,13 @@ namespace net { bool ParseFtpDirectoryListingOS2( - const std::vector<string16>& lines, + const std::vector<base::string16>& lines, std::vector<FtpDirectoryListingEntry>* entries) { for (size_t i = 0; i < lines.size(); i++) { if (lines[i].empty()) continue; - std::vector<string16> columns; + std::vector<base::string16> columns; base::SplitString(CollapseWhitespace(lines[i], false), ' ', &columns); // Every line of the listing consists of the following: diff --git a/net/ftp/ftp_directory_listing_parser_os2.h b/net/ftp/ftp_directory_listing_parser_os2.h index 89c59f0..81e6d0a 100644 --- a/net/ftp/ftp_directory_listing_parser_os2.h +++ b/net/ftp/ftp_directory_listing_parser_os2.h @@ -16,7 +16,7 @@ struct FtpDirectoryListingEntry; // Parses OS/2 FTP directory listing. Returns true on success. NET_EXPORT_PRIVATE bool ParseFtpDirectoryListingOS2( - const std::vector<string16>& lines, + const std::vector<base::string16>& lines, std::vector<FtpDirectoryListingEntry>* entries); } // namespace net diff --git a/net/ftp/ftp_directory_listing_parser_unittest.h b/net/ftp/ftp_directory_listing_parser_unittest.h index dbb1678..a7c520a 100644 --- a/net/ftp/ftp_directory_listing_parser_unittest.h +++ b/net/ftp/ftp_directory_listing_parser_unittest.h @@ -30,8 +30,8 @@ class FtpDirectoryListingParserTest : public testing::Test { protected: FtpDirectoryListingParserTest() {} - std::vector<string16> GetSingleLineTestCase(const std::string& text) { - std::vector<string16> lines; + std::vector<base::string16> GetSingleLineTestCase(const std::string& text) { + std::vector<base::string16> lines; lines.push_back(UTF8ToUTF16(text)); return lines; } diff --git a/net/ftp/ftp_directory_listing_parser_vms.cc b/net/ftp/ftp_directory_listing_parser_vms.cc index f45e3a2..e20a063 100644 --- a/net/ftp/ftp_directory_listing_parser_vms.cc +++ b/net/ftp/ftp_directory_listing_parser_vms.cc @@ -20,11 +20,12 @@ namespace { // Converts the filename component in listing to the filename we can display. // Returns true on success. -bool ParseVmsFilename(const string16& raw_filename, string16* parsed_filename, +bool ParseVmsFilename(const base::string16& raw_filename, + base::string16* parsed_filename, FtpDirectoryListingEntry::Type* type) { // On VMS, the files and directories are versioned. The version number is // separated from the file name by a semicolon. Example: ANNOUNCE.TXT;2. - std::vector<string16> listing_parts; + std::vector<base::string16> listing_parts; base::SplitString(raw_filename, ';', &listing_parts); if (listing_parts.size() != 2) return false; @@ -38,7 +39,7 @@ bool ParseVmsFilename(const string16& raw_filename, string16* parsed_filename, // for directories; it's awkward for non-VMS users. Also, VMS is // case-insensitive, but generally uses uppercase characters. This may look // awkward, so we convert them to lower case. - std::vector<string16> filename_parts; + std::vector<base::string16> filename_parts; base::SplitString(listing_parts[0], '.', &filename_parts); if (filename_parts.size() != 2) return false; @@ -52,7 +53,7 @@ bool ParseVmsFilename(const string16& raw_filename, string16* parsed_filename, return true; } -bool ParseVmsFilesize(const string16& input, int64* size) { +bool ParseVmsFilesize(const base::string16& input, int64* size) { if (ContainsOnlyChars(input, ASCIIToUTF16("*"))) { // Response consisting of asterisks means unknown size. *size = -1; @@ -71,7 +72,7 @@ bool ParseVmsFilesize(const string16& input, int64* size) { return true; } - std::vector<string16> parts; + std::vector<base::string16> parts; base::SplitString(input, '/', &parts); if (parts.size() != 2) return false; @@ -90,14 +91,14 @@ bool ParseVmsFilesize(const string16& input, int64* size) { return true; } -bool LooksLikeVmsFileProtectionListingPart(const string16& input) { +bool LooksLikeVmsFileProtectionListingPart(const base::string16& input) { if (input.length() > 4) return false; // On VMS there are four different permission bits: Read, Write, Execute, // and Delete. They appear in that order in the permission listing. std::string pattern("RWED"); - string16 match(input); + base::string16 match(input); while (!match.empty() && !pattern.empty()) { if (match[0] == pattern[0]) match = match.substr(1); @@ -106,7 +107,7 @@ bool LooksLikeVmsFileProtectionListingPart(const string16& input) { return match.empty(); } -bool LooksLikeVmsFileProtectionListing(const string16& input) { +bool LooksLikeVmsFileProtectionListing(const base::string16& input) { if (input.length() < 2) return false; if (input[0] != '(' || input[input.length() - 1] != ')') @@ -114,7 +115,7 @@ bool LooksLikeVmsFileProtectionListing(const string16& input) { // We expect four parts of the file protection listing: for System, Owner, // Group, and World. - std::vector<string16> parts; + std::vector<base::string16> parts; base::SplitString(input.substr(1, input.length() - 2), ',', &parts); if (parts.size() != 4) return false; @@ -125,13 +126,13 @@ bool LooksLikeVmsFileProtectionListing(const string16& input) { LooksLikeVmsFileProtectionListingPart(parts[3]); } -bool LooksLikeVmsUserIdentificationCode(const string16& input) { +bool LooksLikeVmsUserIdentificationCode(const base::string16& input) { if (input.length() < 2) return false; return input[0] == '[' && input[input.length() - 1] == ']'; } -bool LooksLikeVMSError(const string16& text) { +bool LooksLikeVMSError(const base::string16& text) { static const char* kPermissionDeniedMessages[] = { "%RMS-E-FNF", // File not found. "%RMS-E-PRV", // Access denied. @@ -140,21 +141,22 @@ bool LooksLikeVMSError(const string16& text) { }; for (size_t i = 0; i < arraysize(kPermissionDeniedMessages); i++) { - if (text.find(ASCIIToUTF16(kPermissionDeniedMessages[i])) != string16::npos) + if (text.find(ASCIIToUTF16(kPermissionDeniedMessages[i])) != + base::string16::npos) return true; } return false; } -bool VmsDateListingToTime(const std::vector<string16>& columns, +bool VmsDateListingToTime(const std::vector<base::string16>& columns, base::Time* time) { DCHECK_EQ(4U, columns.size()); base::Time::Exploded time_exploded = { 0 }; // Date should be in format DD-MMM-YYYY. - std::vector<string16> date_parts; + std::vector<base::string16> date_parts; base::SplitString(columns[2], '-', &date_parts); if (date_parts.size() != 3) return false; @@ -168,14 +170,14 @@ bool VmsDateListingToTime(const std::vector<string16>& columns, // Time can be in format HH:MM, HH:MM:SS, or HH:MM:SS.mm. Try to recognize the // last type first. Do not parse the seconds, they will be ignored anyway. - string16 time_column(columns[3]); + base::string16 time_column(columns[3]); if (time_column.length() == 11 && time_column[8] == '.') time_column = time_column.substr(0, 8); if (time_column.length() == 8 && time_column[5] == ':') time_column = time_column.substr(0, 5); if (time_column.length() != 5) return false; - std::vector<string16> time_parts; + std::vector<base::string16> time_parts; base::SplitString(time_column, ':', &time_parts); if (time_parts.size() != 2) return false; @@ -192,7 +194,7 @@ bool VmsDateListingToTime(const std::vector<string16>& columns, } // namespace bool ParseFtpDirectoryListingVms( - const std::vector<string16>& lines, + const std::vector<base::string16>& lines, std::vector<FtpDirectoryListingEntry>* entries) { // The first non-empty line is the listing header. It often // starts with "Directory ", but not always. We set a flag after @@ -227,7 +229,7 @@ bool ParseFtpDirectoryListingVms( continue; } - std::vector<string16> columns; + std::vector<base::string16> columns; base::SplitString(CollapseWhitespace(lines[i], false), ' ', &columns); if (columns.size() == 1) { diff --git a/net/ftp/ftp_directory_listing_parser_vms.h b/net/ftp/ftp_directory_listing_parser_vms.h index 6777387..3d993b5 100644 --- a/net/ftp/ftp_directory_listing_parser_vms.h +++ b/net/ftp/ftp_directory_listing_parser_vms.h @@ -16,7 +16,7 @@ struct FtpDirectoryListingEntry; // Parses VMS FTP directory listing. Returns true on success. NET_EXPORT_PRIVATE bool ParseFtpDirectoryListingVms( - const std::vector<string16>& lines, + const std::vector<base::string16>& lines, std::vector<FtpDirectoryListingEntry>* entries); } // namespace net diff --git a/net/ftp/ftp_directory_listing_parser_vms_unittest.cc b/net/ftp/ftp_directory_listing_parser_vms_unittest.cc index 8cdd8c7..ceea951 100644 --- a/net/ftp/ftp_directory_listing_parser_vms_unittest.cc +++ b/net/ftp/ftp_directory_listing_parser_vms_unittest.cc @@ -54,7 +54,8 @@ TEST_F(FtpDirectoryListingParserVmsTest, Good) { SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, good_cases[i].input)); - std::vector<string16> lines(GetSingleLineTestCase(good_cases[i].input)); + std::vector<base::string16> lines( + GetSingleLineTestCase(good_cases[i].input)); // The parser requires a directory header before accepting regular input. lines.insert(lines.begin(), @@ -108,7 +109,7 @@ TEST_F(FtpDirectoryListingParserVmsTest, Bad) { for (size_t i = 0; i < arraysize(bad_cases); i++) { SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, bad_cases[i])); - std::vector<string16> lines(GetSingleLineTestCase(bad_cases[i])); + std::vector<base::string16> lines(GetSingleLineTestCase(bad_cases[i])); // The parser requires a directory header before accepting regular input. lines.insert(lines.begin(), @@ -133,7 +134,7 @@ TEST_F(FtpDirectoryListingParserVmsTest, BadDataAfterFooter) { for (size_t i = 0; i < arraysize(bad_cases); i++) { SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, bad_cases[i])); - std::vector<string16> lines( + std::vector<base::string16> lines( GetSingleLineTestCase("README.TXT;4 2 18-APR-2000 10:40:39.90")); // The parser requires a directory header before accepting regular input. diff --git a/net/ftp/ftp_directory_listing_parser_windows.cc b/net/ftp/ftp_directory_listing_parser_windows.cc index 333ccb1..9de6f09 100644 --- a/net/ftp/ftp_directory_listing_parser_windows.cc +++ b/net/ftp/ftp_directory_listing_parser_windows.cc @@ -16,13 +16,13 @@ namespace net { bool ParseFtpDirectoryListingWindows( - const std::vector<string16>& lines, + const std::vector<base::string16>& lines, std::vector<FtpDirectoryListingEntry>* entries) { for (size_t i = 0; i < lines.size(); i++) { if (lines[i].empty()) continue; - std::vector<string16> columns; + std::vector<base::string16> columns; base::SplitString(CollapseWhitespace(lines[i], false), ' ', &columns); // Every line of the listing consists of the following: diff --git a/net/ftp/ftp_directory_listing_parser_windows.h b/net/ftp/ftp_directory_listing_parser_windows.h index f45f433..135703d 100644 --- a/net/ftp/ftp_directory_listing_parser_windows.h +++ b/net/ftp/ftp_directory_listing_parser_windows.h @@ -16,7 +16,7 @@ struct FtpDirectoryListingEntry; // Parses Windows FTP directory listing. Returns true on success. NET_EXPORT_PRIVATE bool ParseFtpDirectoryListingWindows( - const std::vector<string16>& lines, + const std::vector<base::string16>& lines, std::vector<FtpDirectoryListingEntry>* entries); } // namespace net diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc index 23d9f32..16adff4 100644 --- a/net/ftp/ftp_network_transaction.cc +++ b/net/ftp/ftp_network_transaction.cc @@ -254,8 +254,8 @@ int FtpNetworkTransaction::Start(const FtpRequestInfo* request_info, ctrl_response_buffer_.reset(new FtpCtrlResponseBuffer(net_log_)); if (request_->url.has_username()) { - string16 username; - string16 password; + base::string16 username; + base::string16 password; GetIdentityFromURL(request_->url, &username, &password); credentials_.Set(username, password); } else { diff --git a/net/ftp/ftp_util.cc b/net/ftp/ftp_util.cc index 15b218a..0213584 100644 --- a/net/ftp/ftp_util.cc +++ b/net/ftp/ftp_util.cc @@ -135,10 +135,10 @@ class AbbreviatedMonthsMap { // Converts abbreviated month name |text| to its number (in range 1-12). // On success returns true and puts the number in |number|. - bool GetMonthNumber(const string16& text, int* number) { + bool GetMonthNumber(const base::string16& text, int* number) { // Ignore the case of the month names. The simplest way to handle that // is to make everything lowercase. - string16 text_lower(base::i18n::ToLower(text)); + base::string16 text_lower(base::i18n::ToLower(text)); if (map_.find(text_lower) == map_.end()) return false; @@ -172,7 +172,7 @@ class AbbreviatedMonthsMap { format_symbols.getShortMonths(months_count); for (int32_t month = 0; month < months_count; month++) { - string16 month_name(months[month].getBuffer(), + base::string16 month_name(months[month].getBuffer(), static_cast<size_t>(months[month].length())); // Ignore the case of the month names. The simplest way to handle that @@ -190,7 +190,7 @@ class AbbreviatedMonthsMap { } // Maps lowercase month names to numbers in range 1-12. - std::map<string16, int> map_; + std::map<base::string16, int> map_; DISALLOW_COPY_AND_ASSIGN(AbbreviatedMonthsMap); }; @@ -198,13 +198,15 @@ class AbbreviatedMonthsMap { } // namespace // static -bool FtpUtil::AbbreviatedMonthToNumber(const string16& text, int* number) { +bool FtpUtil::AbbreviatedMonthToNumber(const base::string16& text, + int* number) { return AbbreviatedMonthsMap::GetInstance()->GetMonthNumber(text, number); } // static -bool FtpUtil::LsDateListingToTime(const string16& month, const string16& day, - const string16& rest, +bool FtpUtil::LsDateListingToTime(const base::string16& month, + const base::string16& day, + const base::string16& rest, const base::Time& current_time, base::Time* result) { base::Time::Exploded time_exploded = { 0 }; @@ -272,13 +274,13 @@ bool FtpUtil::LsDateListingToTime(const string16& month, const string16& day, } // static -bool FtpUtil::WindowsDateListingToTime(const string16& date, - const string16& time, +bool FtpUtil::WindowsDateListingToTime(const base::string16& date, + const base::string16& time, base::Time* result) { base::Time::Exploded time_exploded = { 0 }; // Date should be in format MM-DD-YY[YY]. - std::vector<string16> date_parts; + std::vector<base::string16> date_parts; base::SplitString(date, '-', &date_parts); if (date_parts.size() != 3) return false; @@ -301,7 +303,7 @@ bool FtpUtil::WindowsDateListingToTime(const string16& date, if (time.length() < 5) return false; - std::vector<string16> time_parts; + std::vector<base::string16> time_parts; base::SplitString(time.substr(0, 5), ':', &time_parts); if (time_parts.size() != 2) return false; @@ -315,7 +317,7 @@ bool FtpUtil::WindowsDateListingToTime(const string16& date, if (time.length() > 5) { if (time.length() != 7) return false; - string16 am_or_pm(time.substr(5, 2)); + base::string16 am_or_pm(time.substr(5, 2)); if (EqualsASCII(am_or_pm, "PM")) { if (time_exploded.hour < 12) time_exploded.hour += 12; @@ -333,7 +335,8 @@ bool FtpUtil::WindowsDateListingToTime(const string16& date, } // static -string16 FtpUtil::GetStringPartAfterColumns(const string16& text, int columns) { +base::string16 FtpUtil::GetStringPartAfterColumns(const base::string16& text, + int columns) { base::i18n::UTF16CharIterator iter(&text); // TODO(jshin): Is u_isspace the right function to use here? @@ -347,7 +350,7 @@ string16 FtpUtil::GetStringPartAfterColumns(const string16& text, int columns) { iter.Advance(); } - string16 result(text.substr(iter.array_pos())); + base::string16 result(text.substr(iter.array_pos())); TrimWhitespace(result, TRIM_ALL, &result); return result; } diff --git a/net/ftp/ftp_util.h b/net/ftp/ftp_util.h index 41e9d5a..73e609e 100644 --- a/net/ftp/ftp_util.h +++ b/net/ftp/ftp_util.h @@ -30,26 +30,27 @@ class NET_EXPORT_PRIVATE FtpUtil { // Converts abbreviated month (like Nov) to its number (in range 1-12). // Note: in some locales abbreviations are more than three letters long, // and this function also handles them correctly. - static bool AbbreviatedMonthToNumber(const string16& text, int* number); + static bool AbbreviatedMonthToNumber(const base::string16& text, int* number); // Converts a "ls -l" date listing to time. The listing comes in three // columns. The first one contains month, the second one contains day // of month. The third one is either a time (and then we guess the year based // on |current_time|), or is a year (and then we don't know the time). - static bool LsDateListingToTime(const string16& month, - const string16& day, - const string16& rest, + static bool LsDateListingToTime(const base::string16& month, + const base::string16& day, + const base::string16& rest, const base::Time& current_time, base::Time* result); // Converts a Windows date listing to time. Returns true on success. - static bool WindowsDateListingToTime(const string16& date, - const string16& time, + static bool WindowsDateListingToTime(const base::string16& date, + const base::string16& time, base::Time* result); // Skips |columns| columns from |text| (whitespace-delimited), and returns the // remaining part, without leading/trailing whitespace. - static string16 GetStringPartAfterColumns(const string16& text, int columns); + static base::string16 GetStringPartAfterColumns(const base::string16& text, + int columns); }; } // namespace net diff --git a/net/http/http_auth_cache_unittest.cc b/net/http/http_auth_cache_unittest.cc index 286d44a..af3b25c 100644 --- a/net/http/http_auth_cache_unittest.cc +++ b/net/http/http_auth_cache_unittest.cc @@ -58,15 +58,15 @@ const char* kRealm2 = "Realm2"; const char* kRealm3 = "Realm3"; const char* kRealm4 = "Realm4"; const char* kRealm5 = "Realm5"; -const string16 k123(ASCIIToUTF16("123")); -const string16 k1234(ASCIIToUTF16("1234")); -const string16 kAdmin(ASCIIToUTF16("admin")); -const string16 kAlice(ASCIIToUTF16("alice")); -const string16 kAlice2(ASCIIToUTF16("alice2")); -const string16 kPassword(ASCIIToUTF16("password")); -const string16 kRoot(ASCIIToUTF16("root")); -const string16 kUsername(ASCIIToUTF16("username")); -const string16 kWileCoyote(ASCIIToUTF16("wilecoyote")); +const base::string16 k123(ASCIIToUTF16("123")); +const base::string16 k1234(ASCIIToUTF16("1234")); +const base::string16 kAdmin(ASCIIToUTF16("admin")); +const base::string16 kAlice(ASCIIToUTF16("alice")); +const base::string16 kAlice2(ASCIIToUTF16("alice2")); +const base::string16 kPassword(ASCIIToUTF16("password")); +const base::string16 kRoot(ASCIIToUTF16("root")); +const base::string16 kUsername(ASCIIToUTF16("username")); +const base::string16 kWileCoyote(ASCIIToUTF16("wilecoyote")); AuthCredentials CreateASCIICredentials(const char* username, const char* password) { diff --git a/net/http/http_auth_controller.cc b/net/http/http_auth_controller.cc index 0dcb5bb..ae39640 100644 --- a/net/http/http_auth_controller.cc +++ b/net/http/http_auth_controller.cc @@ -456,8 +456,8 @@ bool HttpAuthController::SelectNextAuthIdentityToTry() { identity_.source = HttpAuth::IDENT_SRC_URL; identity_.invalid = false; // Extract the username:password from the URL. - string16 username; - string16 password; + base::string16 username; + base::string16 password; GetIdentityFromURL(auth_url_, &username, &password); identity_.credentials.Set(username, password); embedded_identity_used_ = true; diff --git a/net/http/http_auth_controller_unittest.cc b/net/http/http_auth_controller_unittest.cc index a50d767..dd9c0c2 100644 --- a/net/http/http_auth_controller_unittest.cc +++ b/net/http/http_auth_controller_unittest.cc @@ -224,7 +224,8 @@ TEST(HttpAuthControllerTest, NoExplicitCredentialsAllowed) { ASSERT_EQ(OK, controller->HandleAuthChallenge(headers, false, false, dummy_log)); ASSERT_TRUE(controller->HaveAuthHandler()); - controller->ResetAuth(AuthCredentials(ASCIIToUTF16("Hello"), string16())); + controller->ResetAuth(AuthCredentials(ASCIIToUTF16("Hello"), + base::string16())); EXPECT_TRUE(controller->HaveAuth()); EXPECT_TRUE(controller->IsAuthSchemeDisabled(HttpAuth::AUTH_SCHEME_MOCK)); EXPECT_FALSE(controller->IsAuthSchemeDisabled(HttpAuth::AUTH_SCHEME_BASIC)); diff --git a/net/http/http_auth_filter.cc b/net/http/http_auth_filter.cc index 2109e4d..78e662e 100644 --- a/net/http/http_auth_filter.cc +++ b/net/http/http_auth_filter.cc @@ -9,7 +9,7 @@ namespace net { // Using a std::set<> has the benefit of removing duplicates automatically. -typedef std::set<string16> RegistryWhitelist; +typedef std::set<base::string16> RegistryWhitelist; // TODO(ahendrickson) -- Determine if we want separate whitelists for HTTP and // HTTPS, one for both, or only an HTTP one. My understanding is that the HTTPS diff --git a/net/http/http_auth_handler_ntlm.cc b/net/http/http_auth_handler_ntlm.cc index 964ae27..d404ce2 100644 --- a/net/http/http_auth_handler_ntlm.cc +++ b/net/http/http_auth_handler_ntlm.cc @@ -52,12 +52,12 @@ int HttpAuthHandlerNTLM::GenerateAuthTokenImpl( // The username may be in the form "DOMAIN\user". Parse it into the two // components. - string16 domain; - string16 user; - const string16& username = credentials->username(); + base::string16 domain; + base::string16 user; + const base::string16& username = credentials->username(); const char16 backslash_character = '\\'; size_t backslash_idx = username.find(backslash_character); - if (backslash_idx == string16::npos) { + if (backslash_idx == base::string16::npos) { user = username; } else { domain = username.substr(0, backslash_idx); diff --git a/net/http/http_auth_handler_ntlm.h b/net/http/http_auth_handler_ntlm.h index be60ae8..71534b9 100644 --- a/net/http/http_auth_handler_ntlm.h +++ b/net/http/http_auth_handler_ntlm.h @@ -156,7 +156,7 @@ class NET_EXPORT_PRIVATE HttpAuthHandlerNTLM : public HttpAuthHandler { static HostNameProc get_host_name_proc_; #endif - string16 domain_; + base::string16 domain_; AuthCredentials credentials_; // The base64-encoded string following "NTLM" in the "WWW-Authenticate" or diff --git a/net/http/http_auth_handler_ntlm_portable.cc b/net/http/http_auth_handler_ntlm_portable.cc index de7ed86..491a299a6 100644 --- a/net/http/http_auth_handler_ntlm_portable.cc +++ b/net/http/http_auth_handler_ntlm_portable.cc @@ -252,7 +252,7 @@ static uint32 ReadUint32(const uint8*& buf) { // // Note: This function is not being used because our SendLM() function always // returns false. -static void LM_Hash(const string16& password, uint8* hash) { +static void LM_Hash(const base::string16& password, uint8* hash) { static const uint8 LM_MAGIC[] = "KGS!@#$%"; // Convert password to OEM character set. We'll just use the native @@ -277,7 +277,7 @@ static void LM_Hash(const string16& password, uint8* hash) { // null-terminated unicode password. // param hash // 16-byte result buffer -static void NTLM_Hash(const string16& password, uint8* hash) { +static void NTLM_Hash(const base::string16& password, uint8* hash) { #ifdef IS_BIG_ENDIAN uint32 len = password.length(); uint8* passbuf; @@ -438,9 +438,9 @@ static void GenerateRandom(uint8* output, size_t n) { } // Returns OK or a network error code. -static int GenerateType3Msg(const string16& domain, - const string16& username, - const string16& password, +static int GenerateType3Msg(const base::string16& domain, + const base::string16& username, + const base::string16& password, const std::string& hostname, const void* rand_8_bytes, const void* in_buf, @@ -460,9 +460,9 @@ static int GenerateType3Msg(const string16& domain, // Temporary buffers for unicode strings #ifdef IS_BIG_ENDIAN - string16 ucs_domain_buf, ucs_user_buf; + base::string16 ucs_domain_buf, ucs_user_buf; #endif - string16 ucs_host_buf; + base::string16 ucs_host_buf; // Temporary buffers for oem strings std::string oem_domain_buf, oem_user_buf; // Pointers and lengths for the string buffers; encoding is unicode if diff --git a/net/http/http_auth_sspi_win.cc b/net/http/http_auth_sspi_win.cc index f4cbe9d..f3341e7 100644 --- a/net/http/http_auth_sspi_win.cc +++ b/net/http/http_auth_sspi_win.cc @@ -48,9 +48,9 @@ int MapAcquireCredentialsStatusToError(SECURITY_STATUS status, int AcquireExplicitCredentials(SSPILibrary* library, const SEC_WCHAR* package, - const string16& domain, - const string16& user, - const string16& password, + const base::string16& domain, + const base::string16& user, + const base::string16& password, CredHandle* cred) { SEC_WINNT_AUTH_IDENTITY identity; identity.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE; @@ -295,8 +295,8 @@ int HttpAuthSSPI::OnFirstRound(const AuthCredentials* credentials) { DCHECK(!SecIsValidHandle(&cred_)); int rv = OK; if (credentials) { - string16 domain; - string16 user; + base::string16 domain; + base::string16 user; SplitDomainAndUser(credentials->username(), &domain, &user); rv = AcquireExplicitCredentials(library_, security_package_, domain, user, credentials->password(), &cred_); @@ -390,14 +390,14 @@ int HttpAuthSSPI::GetNextSecurityToken( return OK; } -void SplitDomainAndUser(const string16& combined, - string16* domain, - string16* user) { +void SplitDomainAndUser(const base::string16& combined, + base::string16* domain, + base::string16* user) { // |combined| may be in the form "user" or "DOMAIN\user". // Separate the two parts if they exist. // TODO(cbentzel): I believe user@domain is also a valid form. size_t backslash_idx = combined.find(L'\\'); - if (backslash_idx == string16::npos) { + if (backslash_idx == base::string16::npos) { domain->clear(); *user = combined; } else { diff --git a/net/http/http_auth_sspi_win.h b/net/http/http_auth_sspi_win.h index a4fbedc..372f4bd 100644 --- a/net/http/http_auth_sspi_win.h +++ b/net/http/http_auth_sspi_win.h @@ -180,9 +180,9 @@ class NET_EXPORT_PRIVATE HttpAuthSSPI { // If |combined| is of form "bar", |domain| will be empty and |user| will // contain "bar". // |domain| and |user| must be non-NULL. -NET_EXPORT_PRIVATE void SplitDomainAndUser(const string16& combined, - string16* domain, - string16* user); +NET_EXPORT_PRIVATE void SplitDomainAndUser(const base::string16& combined, + base::string16* domain, + base::string16* user); // Determines the maximum token length in bytes for a particular SSPI package. // diff --git a/net/http/http_content_disposition.cc b/net/http/http_content_disposition.cc index 37335c0..b280bc1 100644 --- a/net/http/http_content_disposition.cc +++ b/net/http/http_content_disposition.cc @@ -108,7 +108,7 @@ bool DecodeWord(const std::string& encoded_word, if (IsStringUTF8(encoded_word)) { *output = encoded_word; } else { - string16 utf16_output; + base::string16 utf16_output; if (!referrer_charset.empty() && base::CodepageToUTF16(encoded_word, referrer_charset.c_str(), base::OnStringConversionError::FAIL, diff --git a/net/http/http_network_transaction_spdy2_unittest.cc b/net/http/http_network_transaction_spdy2_unittest.cc index e773011..ea45e12 100644 --- a/net/http/http_network_transaction_spdy2_unittest.cc +++ b/net/http/http_network_transaction_spdy2_unittest.cc @@ -69,18 +69,18 @@ using namespace net::test_spdy2; namespace { -const string16 kBar(ASCIIToUTF16("bar")); -const string16 kBar2(ASCIIToUTF16("bar2")); -const string16 kBar3(ASCIIToUTF16("bar3")); -const string16 kBaz(ASCIIToUTF16("baz")); -const string16 kFirst(ASCIIToUTF16("first")); -const string16 kFoo(ASCIIToUTF16("foo")); -const string16 kFoo2(ASCIIToUTF16("foo2")); -const string16 kFoo3(ASCIIToUTF16("foo3")); -const string16 kFou(ASCIIToUTF16("fou")); -const string16 kSecond(ASCIIToUTF16("second")); -const string16 kTestingNTLM(ASCIIToUTF16("testing-ntlm")); -const string16 kWrongPassword(ASCIIToUTF16("wrongpassword")); +const base::string16 kBar(ASCIIToUTF16("bar")); +const base::string16 kBar2(ASCIIToUTF16("bar2")); +const base::string16 kBar3(ASCIIToUTF16("bar3")); +const base::string16 kBaz(ASCIIToUTF16("baz")); +const base::string16 kFirst(ASCIIToUTF16("first")); +const base::string16 kFoo(ASCIIToUTF16("foo")); +const base::string16 kFoo2(ASCIIToUTF16("foo2")); +const base::string16 kFoo3(ASCIIToUTF16("foo3")); +const base::string16 kFou(ASCIIToUTF16("fou")); +const base::string16 kSecond(ASCIIToUTF16("second")); +const base::string16 kTestingNTLM(ASCIIToUTF16("testing-ntlm")); +const base::string16 kWrongPassword(ASCIIToUTF16("wrongpassword")); // MakeNextProtos is a utility function that returns a vector of std::strings // from its arguments. Don't forget to terminate the argument list with a NULL. diff --git a/net/http/http_network_transaction_spdy3_unittest.cc b/net/http/http_network_transaction_spdy3_unittest.cc index 8bc44db..095cfc5 100644 --- a/net/http/http_network_transaction_spdy3_unittest.cc +++ b/net/http/http_network_transaction_spdy3_unittest.cc @@ -69,18 +69,18 @@ using namespace net::test_spdy3; namespace { -const string16 kBar(ASCIIToUTF16("bar")); -const string16 kBar2(ASCIIToUTF16("bar2")); -const string16 kBar3(ASCIIToUTF16("bar3")); -const string16 kBaz(ASCIIToUTF16("baz")); -const string16 kFirst(ASCIIToUTF16("first")); -const string16 kFoo(ASCIIToUTF16("foo")); -const string16 kFoo2(ASCIIToUTF16("foo2")); -const string16 kFoo3(ASCIIToUTF16("foo3")); -const string16 kFou(ASCIIToUTF16("fou")); -const string16 kSecond(ASCIIToUTF16("second")); -const string16 kTestingNTLM(ASCIIToUTF16("testing-ntlm")); -const string16 kWrongPassword(ASCIIToUTF16("wrongpassword")); +const base::string16 kBar(ASCIIToUTF16("bar")); +const base::string16 kBar2(ASCIIToUTF16("bar2")); +const base::string16 kBar3(ASCIIToUTF16("bar3")); +const base::string16 kBaz(ASCIIToUTF16("baz")); +const base::string16 kFirst(ASCIIToUTF16("first")); +const base::string16 kFoo(ASCIIToUTF16("foo")); +const base::string16 kFoo2(ASCIIToUTF16("foo2")); +const base::string16 kFoo3(ASCIIToUTF16("foo3")); +const base::string16 kFou(ASCIIToUTF16("fou")); +const base::string16 kSecond(ASCIIToUTF16("second")); +const base::string16 kTestingNTLM(ASCIIToUTF16("testing-ntlm")); +const base::string16 kWrongPassword(ASCIIToUTF16("wrongpassword")); // MakeNextProtos is a utility function that returns a vector of std::strings // from its arguments. Don't forget to terminate the argument list with a NULL. diff --git a/net/http/http_proxy_client_socket_pool_spdy2_unittest.cc b/net/http/http_proxy_client_socket_pool_spdy2_unittest.cc index 53fa1f7..77ccbed 100644 --- a/net/http/http_proxy_client_socket_pool_spdy2_unittest.cc +++ b/net/http/http_proxy_client_socket_pool_spdy2_unittest.cc @@ -89,8 +89,8 @@ class HttpProxyClientSocketPoolSpdy2Test : public TestWithHttpParam { } void AddAuthToCache() { - const string16 kFoo(ASCIIToUTF16("foo")); - const string16 kBar(ASCIIToUTF16("bar")); + const base::string16 kFoo(ASCIIToUTF16("foo")); + const base::string16 kBar(ASCIIToUTF16("bar")); GURL proxy_url(GetParam() == HTTP ? "http://proxy" : "https://proxy:80"); session_->http_auth_cache()->Add(proxy_url, "MyRealm1", diff --git a/net/http/http_proxy_client_socket_pool_spdy3_unittest.cc b/net/http/http_proxy_client_socket_pool_spdy3_unittest.cc index b7f64b3..86924fc 100644 --- a/net/http/http_proxy_client_socket_pool_spdy3_unittest.cc +++ b/net/http/http_proxy_client_socket_pool_spdy3_unittest.cc @@ -89,8 +89,8 @@ class HttpProxyClientSocketPoolSpdy3Test : public TestWithHttpParam { } void AddAuthToCache() { - const string16 kFoo(ASCIIToUTF16("foo")); - const string16 kBar(ASCIIToUTF16("bar")); + const base::string16 kFoo(ASCIIToUTF16("foo")); + const base::string16 kBar(ASCIIToUTF16("bar")); GURL proxy_url(GetParam() == HTTP ? "http://proxy" : "https://proxy:80"); session_->http_auth_cache()->Add(proxy_url, "MyRealm1", diff --git a/net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc b/net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc index cc4eec8..8a405a7 100644 --- a/net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc +++ b/net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc @@ -53,7 +53,7 @@ void DhcpProxyScriptAdapterFetcher::Fetch( DCHECK(CalledOnValidThread()); DCHECK_EQ(state_, STATE_START); result_ = ERR_IO_PENDING; - pac_script_ = string16(); + pac_script_ = base::string16(); state_ = STATE_WAIT_DHCP; callback_ = callback; @@ -108,7 +108,7 @@ int DhcpProxyScriptAdapterFetcher::GetResult() const { return result_; } -string16 DhcpProxyScriptAdapterFetcher::GetPacScript() const { +base::string16 DhcpProxyScriptAdapterFetcher::GetPacScript() const { DCHECK(CalledOnValidThread()); return pac_script_; } diff --git a/net/proxy/dhcp_proxy_script_adapter_fetcher_win.h b/net/proxy/dhcp_proxy_script_adapter_fetcher_win.h index 913e271..d42a33d 100644 --- a/net/proxy/dhcp_proxy_script_adapter_fetcher_win.h +++ b/net/proxy/dhcp_proxy_script_adapter_fetcher_win.h @@ -58,7 +58,7 @@ class NET_EXPORT_PRIVATE DhcpProxyScriptAdapterFetcher // Returns the contents of the PAC file retrieved. Only valid if // |IsComplete()| is true. Returns the empty string if |GetResult()| // returns anything other than OK. - virtual string16 GetPacScript() const; + virtual base::string16 GetPacScript() const; // Returns the PAC URL retrieved from DHCP. Only guaranteed to be // valid if |IsComplete()| is true. Returns an empty URL if no URL was @@ -151,7 +151,7 @@ class NET_EXPORT_PRIVATE DhcpProxyScriptAdapterFetcher int result_; // Empty string or the PAC script downloaded. - string16 pac_script_; + base::string16 pac_script_; // Empty URL or the PAC URL configured in DHCP. GURL pac_url_; diff --git a/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc b/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc index b7dbe7c..1cb389a 100644 --- a/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc +++ b/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc @@ -152,7 +152,7 @@ class FetcherClient { TestCompletionCallback callback_; scoped_ptr<URLRequestContext> url_request_context_; scoped_ptr<MockDhcpProxyScriptAdapterFetcher> fetcher_; - string16 pac_text_; + base::string16 pac_text_; }; TEST(DhcpProxyScriptAdapterFetcher, NormalCaseURLNotInDhcp) { @@ -162,7 +162,7 @@ TEST(DhcpProxyScriptAdapterFetcher, NormalCaseURLNotInDhcp) { client.WaitForResult(ERR_PAC_NOT_IN_DHCP); ASSERT_TRUE(client.fetcher_->DidFinish()); EXPECT_EQ(ERR_PAC_NOT_IN_DHCP, client.fetcher_->GetResult()); - EXPECT_EQ(string16(L""), client.fetcher_->GetPacScript()); + EXPECT_EQ(base::string16(L""), client.fetcher_->GetPacScript()); } TEST(DhcpProxyScriptAdapterFetcher, NormalCaseURLInDhcp) { @@ -171,7 +171,7 @@ TEST(DhcpProxyScriptAdapterFetcher, NormalCaseURLInDhcp) { client.WaitForResult(OK); ASSERT_TRUE(client.fetcher_->DidFinish()); EXPECT_EQ(OK, client.fetcher_->GetResult()); - EXPECT_EQ(string16(L"bingo"), client.fetcher_->GetPacScript()); + EXPECT_EQ(base::string16(L"bingo"), client.fetcher_->GetPacScript()); EXPECT_EQ(GURL(kPacUrl), client.fetcher_->GetPacURL()); } @@ -194,7 +194,7 @@ TEST(DhcpProxyScriptAdapterFetcher, TimeoutDuringDhcp) { ASSERT_TRUE(client.fetcher_->DidFinish()); EXPECT_EQ(ERR_TIMED_OUT, client.fetcher_->GetResult()); - EXPECT_EQ(string16(L""), client.fetcher_->GetPacScript()); + EXPECT_EQ(base::string16(L""), client.fetcher_->GetPacScript()); EXPECT_EQ(GURL(), client.fetcher_->GetPacURL()); client.FinishTestAllowCleanup(); } @@ -207,7 +207,7 @@ TEST(DhcpProxyScriptAdapterFetcher, CancelWhileDhcp) { ASSERT_FALSE(client.fetcher_->DidFinish()); ASSERT_TRUE(client.fetcher_->WasCancelled()); EXPECT_EQ(ERR_ABORTED, client.fetcher_->GetResult()); - EXPECT_EQ(string16(L""), client.fetcher_->GetPacScript()); + EXPECT_EQ(base::string16(L""), client.fetcher_->GetPacScript()); EXPECT_EQ(GURL(), client.fetcher_->GetPacURL()); client.FinishTestAllowCleanup(); } @@ -228,7 +228,7 @@ TEST(DhcpProxyScriptAdapterFetcher, CancelWhileFetcher) { ASSERT_FALSE(client.fetcher_->DidFinish()); ASSERT_TRUE(client.fetcher_->WasCancelled()); EXPECT_EQ(ERR_ABORTED, client.fetcher_->GetResult()); - EXPECT_EQ(string16(L""), client.fetcher_->GetPacScript()); + EXPECT_EQ(base::string16(L""), client.fetcher_->GetPacScript()); // GetPacURL() still returns the URL fetched in this case. EXPECT_EQ(GURL(kPacUrl), client.fetcher_->GetPacURL()); client.FinishTestAllowCleanup(); @@ -243,7 +243,7 @@ TEST(DhcpProxyScriptAdapterFetcher, CancelAtCompletion) { // are identical expectations to the NormalCaseURLInDhcp test. ASSERT_TRUE(client.fetcher_->DidFinish()); EXPECT_EQ(OK, client.fetcher_->GetResult()); - EXPECT_EQ(string16(L"bingo"), client.fetcher_->GetPacScript()); + EXPECT_EQ(base::string16(L"bingo"), client.fetcher_->GetPacScript()); EXPECT_EQ(GURL(kPacUrl), client.fetcher_->GetPacURL()); client.FinishTestAllowCleanup(); } @@ -288,7 +288,8 @@ TEST(DhcpProxyScriptAdapterFetcher, MockDhcpRealFetch) { client.WaitForResult(OK); ASSERT_TRUE(client.fetcher_->DidFinish()); EXPECT_EQ(OK, client.fetcher_->GetResult()); - EXPECT_EQ(string16(L"-downloadable.pac-\n"), client.fetcher_->GetPacScript()); + EXPECT_EQ(base::string16(L"-downloadable.pac-\n"), + client.fetcher_->GetPacScript()); EXPECT_EQ(configured_url, client.fetcher_->GetPacURL()); } diff --git a/net/proxy/dhcp_proxy_script_fetcher.cc b/net/proxy/dhcp_proxy_script_fetcher.cc index ba2c137..4771d9d 100644 --- a/net/proxy/dhcp_proxy_script_fetcher.cc +++ b/net/proxy/dhcp_proxy_script_fetcher.cc @@ -21,7 +21,7 @@ DoNothingDhcpProxyScriptFetcher::DoNothingDhcpProxyScriptFetcher() {} DoNothingDhcpProxyScriptFetcher::~DoNothingDhcpProxyScriptFetcher() {} int DoNothingDhcpProxyScriptFetcher::Fetch( - string16* utf16_text, const CompletionCallback& callback) { + base::string16* utf16_text, const CompletionCallback& callback) { return ERR_NOT_IMPLEMENTED; } diff --git a/net/proxy/dhcp_proxy_script_fetcher.h b/net/proxy/dhcp_proxy_script_fetcher.h index 3130d7b..59e4522 100644 --- a/net/proxy/dhcp_proxy_script_fetcher.h +++ b/net/proxy/dhcp_proxy_script_fetcher.h @@ -56,7 +56,7 @@ class NET_EXPORT_PRIVATE DhcpProxyScriptFetcher { // deleting |this|), then no callback is invoked. // // Only one fetch is allowed to be outstanding at a time. - virtual int Fetch(string16* utf16_text, + virtual int Fetch(base::string16* utf16_text, const CompletionCallback& callback) = 0; // Aborts the in-progress fetch (if any). @@ -85,7 +85,7 @@ class NET_EXPORT_PRIVATE DoNothingDhcpProxyScriptFetcher DoNothingDhcpProxyScriptFetcher(); virtual ~DoNothingDhcpProxyScriptFetcher(); - virtual int Fetch(string16* utf16_text, + virtual int Fetch(base::string16* utf16_text, const CompletionCallback& callback) OVERRIDE; virtual void Cancel() OVERRIDE; virtual const GURL& GetPacURL() const OVERRIDE; diff --git a/net/proxy/dhcp_proxy_script_fetcher_win.cc b/net/proxy/dhcp_proxy_script_fetcher_win.cc index aa68c31..64f5117 100644 --- a/net/proxy/dhcp_proxy_script_fetcher_win.cc +++ b/net/proxy/dhcp_proxy_script_fetcher_win.cc @@ -54,7 +54,7 @@ DhcpProxyScriptFetcherWin::~DhcpProxyScriptFetcherWin() { base::SupportsWeakPtr<DhcpProxyScriptFetcherWin>::DetachFromThread(); } -int DhcpProxyScriptFetcherWin::Fetch(string16* utf16_text, +int DhcpProxyScriptFetcherWin::Fetch(base::string16* utf16_text, const CompletionCallback& callback) { DCHECK(CalledOnValidThread()); if (state_ != STATE_START && state_ != STATE_DONE) { diff --git a/net/proxy/dhcp_proxy_script_fetcher_win.h b/net/proxy/dhcp_proxy_script_fetcher_win.h index e123dfc..e6d9cfd 100644 --- a/net/proxy/dhcp_proxy_script_fetcher_win.h +++ b/net/proxy/dhcp_proxy_script_fetcher_win.h @@ -34,7 +34,7 @@ class NET_EXPORT_PRIVATE DhcpProxyScriptFetcherWin virtual ~DhcpProxyScriptFetcherWin(); // DhcpProxyScriptFetcher implementation. - int Fetch(string16* utf16_text, + int Fetch(base::string16* utf16_text, const net::CompletionCallback& callback) OVERRIDE; void Cancel() OVERRIDE; const GURL& GetPacURL() const OVERRIDE; @@ -146,7 +146,7 @@ class NET_EXPORT_PRIVATE DhcpProxyScriptFetcherWin // Pointer to string we will write results to. Not valid in states // START and DONE. - string16* destination_string_; + base::string16* destination_string_; // PAC URL retrieved from DHCP, if any. Valid only in state STATE_DONE. GURL pac_url_; diff --git a/net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc b/net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc index 7d474fc..6e54559 100644 --- a/net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc +++ b/net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc @@ -117,7 +117,7 @@ class RealFetchTester { scoped_ptr<URLRequestContext> context_; scoped_ptr<DhcpProxyScriptFetcherWin> fetcher_; bool finished_; - string16 pac_text_; + base::string16 pac_text_; base::OneShotTimer<RealFetchTester> timeout_; base::OneShotTimer<RealFetchTester> cancel_timer_; bool on_completion_is_error_; @@ -239,7 +239,7 @@ class DummyDhcpProxyScriptAdapterFetcher return result_; } - string16 GetPacScript() const OVERRIDE { + base::string16 GetPacScript() const OVERRIDE { return pac_script_; } @@ -247,8 +247,10 @@ class DummyDhcpProxyScriptAdapterFetcher callback_.Run(result_); } - void Configure( - bool did_finish, int result, string16 pac_script, int fetch_delay_ms) { + void Configure(bool did_finish, + int result, + base::string16 pac_script, + int fetch_delay_ms) { did_finish_ = did_finish; result_ = result; pac_script_ = pac_script; @@ -258,7 +260,7 @@ class DummyDhcpProxyScriptAdapterFetcher private: bool did_finish_; int result_; - string16 pac_script_; + base::string16 pac_script_; int fetch_delay_ms_; CompletionCallback callback_; base::OneShotTimer<DummyDhcpProxyScriptAdapterFetcher> timer_; @@ -307,7 +309,7 @@ class MockDhcpProxyScriptFetcherWin : public DhcpProxyScriptFetcherWin { void ConfigureAndPushBackAdapter(const std::string& adapter_name, bool did_finish, int result, - string16 pac_script, + base::string16 pac_script, base::TimeDelta fetch_delay) { scoped_ptr<DummyDhcpProxyScriptAdapterFetcher> adapter_fetcher( new DummyDhcpProxyScriptAdapterFetcher(url_request_context())); @@ -416,7 +418,7 @@ public: MockDhcpProxyScriptFetcherWin fetcher_; bool finished_; int result_; - string16 pac_text_; + base::string16 pac_text_; }; // We separate out each test's logic so that we can easily implement diff --git a/net/proxy/mock_proxy_script_fetcher.cc b/net/proxy/mock_proxy_script_fetcher.cc index c190aa2..de4245b 100644 --- a/net/proxy/mock_proxy_script_fetcher.cc +++ b/net/proxy/mock_proxy_script_fetcher.cc @@ -20,7 +20,7 @@ MockProxyScriptFetcher::MockProxyScriptFetcher() MockProxyScriptFetcher::~MockProxyScriptFetcher() {} // ProxyScriptFetcher implementation. -int MockProxyScriptFetcher::Fetch(const GURL& url, string16* text, +int MockProxyScriptFetcher::Fetch(const GURL& url, base::string16* text, const CompletionCallback& callback) { DCHECK(!has_pending_request()); diff --git a/net/proxy/mock_proxy_script_fetcher.h b/net/proxy/mock_proxy_script_fetcher.h index 12b963f..222cbf6 100644 --- a/net/proxy/mock_proxy_script_fetcher.h +++ b/net/proxy/mock_proxy_script_fetcher.h @@ -24,7 +24,7 @@ class MockProxyScriptFetcher : public ProxyScriptFetcher { // ProxyScriptFetcher implementation. virtual int Fetch(const GURL& url, - string16* text, + base::string16* text, const CompletionCallback& callback) OVERRIDE; virtual void Cancel() OVERRIDE; virtual URLRequestContext* GetRequestContext() const OVERRIDE; @@ -39,7 +39,7 @@ class MockProxyScriptFetcher : public ProxyScriptFetcher { private: GURL pending_request_url_; CompletionCallback pending_request_callback_; - string16* pending_request_text_; + base::string16* pending_request_text_; bool waiting_for_fetch_; }; diff --git a/net/proxy/network_delegate_error_observer.cc b/net/proxy/network_delegate_error_observer.cc index e2412b4..015003b 100644 --- a/net/proxy/network_delegate_error_observer.cc +++ b/net/proxy/network_delegate_error_observer.cc @@ -19,7 +19,7 @@ class NetworkDelegateErrorObserver::Core public: Core(NetworkDelegate* network_delegate, base::MessageLoopProxy* origin_loop); - void NotifyPACScriptError(int line_number, const string16& error); + void NotifyPACScriptError(int line_number, const base::string16& error); void Shutdown(); @@ -46,7 +46,7 @@ NetworkDelegateErrorObserver::Core::~Core() {} void NetworkDelegateErrorObserver::Core::NotifyPACScriptError( int line_number, - const string16& error) { + const base::string16& error) { if (!origin_loop_->BelongsToCurrentThread()) { origin_loop_->PostTask( FROM_HERE, @@ -73,8 +73,9 @@ NetworkDelegateErrorObserver::~NetworkDelegateErrorObserver() { core_->Shutdown(); } -void NetworkDelegateErrorObserver::OnPACScriptError(int line_number, - const string16& error) { +void NetworkDelegateErrorObserver::OnPACScriptError( + int line_number, + const base::string16& error) { core_->NotifyPACScriptError(line_number, error); } diff --git a/net/proxy/network_delegate_error_observer.h b/net/proxy/network_delegate_error_observer.h index 5e691f7..e4b03aa 100644 --- a/net/proxy/network_delegate_error_observer.h +++ b/net/proxy/network_delegate_error_observer.h @@ -27,7 +27,7 @@ class NET_EXPORT_PRIVATE NetworkDelegateErrorObserver virtual ~NetworkDelegateErrorObserver(); // ProxyResolverErrorObserver implementation. - virtual void OnPACScriptError(int line_number, const string16& error) + virtual void OnPACScriptError(int line_number, const base::string16& error) OVERRIDE; private: diff --git a/net/proxy/network_delegate_error_observer_unittest.cc b/net/proxy/network_delegate_error_observer_unittest.cc index b144f1e..2517291 100644 --- a/net/proxy/network_delegate_error_observer_unittest.cc +++ b/net/proxy/network_delegate_error_observer_unittest.cc @@ -53,7 +53,7 @@ class TestNetworkDelegate : public net::NetworkDelegate { virtual void OnURLRequestDestroyed(URLRequest* request) OVERRIDE {} virtual void OnPACScriptError(int line_number, - const string16& error) OVERRIDE { + const base::string16& error) OVERRIDE { got_pac_error_ = true; } virtual AuthRequiredResponse OnAuthRequired( @@ -105,7 +105,7 @@ TEST(NetworkDelegateErrorObserverTest, CallOnThread) { thread.message_loop()->PostTask( FROM_HERE, base::Bind(&NetworkDelegateErrorObserver::OnPACScriptError, - base::Unretained(&observer), 42, string16())); + base::Unretained(&observer), 42, base::string16())); thread.Stop(); MessageLoop::current()->RunUntilIdle(); ASSERT_TRUE(network_delegate.got_pac_error()); @@ -120,7 +120,7 @@ TEST(NetworkDelegateErrorObserverTest, NoDelegate) { thread.message_loop()->PostTask( FROM_HERE, base::Bind(&NetworkDelegateErrorObserver::OnPACScriptError, - base::Unretained(&observer), 42, string16())); + base::Unretained(&observer), 42, base::string16())); thread.Stop(); MessageLoop::current()->RunUntilIdle(); // Shouldn't have crashed until here... diff --git a/net/proxy/proxy_resolver_error_observer.h b/net/proxy/proxy_resolver_error_observer.h index 6ee9cbb..dda42ed 100644 --- a/net/proxy/proxy_resolver_error_observer.h +++ b/net/proxy/proxy_resolver_error_observer.h @@ -25,7 +25,8 @@ class NET_EXPORT_PRIVATE ProxyResolverErrorObserver { // backing proxy resolver is ProxyResolverV8Tracing, then it will not // be called concurrently, however it will be called from a different // thread than the proxy resolver's origin thread. - virtual void OnPACScriptError(int line_number, const string16& error) = 0; + virtual void OnPACScriptError(int line_number, + const base::string16& error) = 0; private: DISALLOW_COPY_AND_ASSIGN(ProxyResolverErrorObserver); diff --git a/net/proxy/proxy_resolver_perftest.cc b/net/proxy/proxy_resolver_perftest.cc index aa25d51..4492120 100644 --- a/net/proxy/proxy_resolver_perftest.cc +++ b/net/proxy/proxy_resolver_perftest.cc @@ -199,7 +199,7 @@ class MockJSBindings : public net::ProxyResolverV8::JSBindings { public: MockJSBindings() {} - virtual void Alert(const string16& message) OVERRIDE { + virtual void Alert(const base::string16& message) OVERRIDE { CHECK(false); } @@ -211,7 +211,8 @@ class MockJSBindings : public net::ProxyResolverV8::JSBindings { return false; } - virtual void OnError(int line_number, const string16& message) OVERRIDE { + virtual void OnError(int line_number, + const base::string16& message) OVERRIDE { CHECK(false); } }; diff --git a/net/proxy/proxy_resolver_script_data.cc b/net/proxy/proxy_resolver_script_data.cc index dbe1e32..fffaed3 100644 --- a/net/proxy/proxy_resolver_script_data.cc +++ b/net/proxy/proxy_resolver_script_data.cc @@ -19,23 +19,24 @@ scoped_refptr<ProxyResolverScriptData> ProxyResolverScriptData::FromUTF8( // static scoped_refptr<ProxyResolverScriptData> ProxyResolverScriptData::FromUTF16( - const string16& utf16) { + const base::string16& utf16) { return new ProxyResolverScriptData(TYPE_SCRIPT_CONTENTS, GURL(), utf16); } // static scoped_refptr<ProxyResolverScriptData> ProxyResolverScriptData::FromURL( const GURL& url) { - return new ProxyResolverScriptData(TYPE_SCRIPT_URL, url, string16()); + return new ProxyResolverScriptData(TYPE_SCRIPT_URL, url, base::string16()); } // static scoped_refptr<ProxyResolverScriptData> ProxyResolverScriptData::ForAutoDetect() { - return new ProxyResolverScriptData(TYPE_AUTO_DETECT, GURL(), string16()); + return new ProxyResolverScriptData(TYPE_AUTO_DETECT, GURL(), + base::string16()); } -const string16& ProxyResolverScriptData::utf16() const { +const base::string16& ProxyResolverScriptData::utf16() const { DCHECK_EQ(TYPE_SCRIPT_CONTENTS, type_); return utf16_; } @@ -64,7 +65,7 @@ bool ProxyResolverScriptData::Equals( ProxyResolverScriptData::ProxyResolverScriptData(Type type, const GURL& url, - const string16& utf16) + const base::string16& utf16) : type_(type), url_(url), utf16_(utf16) { diff --git a/net/proxy/proxy_resolver_script_data.h b/net/proxy/proxy_resolver_script_data.h index 1bfcc1a..e91839b 100644 --- a/net/proxy/proxy_resolver_script_data.h +++ b/net/proxy/proxy_resolver_script_data.h @@ -33,7 +33,7 @@ class NET_EXPORT_PRIVATE ProxyResolverScriptData // Creates a script data given the UTF16 bytes of the content. static scoped_refptr<ProxyResolverScriptData> FromUTF16( - const string16& utf16); + const base::string16& utf16); // Creates a script data given a URL to the PAC script. static scoped_refptr<ProxyResolverScriptData> FromURL(const GURL& url); @@ -47,7 +47,7 @@ class NET_EXPORT_PRIVATE ProxyResolverScriptData // Returns the contents of the script as UTF16. // (only valid for type() == TYPE_SCRIPT_CONTENTS). - const string16& utf16() const; + const base::string16& utf16() const; // Returns the URL of the script. // (only valid for type() == TYPE_SCRIPT_URL). @@ -60,13 +60,13 @@ class NET_EXPORT_PRIVATE ProxyResolverScriptData friend class base::RefCountedThreadSafe<ProxyResolverScriptData>; ProxyResolverScriptData(Type type, const GURL& url, - const string16& utf16); + const base::string16& utf16); virtual ~ProxyResolverScriptData(); const Type type_; const GURL url_; - const string16 utf16_; + const base::string16 utf16_; }; } // namespace net diff --git a/net/proxy/proxy_resolver_v8.cc b/net/proxy/proxy_resolver_v8.cc index 2620252..7a2492a 100644 --- a/net/proxy/proxy_resolver_v8.cc +++ b/net/proxy/proxy_resolver_v8.cc @@ -143,10 +143,10 @@ std::string V8StringToUTF8(v8::Handle<v8::String> s) { return result; } -// Converts a V8 String to a UTF16 string16. -string16 V8StringToUTF16(v8::Handle<v8::String> s) { +// Converts a V8 String to a UTF16 base::string16. +base::string16 V8StringToUTF16(v8::Handle<v8::String> s) { int len = s->Length(); - string16 result; + base::string16 result; // Note that the reinterpret cast is because on Windows string16 is an alias // to wstring, and hence has character type wchar_t not uint16_t. if (len > 0) @@ -160,7 +160,7 @@ v8::Local<v8::String> ASCIIStringToV8String(const std::string& s) { return v8::String::New(s.data(), s.size()); } -// Converts a UTF16 string16 (warpped by a ProxyResolverScriptData) to a +// Converts a UTF16 base::string16 (warpped by a ProxyResolverScriptData) to a // V8 string. v8::Local<v8::String> ScriptDataToV8String( const scoped_refptr<ProxyResolverScriptData>& s) { @@ -184,7 +184,7 @@ v8::Local<v8::String> ASCIILiteralToV8String(const char* ascii) { // Stringizes a V8 object by calling its toString() method. Returns true // on success. This may fail if the toString() throws an exception. bool V8ObjectToUTF16String(v8::Handle<v8::Value> object, - string16* utf16_result) { + base::string16* utf16_result) { if (object.IsEmpty()) return false; @@ -203,7 +203,7 @@ bool GetHostnameArgument(const v8::Arguments& args, std::string* hostname) { if (args.Length() == 0 || args[0].IsEmpty() || !args[0]->IsString()) return false; - const string16 hostname_utf16 = V8StringToUTF16(args[0]->ToString()); + const base::string16 hostname_utf16 = V8StringToUTF16(args[0]->ToString()); // If the hostname is already in ASCII, simply return it as is. if (IsStringASCII(hostname_utf16)) { @@ -382,14 +382,14 @@ class ProxyResolverV8::Context { return ERR_PAC_SCRIPT_FAILED; } - string16 ret_str = V8StringToUTF16(ret->ToString()); + base::string16 ret_str = V8StringToUTF16(ret->ToString()); if (!IsStringASCII(ret_str)) { // TODO(eroman): Rather than failing when a wide string is returned, we // could extend the parsing to handle IDNA hostnames by // converting them to ASCII punycode. // crbug.com/47234 - string16 error_message = + base::string16 error_message = ASCIIToUTF16("FindProxyForURL() returned a non-ASCII string " "(crbug.com/47234): ") + ret_str; js_bindings()->OnError(-1, error_message); @@ -493,7 +493,7 @@ class ProxyResolverV8::Context { // Handle an exception thrown by V8. void HandleError(v8::Handle<v8::Message> message) { - string16 error_message; + base::string16 error_message; int line_number = -1; if (!message.IsEmpty()) { @@ -534,7 +534,7 @@ class ProxyResolverV8::Context { // Like firefox we assume "undefined" if no argument was specified, and // disregard any arguments beyond the first. - string16 message; + base::string16 message; if (args.Length() == 0) { message = ASCIIToUTF16("undefined"); } else { diff --git a/net/proxy/proxy_resolver_v8.h b/net/proxy/proxy_resolver_v8.h index 4b5760b..c6dbdd4 100644 --- a/net/proxy/proxy_resolver_v8.h +++ b/net/proxy/proxy_resolver_v8.h @@ -59,11 +59,11 @@ class NET_EXPORT_PRIVATE ProxyResolverV8 : public ProxyResolver { bool* terminate) = 0; // Handler for "alert(message)" - virtual void Alert(const string16& message) = 0; + virtual void Alert(const base::string16& message) = 0; // Handler for when an error is encountered. |line_number| may be -1 // if a line number is not applicable to this error. - virtual void OnError(int line_number, const string16& error) = 0; + virtual void OnError(int line_number, const base::string16& error) = 0; protected: virtual ~JSBindings() {} diff --git a/net/proxy/proxy_resolver_v8_tracing.cc b/net/proxy/proxy_resolver_v8_tracing.cc index a453768..ddd82a5 100644 --- a/net/proxy/proxy_resolver_v8_tracing.cc +++ b/net/proxy/proxy_resolver_v8_tracing.cc @@ -56,7 +56,7 @@ const size_t kMaxAlertsAndErrorsBytes = 2048; // Returns event parameters for a PAC error message (line number + message). base::Value* NetLogErrorCallback(int line_number, - const string16* message, + const base::string16* message, NetLog::LogLevel /* log_level */) { base::DictionaryValue* dict = new base::DictionaryValue(); dict->SetInteger("line_number", line_number); @@ -122,7 +122,7 @@ class ProxyResolverV8Tracing::Job struct AlertOrError { bool is_alert; int line_number; - string16 message; + base::string16 message; }; virtual ~Job(); @@ -157,8 +157,8 @@ class ProxyResolverV8Tracing::Job ResolveDnsOperation op, std::string* output, bool* terminate) OVERRIDE; - virtual void Alert(const string16& message) OVERRIDE; - virtual void OnError(int line_number, const string16& error) OVERRIDE; + virtual void Alert(const base::string16& message) OVERRIDE; + virtual void OnError(int line_number, const base::string16& error) OVERRIDE; bool ResolveDnsBlocking(const std::string& host, ResolveDnsOperation op, @@ -195,10 +195,10 @@ class ProxyResolverV8Tracing::Job ResolveDnsOperation op); void HandleAlertOrError(bool is_alert, int line_number, - const string16& message); + const base::string16& message); void DispatchBufferedAlertsAndErrors(); void DispatchAlertOrError(bool is_alert, int line_number, - const string16& message); + const base::string16& message); void LogEventToCurrentRequestAndGlobally( NetLog::EventType type, @@ -687,12 +687,12 @@ bool ProxyResolverV8Tracing::Job::ResolveDns(const std::string& host, ResolveDnsNonBlocking(host, op, output, terminate); } -void ProxyResolverV8Tracing::Job::Alert(const string16& message) { +void ProxyResolverV8Tracing::Job::Alert(const base::string16& message) { HandleAlertOrError(true, -1, message); } void ProxyResolverV8Tracing::Job::OnError(int line_number, - const string16& error) { + const base::string16& error) { HandleAlertOrError(false, line_number, error); } @@ -956,9 +956,10 @@ std::string ProxyResolverV8Tracing::Job::MakeDnsCacheKey( return base::StringPrintf("%d:%s", op, host.c_str()); } -void ProxyResolverV8Tracing::Job::HandleAlertOrError(bool is_alert, - int line_number, - const string16& message) { +void ProxyResolverV8Tracing::Job::HandleAlertOrError( + bool is_alert, + int line_number, + const base::string16& message) { CheckIsOnWorkerThread(); if (cancelled_.IsSet()) @@ -1002,7 +1003,7 @@ void ProxyResolverV8Tracing::Job::DispatchBufferedAlertsAndErrors() { } void ProxyResolverV8Tracing::Job::DispatchAlertOrError( - bool is_alert, int line_number, const string16& message) { + bool is_alert, int line_number, const base::string16& message) { CheckIsOnWorkerThread(); // Note that the handling of cancellation is racy with regard to diff --git a/net/proxy/proxy_resolver_v8_tracing_unittest.cc b/net/proxy/proxy_resolver_v8_tracing_unittest.cc index d3b15c3..b5503e5 100644 --- a/net/proxy/proxy_resolver_v8_tracing_unittest.cc +++ b/net/proxy/proxy_resolver_v8_tracing_unittest.cc @@ -71,7 +71,7 @@ class MockErrorObserver : public ProxyResolverErrorObserver { MockErrorObserver() : event_(true, false) {} virtual void OnPACScriptError(int line_number, - const string16& error) OVERRIDE { + const base::string16& error) OVERRIDE { { base::AutoLock l(lock_); output += base::StringPrintf("Error: line %d: %s\n", line_number, diff --git a/net/proxy/proxy_resolver_v8_unittest.cc b/net/proxy/proxy_resolver_v8_unittest.cc index 250aaf3..eb50e35 100644 --- a/net/proxy/proxy_resolver_v8_unittest.cc +++ b/net/proxy/proxy_resolver_v8_unittest.cc @@ -26,7 +26,7 @@ class MockJSBindings : public ProxyResolverV8::JSBindings { MockJSBindings() : my_ip_address_count(0), my_ip_address_ex_count(0), should_terminate(false) {} - virtual void Alert(const string16& message) OVERRIDE { + virtual void Alert(const base::string16& message) OVERRIDE { VLOG(1) << "PAC-alert: " << message; // Helpful when debugging. alerts.push_back(UTF16ToUTF8(message)); } @@ -65,7 +65,8 @@ class MockJSBindings : public ProxyResolverV8::JSBindings { return false; } - virtual void OnError(int line_number, const string16& message) OVERRIDE { + virtual void OnError(int line_number, + const base::string16& message) OVERRIDE { // Helpful when debugging. VLOG(1) << "PAC-error: [" << line_number << "] " << message; @@ -388,7 +389,8 @@ TEST(ProxyResolverV8Test, NoSetPacScript) { // Clear it, by initializing with an empty string. resolver.SetPacScript( - ProxyResolverScriptData::FromUTF16(string16()), CompletionCallback()); + ProxyResolverScriptData::FromUTF16(base::string16()), + CompletionCallback()); // Resolve should fail again now. result = resolver.GetProxyForURL( diff --git a/net/proxy/proxy_script_decider.cc b/net/proxy/proxy_script_decider.cc index 21e3ae0..e71712a 100644 --- a/net/proxy/proxy_script_decider.cc +++ b/net/proxy/proxy_script_decider.cc @@ -21,14 +21,14 @@ namespace net { namespace { -bool LooksLikePacScript(const string16& script) { +bool LooksLikePacScript(const base::string16& script) { // Note: this is only an approximation! It may not always work correctly, // however it is very likely that legitimate scripts have this exact string, // since they must minimally define a function of this name. Conversely, a // file not containing the string is not likely to be a PAC script. // // An exact test would have to load the script in a javascript evaluator. - return script.find(ASCIIToUTF16("FindProxyForURL")) != string16::npos; + return script.find(ASCIIToUTF16("FindProxyForURL")) != base::string16::npos; } } diff --git a/net/proxy/proxy_script_decider.h b/net/proxy/proxy_script_decider.h index a000c88..549481d 100644 --- a/net/proxy/proxy_script_decider.h +++ b/net/proxy/proxy_script_decider.h @@ -155,7 +155,7 @@ class NET_EXPORT_PRIVATE ProxyScriptDecider { size_t current_pac_source_index_; // Filled when the PAC script fetch completes. - string16 pac_script_; + base::string16 pac_script_; // Flag indicating whether the caller requested a mandatory pac script // (i.e. fallback to direct connections are prohibited). diff --git a/net/proxy/proxy_script_decider_unittest.cc b/net/proxy/proxy_script_decider_unittest.cc index 82f01d8..1517596 100644 --- a/net/proxy/proxy_script_decider_unittest.cc +++ b/net/proxy/proxy_script_decider_unittest.cc @@ -38,12 +38,12 @@ class Rules { is_valid_script(is_valid_script) { } - string16 text() const { + base::string16 text() const { if (is_valid_script) return UTF8ToUTF16(url.spec() + "!FindProxyForURL"); if (fetch_error == OK) return UTF8ToUTF16(url.spec() + "!invalid-script"); - return string16(); + return base::string16(); } GURL url; @@ -76,7 +76,7 @@ class Rules { return rules_[0]; } - const Rule& GetRuleByText(const string16& text) const { + const Rule& GetRuleByText(const base::string16& text) const { for (RuleList::const_iterator it = rules_.begin(); it != rules_.end(); ++it) { if (it->text() == text) @@ -97,7 +97,7 @@ class RuleBasedProxyScriptFetcher : public ProxyScriptFetcher { // ProxyScriptFetcher implementation. virtual int Fetch(const GURL& url, - string16* text, + base::string16* text, const CompletionCallback& callback) OVERRIDE { const Rules::Rule& rule = rules_->GetRuleByUrl(url); int rv = rule.fetch_error; @@ -453,11 +453,11 @@ TEST(ProxyScriptDeciderTest, CustomPacFails1_WithNegativeDelay) { class SynchronousSuccessDhcpFetcher : public DhcpProxyScriptFetcher { public: - explicit SynchronousSuccessDhcpFetcher(const string16& expected_text) + explicit SynchronousSuccessDhcpFetcher(const base::string16& expected_text) : gurl_("http://dhcppac/"), expected_text_(expected_text) { } - virtual int Fetch(string16* utf16_text, + virtual int Fetch(base::string16* utf16_text, const CompletionCallback& callback) OVERRIDE { *utf16_text = expected_text_; return OK; @@ -470,13 +470,13 @@ class SynchronousSuccessDhcpFetcher : public DhcpProxyScriptFetcher { return gurl_; } - const string16& expected_text() const { + const base::string16& expected_text() const { return expected_text_; } private: GURL gurl_; - string16 expected_text_; + base::string16 expected_text_; DISALLOW_COPY_AND_ASSIGN(SynchronousSuccessDhcpFetcher); }; @@ -539,7 +539,7 @@ class AsyncFailDhcpFetcher AsyncFailDhcpFetcher() {} virtual ~AsyncFailDhcpFetcher() {} - virtual int Fetch(string16* utf16_text, + virtual int Fetch(base::string16* utf16_text, const CompletionCallback& callback) OVERRIDE { callback_ = callback; MessageLoop::current()->PostTask( diff --git a/net/proxy/proxy_script_fetcher.h b/net/proxy/proxy_script_fetcher.h index b472fd8..daf90d3 100644 --- a/net/proxy/proxy_script_fetcher.h +++ b/net/proxy/proxy_script_fetcher.h @@ -44,7 +44,7 @@ class NET_EXPORT_PRIVATE ProxyScriptFetcher { // deleting |this|), then no callback is invoked. // // Only one fetch is allowed to be outstanding at a time. - virtual int Fetch(const GURL& url, string16* utf16_text, + virtual int Fetch(const GURL& url, base::string16* utf16_text, const net::CompletionCallback& callback) = 0; // Aborts the in-progress fetch (if any). diff --git a/net/proxy/proxy_script_fetcher_impl.cc b/net/proxy/proxy_script_fetcher_impl.cc index 6c1b4f2..a61a649 100644 --- a/net/proxy/proxy_script_fetcher_impl.cc +++ b/net/proxy/proxy_script_fetcher_impl.cc @@ -50,7 +50,7 @@ bool IsPacMimeType(const std::string& mime_type) { // If |charset| is empty, then we don't know what it was and guess. void ConvertResponseToUTF16(const std::string& charset, const std::string& bytes, - string16* utf16) { + base::string16* utf16) { const char* codepage; if (charset.empty()) { @@ -116,7 +116,7 @@ void ProxyScriptFetcherImpl::OnResponseCompleted(URLRequest* request) { } int ProxyScriptFetcherImpl::Fetch( - const GURL& url, string16* text, const CompletionCallback& callback) { + const GURL& url, base::string16* text, const CompletionCallback& callback) { // It is invalid to call Fetch() while a request is already in progress. DCHECK(!cur_request_.get()); DCHECK(!callback.is_null()); diff --git a/net/proxy/proxy_script_fetcher_impl.h b/net/proxy/proxy_script_fetcher_impl.h index 7ce4d35b..a3dd517 100644 --- a/net/proxy/proxy_script_fetcher_impl.h +++ b/net/proxy/proxy_script_fetcher_impl.h @@ -45,7 +45,7 @@ class NET_EXPORT ProxyScriptFetcherImpl : public ProxyScriptFetcher, void OnResponseCompleted(URLRequest* request); // ProxyScriptFetcher methods: - virtual int Fetch(const GURL& url, string16* text, + virtual int Fetch(const GURL& url, base::string16* text, const net::CompletionCallback& callback) OVERRIDE; virtual void Cancel() OVERRIDE; virtual URLRequestContext* GetRequestContext() const OVERRIDE; @@ -111,7 +111,7 @@ class NET_EXPORT ProxyScriptFetcherImpl : public ProxyScriptFetcher, // This buffer is owned by the owner of |callback|, and will be filled with // UTF16 response on completion. - string16* result_text_; + base::string16* result_text_; // The maximum number of bytes to allow in responses. size_t max_response_bytes_; diff --git a/net/proxy/proxy_script_fetcher_impl_unittest.cc b/net/proxy/proxy_script_fetcher_impl_unittest.cc index 19c6246..0c414de 100644 --- a/net/proxy/proxy_script_fetcher_impl_unittest.cc +++ b/net/proxy/proxy_script_fetcher_impl_unittest.cc @@ -41,7 +41,7 @@ const base::FilePath::CharType kDocRoot[] = struct FetchResult { int code; - string16 text; + base::string16 text; }; // A non-mock URL request which can access http:// and file:// urls. @@ -135,7 +135,7 @@ class BasicNetworkDelegate : public NetworkDelegate { virtual void OnURLRequestDestroyed(URLRequest* request) OVERRIDE {} virtual void OnPACScriptError(int line_number, - const string16& error) OVERRIDE {} + const base::string16& error) OVERRIDE {} virtual NetworkDelegate::AuthRequiredResponse OnAuthRequired( URLRequest* request, @@ -198,7 +198,7 @@ TEST_F(ProxyScriptFetcherImplTest, FileUrl) { ProxyScriptFetcherImpl pac_fetcher(&context_); { // Fetch a non-existent file. - string16 text; + base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(GetTestFileUrl("does-not-exist"), &text, callback.callback()); @@ -207,7 +207,7 @@ TEST_F(ProxyScriptFetcherImplTest, FileUrl) { EXPECT_TRUE(text.empty()); } { // Fetch a file that exists. - string16 text; + base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(GetTestFileUrl("pac.txt"), &text, callback.callback()); @@ -226,7 +226,7 @@ TEST_F(ProxyScriptFetcherImplTest, HttpMimeType) { { // Fetch a PAC with mime type "text/plain" GURL url(test_server_.GetURL("files/pac.txt")); - string16 text; + base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); EXPECT_EQ(ERR_IO_PENDING, result); @@ -235,7 +235,7 @@ TEST_F(ProxyScriptFetcherImplTest, HttpMimeType) { } { // Fetch a PAC with mime type "text/html" GURL url(test_server_.GetURL("files/pac.html")); - string16 text; + base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); EXPECT_EQ(ERR_IO_PENDING, result); @@ -244,7 +244,7 @@ TEST_F(ProxyScriptFetcherImplTest, HttpMimeType) { } { // Fetch a PAC with mime type "application/x-ns-proxy-autoconfig" GURL url(test_server_.GetURL("files/pac.nsproxy")); - string16 text; + base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); EXPECT_EQ(ERR_IO_PENDING, result); @@ -260,7 +260,7 @@ TEST_F(ProxyScriptFetcherImplTest, HttpStatusCode) { { // Fetch a PAC which gives a 500 -- FAIL GURL url(test_server_.GetURL("files/500.pac")); - string16 text; + base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); EXPECT_EQ(ERR_IO_PENDING, result); @@ -269,7 +269,7 @@ TEST_F(ProxyScriptFetcherImplTest, HttpStatusCode) { } { // Fetch a PAC which gives a 404 -- FAIL GURL url(test_server_.GetURL("files/404.pac")); - string16 text; + base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); EXPECT_EQ(ERR_IO_PENDING, result); @@ -286,7 +286,7 @@ TEST_F(ProxyScriptFetcherImplTest, ContentDisposition) { // Fetch PAC scripts via HTTP with a Content-Disposition header -- should // have no effect. GURL url(test_server_.GetURL("files/downloadable.pac")); - string16 text; + base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); EXPECT_EQ(ERR_IO_PENDING, result); @@ -303,7 +303,7 @@ TEST_F(ProxyScriptFetcherImplTest, NoCache) { // Fetch a PAC script whose HTTP headers make it cacheable for 1 hour. GURL url(test_server_.GetURL("files/cacheable_1hr.pac")); { - string16 text; + base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); EXPECT_EQ(ERR_IO_PENDING, result); @@ -318,7 +318,7 @@ TEST_F(ProxyScriptFetcherImplTest, NoCache) { // call should fail, thus indicating that the file was not fetched from the // local cache. { - string16 text; + base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); EXPECT_EQ(ERR_IO_PENDING, result); @@ -353,7 +353,7 @@ TEST_F(ProxyScriptFetcherImplTest, TooLarge) { // after 50 bytes have been read, and fail with a too large error. for (size_t i = 0; i < arraysize(urls); ++i) { const GURL& url = urls[i]; - string16 text; + base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); EXPECT_EQ(ERR_IO_PENDING, result); @@ -366,7 +366,7 @@ TEST_F(ProxyScriptFetcherImplTest, TooLarge) { { // Make sure we can still fetch regular URLs. GURL url(test_server_.GetURL("files/pac.nsproxy")); - string16 text; + base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); EXPECT_EQ(ERR_IO_PENDING, result); @@ -388,7 +388,7 @@ TEST_F(ProxyScriptFetcherImplTest, Hang) { // after 500 ms, and fail with a timeout error. { GURL url(test_server_.GetURL("slow/proxy.pac?1.2")); - string16 text; + base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); EXPECT_EQ(ERR_IO_PENDING, result); @@ -401,7 +401,7 @@ TEST_F(ProxyScriptFetcherImplTest, Hang) { { // Make sure we can still fetch regular URLs. GURL url(test_server_.GetURL("files/pac.nsproxy")); - string16 text; + base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); EXPECT_EQ(ERR_IO_PENDING, result); @@ -421,7 +421,7 @@ TEST_F(ProxyScriptFetcherImplTest, Encodings) { // Test a response that is gzip-encoded -- should get inflated. { GURL url(test_server_.GetURL("files/gzipped_pac")); - string16 text; + base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); EXPECT_EQ(ERR_IO_PENDING, result); @@ -433,7 +433,7 @@ TEST_F(ProxyScriptFetcherImplTest, Encodings) { // be converted to UTF8. { GURL url(test_server_.GetURL("files/utf16be_pac")); - string16 text; + base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); EXPECT_EQ(ERR_IO_PENDING, result); @@ -459,7 +459,7 @@ TEST_F(ProxyScriptFetcherImplTest, DataURLs) { // Test fetching a "data:"-url containing a base64 encoded PAC script. { GURL url(kEncodedUrl); - string16 text; + base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); EXPECT_EQ(OK, result); @@ -472,7 +472,7 @@ TEST_F(ProxyScriptFetcherImplTest, DataURLs) { // Test a broken "data:"-url containing a base64 encoded PAC script. { GURL url(kEncodedUrlBroken); - string16 text; + base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); EXPECT_EQ(ERR_FAILED, result); diff --git a/net/socket/ssl_client_socket_pool_unittest.cc b/net/socket/ssl_client_socket_pool_unittest.cc index 4d52729..085c341 100644 --- a/net/socket/ssl_client_socket_pool_unittest.cc +++ b/net/socket/ssl_client_socket_pool_unittest.cc @@ -159,8 +159,8 @@ class SSLClientSocketPoolTest : public testing::Test { } void AddAuthToCache() { - const string16 kFoo(ASCIIToUTF16("foo")); - const string16 kBar(ASCIIToUTF16("bar")); + const base::string16 kFoo(ASCIIToUTF16("foo")); + const base::string16 kBar(ASCIIToUTF16("bar")); session_->http_auth_cache()->Add(GURL("http://proxy:443/"), "MyRealm1", HttpAuth::AUTH_SCHEME_BASIC, diff --git a/net/spdy/spdy_proxy_client_socket_spdy2_unittest.cc b/net/spdy/spdy_proxy_client_socket_spdy2_unittest.cc index d6117ab..a03d465 100644 --- a/net/spdy/spdy_proxy_client_socket_spdy2_unittest.cc +++ b/net/spdy/spdy_proxy_client_socket_spdy2_unittest.cc @@ -93,8 +93,8 @@ class SpdyProxyClientSocketSpdy2Test : public PlatformTest { int num_reads); void AddAuthToCache() { - const string16 kFoo(ASCIIToUTF16("foo")); - const string16 kBar(ASCIIToUTF16("bar")); + const base::string16 kFoo(ASCIIToUTF16("foo")); + const base::string16 kBar(ASCIIToUTF16("bar")); session_->http_auth_cache()->Add(GURL(kProxyUrl), "MyRealm1", HttpAuth::AUTH_SCHEME_BASIC, diff --git a/net/spdy/spdy_proxy_client_socket_spdy3_unittest.cc b/net/spdy/spdy_proxy_client_socket_spdy3_unittest.cc index 5dac149..84a4581 100644 --- a/net/spdy/spdy_proxy_client_socket_spdy3_unittest.cc +++ b/net/spdy/spdy_proxy_client_socket_spdy3_unittest.cc @@ -93,8 +93,8 @@ class SpdyProxyClientSocketSpdy3Test : public PlatformTest { int num_reads); void AddAuthToCache() { - const string16 kFoo(ASCIIToUTF16("foo")); - const string16 kBar(ASCIIToUTF16("bar")); + const base::string16 kFoo(ASCIIToUTF16("foo")); + const base::string16 kBar(ASCIIToUTF16("bar")); session_->http_auth_cache()->Add(GURL(kProxyUrl), "MyRealm1", HttpAuth::AUTH_SCHEME_BASIC, diff --git a/net/third_party/mozilla_security_manager/nsPKCS12Blob.cpp b/net/third_party/mozilla_security_manager/nsPKCS12Blob.cpp index ac0e8d0..cf15d72 100644 --- a/net/third_party/mozilla_security_manager/nsPKCS12Blob.cpp +++ b/net/third_party/mozilla_security_manager/nsPKCS12Blob.cpp @@ -148,7 +148,7 @@ pip_ucs2_ascii_conversion_fn(PRBool toUnicode, int nsPKCS12Blob_ImportHelper(const char* pkcs12_data, size_t pkcs12_len, - const string16& password, + const base::string16& password, bool is_extractable, bool try_zero_length_secitem, PK11SlotInfo *slot, @@ -353,7 +353,7 @@ void EnsurePKCS12Init() { int nsPKCS12Blob_Import(PK11SlotInfo* slot, const char* pkcs12_data, size_t pkcs12_len, - const string16& password, + const base::string16& password, bool is_extractable, net::CertificateList* imported_certs) { @@ -388,7 +388,7 @@ int nsPKCS12Blob_Import(PK11SlotInfo* slot, int nsPKCS12Blob_Export(std::string* output, const net::CertificateList& certs, - const string16& password) + const base::string16& password) { int return_count = 0; SECStatus srv = SECSuccess; diff --git a/net/third_party/mozilla_security_manager/nsPKCS12Blob.h b/net/third_party/mozilla_security_manager/nsPKCS12Blob.h index d0c8da1..ed05153 100644 --- a/net/third_party/mozilla_security_manager/nsPKCS12Blob.h +++ b/net/third_party/mozilla_security_manager/nsPKCS12Blob.h @@ -63,7 +63,7 @@ void EnsurePKCS12Init(); int nsPKCS12Blob_Import(PK11SlotInfo* slot, const char* pkcs12_data, size_t pkcs12_len, - const string16& password, + const base::string16& password, bool is_extractable, net::CertificateList* imported_certs); @@ -72,7 +72,7 @@ int nsPKCS12Blob_Import(PK11SlotInfo* slot, // TODO(mattm): provide better error return status? int nsPKCS12Blob_Export(std::string* output, const net::CertificateList& certs, - const string16& password); + const base::string16& password); } // namespace mozilla_security_manager diff --git a/net/tools/dump_cache/dump_cache.cc b/net/tools/dump_cache/dump_cache.cc index f5194ac..dc3676e 100644 --- a/net/tools/dump_cache/dump_cache.cc +++ b/net/tools/dump_cache/dump_cache.cc @@ -74,7 +74,7 @@ int Help() { // Starts a new process, to generate the files. int LaunchSlave(CommandLine command_line, - const string16& pipe_number, + const base::string16& pipe_number, int version) { bool do_upgrade = command_line.HasSwitch(kUpgrade); bool do_convert_to_text = command_line.HasSwitch(kDumpToFiles); @@ -134,7 +134,7 @@ int main(int argc, const char* argv[]) { } #if defined(OS_WIN) - string16 pipe_number = command_line.GetSwitchValueNative(kPipe); + base::string16 pipe_number = command_line.GetSwitchValueNative(kPipe); if (command_line.HasSwitch(kSlave) && slave_required) return RunSlave(input_path, pipe_number); diff --git a/net/tools/dump_cache/upgrade_win.cc b/net/tools/dump_cache/upgrade_win.cc index be8a29c..38b924b 100644 --- a/net/tools/dump_cache/upgrade_win.cc +++ b/net/tools/dump_cache/upgrade_win.cc @@ -38,8 +38,8 @@ const int kNumStreams = 4; #define DEBUGMSG(...) { printf(__VA_ARGS__); } #endif -HANDLE OpenServer(const string16& pipe_number) { - string16 pipe_name(kPipePrefix); +HANDLE OpenServer(const base::string16& pipe_number) { + base::string16 pipe_name(kPipePrefix); pipe_name.append(pipe_number); return CreateFile(pipe_name.c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); @@ -867,8 +867,8 @@ void SlaveSM::Fail() { // ----------------------------------------------------------------------- -HANDLE CreateServer(string16* pipe_number) { - string16 pipe_name(kPipePrefix); +HANDLE CreateServer(base::string16* pipe_number) { + base::string16 pipe_name(kPipePrefix); srand(static_cast<int>(base::Time::Now().ToInternalValue())); *pipe_number = base::IntToString16(rand()); pipe_name.append(*pipe_number); @@ -895,7 +895,8 @@ int UpgradeCache(const base::FilePath& output_path, HANDLE pipe) { } // This process will only execute commands from the controller. -int RunSlave(const base::FilePath& input_path, const string16& pipe_number) { +int RunSlave(const base::FilePath& input_path, + const base::string16& pipe_number) { MessageLoop loop(MessageLoop::TYPE_IO); base::win::ScopedHandle pipe(OpenServer(pipe_number)); diff --git a/net/tools/dump_cache/upgrade_win.h b/net/tools/dump_cache/upgrade_win.h index a3d6d22..9fc5d32 100644 --- a/net/tools/dump_cache/upgrade_win.h +++ b/net/tools/dump_cache/upgrade_win.h @@ -9,11 +9,12 @@ #include "base/string16.h" // Creates a new server, and returns a new named pipe to communicate with it. -HANDLE CreateServer(string16* pipe_number); +HANDLE CreateServer(base::string16* pipe_number); // Runs a loop to write a new cache with all the data available from a slave // process connected through the provided |pipe|. int UpgradeCache(const base::FilePath& output_path, HANDLE pipe); // This process will only execute commands from the controller. -int RunSlave(const base::FilePath& input_path, const string16& pipe_number); +int RunSlave(const base::FilePath& input_path, + const base::string16& pipe_number); diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc index 245f389..4bde999 100644 --- a/net/url_request/url_request.cc +++ b/net/url_request/url_request.cc @@ -322,7 +322,7 @@ LoadStateWithParam URLRequest::GetLoadState() const { load_state_param_); } return LoadStateWithParam(job_ ? job_->GetLoadState() : LOAD_STATE_IDLE, - string16()); + base::string16()); } UploadProgress URLRequest::GetUploadProgress() const { diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h index 1e5a95b..27db7d0 100644 --- a/net/url_request/url_request.h +++ b/net/url_request/url_request.h @@ -426,7 +426,7 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe), // parameter describing details related to the load state. Not all load states // have a parameter. LoadStateWithParam GetLoadState() const; - void SetLoadStateParam(const string16& param) { + void SetLoadStateParam(const base::string16& param) { load_state_param_ = param; } @@ -809,7 +809,7 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe), // An optional parameter that provides additional information about the load // state. Only used with the LOAD_STATE_WAITING_FOR_DELEGATE state. - string16 load_state_param_; + base::string16 load_state_param_; base::debug::LeakTracker<URLRequest> leak_tracker_; diff --git a/net/url_request/url_request_context_builder.cc b/net/url_request/url_request_context_builder.cc index a84bc71..8cd34de 100644 --- a/net/url_request/url_request_context_builder.cc +++ b/net/url_request/url_request_context_builder.cc @@ -77,7 +77,7 @@ class BasicNetworkDelegate : public NetworkDelegate { virtual void OnURLRequestDestroyed(URLRequest* request) OVERRIDE {} virtual void OnPACScriptError(int line_number, - const string16& error) OVERRIDE {} + const base::string16& error) OVERRIDE {} virtual NetworkDelegate::AuthRequiredResponse OnAuthRequired( URLRequest* request, diff --git a/net/url_request/url_request_file_dir_job.cc b/net/url_request/url_request_file_dir_job.cc index d1e10c1..08fa2b8 100644 --- a/net/url_request/url_request_file_dir_job.cc +++ b/net/url_request/url_request_file_dir_job.cc @@ -101,14 +101,14 @@ void URLRequestFileDirJob::OnListFile( // can catch errors from DirectoryLister and show an error page. if (!wrote_header_) { #if defined(OS_WIN) - const string16& title = dir_path_.value(); + const base::string16& title = dir_path_.value(); #elif defined(OS_POSIX) // TODO(jungshik): Add SysNativeMBToUTF16 to sys_string_conversions. // On Mac, need to add NFKC->NFC conversion either here or in file_path. // On Linux, the file system encoding is not defined, but we assume that // SysNativeMBToWide takes care of it at least for now. We can try something // more sophisticated if necessary later. - const string16& title = WideToUTF16( + const base::string16& title = WideToUTF16( base::SysNativeMBToWide(dir_path_.value())); #endif data_.append(GetDirectoryListingHeader(title)); diff --git a/net/url_request/url_request_test_util.cc b/net/url_request/url_request_test_util.cc index 5c72530..abb54c2 100644 --- a/net/url_request/url_request_test_util.cc +++ b/net/url_request/url_request_test_util.cc @@ -485,7 +485,7 @@ void TestNetworkDelegate::OnURLRequestDestroyed(URLRequest* request) { } void TestNetworkDelegate::OnPACScriptError(int line_number, - const string16& error) { + const base::string16& error) { } NetworkDelegate::AuthRequiredResponse TestNetworkDelegate::OnAuthRequired( diff --git a/net/url_request/url_request_test_util.h b/net/url_request/url_request_test_util.h index c412823..016477e 100644 --- a/net/url_request/url_request_test_util.h +++ b/net/url_request/url_request_test_util.h @@ -253,7 +253,7 @@ class TestNetworkDelegate : public NetworkDelegate { virtual void OnCompleted(URLRequest* request, bool started) OVERRIDE; virtual void OnURLRequestDestroyed(URLRequest* request) OVERRIDE; virtual void OnPACScriptError(int line_number, - const string16& error) OVERRIDE; + const base::string16& error) OVERRIDE; virtual NetworkDelegate::AuthRequiredResponse OnAuthRequired( URLRequest* request, const AuthChallengeInfo& auth_info, diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index a6c23da..4ad76b5 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc @@ -81,9 +81,9 @@ namespace net { namespace { -const string16 kChrome(ASCIIToUTF16("chrome")); -const string16 kSecret(ASCIIToUTF16("secret")); -const string16 kUser(ASCIIToUTF16("user")); +const base::string16 kChrome(ASCIIToUTF16("chrome")); +const base::string16 kSecret(ASCIIToUTF16("secret")); +const base::string16 kUser(ASCIIToUTF16("user")); // Tests load timing information in the case a fresh connection was used. // These tests use the TestServer, which doesn't support keep-alive sockets, |