summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/command_line.cc2
-rw-r--r--base/native_library_linux.cc4
-rw-r--r--base/string_util.cc11
-rw-r--r--base/string_util.h15
-rw-r--r--base/utf_string_conversions.cc23
-rw-r--r--base/utf_string_conversions.h14
-rw-r--r--chrome/browser/importer/toolbar_importer.cc1
-rw-r--r--chrome/browser/io_thread.cc1
-rw-r--r--chrome/browser/net/connection_tester.cc1
-rw-r--r--chrome/browser/net/preconnect.cc1
-rw-r--r--chrome/browser/net/view_http_cache_job_factory.cc1
-rw-r--r--chrome/browser/net/websocket_experiment/websocket_experiment_runner.cc3
-rw-r--r--chrome/installer/util/version.cc4
-rw-r--r--net/base/cookie_store.h3
-rw-r--r--net/base/net_log.cc1
-rw-r--r--net/base/transport_security_state.cc1
-rw-r--r--net/ftp/ftp_directory_listing_parser_ls.cc7
-rw-r--r--net/ftp/ftp_directory_listing_parser_netware.cc7
-rw-r--r--net/http/http_auth_controller.cc2
-rw-r--r--net/http/http_auth_filter.h1
-rw-r--r--net/http/http_auth_filter_win.h2
-rw-r--r--net/http/http_auth_handler_negotiate.cc2
-rw-r--r--net/net.gyp1
-rw-r--r--net/ocsp/nss_ocsp.cc3
-rw-r--r--net/socket_stream/socket_stream.cc1
-rw-r--r--net/spdy/spdy_session.cc1
-rw-r--r--net/url_request/url_request_context.cc11
-rw-r--r--net/url_request/url_request_context.h5
-rw-r--r--net/url_request/url_request_ftp_job.cc1
-rw-r--r--net/url_request/url_request_unittest.h1
-rw-r--r--net/websockets/websocket_job_unittest.cc1
-rw-r--r--webkit/glue/dom_serializer_unittest.cc3
32 files changed, 100 insertions, 35 deletions
diff --git a/base/command_line.cc b/base/command_line.cc
index de7870d..e180ddf 100644
--- a/base/command_line.cc
+++ b/base/command_line.cc
@@ -21,9 +21,9 @@
#include "base/file_path.h"
#include "base/logging.h"
#include "base/singleton.h"
-#include "base/string_piece.h"
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
+#include "base/utf_string_conversions.h"
#if defined(OS_LINUX)
// Linux/glibc doesn't natively have setproctitle().
diff --git a/base/native_library_linux.cc b/base/native_library_linux.cc
index 99e32c6..b6d7aef 100644
--- a/base/native_library_linux.cc
+++ b/base/native_library_linux.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,7 +8,7 @@
#include "base/file_path.h"
#include "base/logging.h"
-#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
namespace base {
diff --git a/base/string_util.cc b/base/string_util.cc
index 2488b0b..98f48c7 100644
--- a/base/string_util.cc
+++ b/base/string_util.cc
@@ -25,6 +25,7 @@
#include "base/singleton.h"
#include "base/third_party/dmg_fp/dmg_fp.h"
#include "base/utf_string_conversion_utils.h"
+#include "base/utf_string_conversions.h"
#include "base/third_party/icu/icu_utf.h"
namespace {
@@ -653,21 +654,11 @@ std::string WideToASCII(const std::wstring& wide) {
return std::string(wide.begin(), wide.end());
}
-std::wstring ASCIIToWide(const base::StringPiece& ascii) {
- DCHECK(IsStringASCII(ascii)) << ascii;
- return std::wstring(ascii.begin(), ascii.end());
-}
-
std::string UTF16ToASCII(const string16& utf16) {
DCHECK(IsStringASCII(utf16)) << utf16;
return std::string(utf16.begin(), utf16.end());
}
-string16 ASCIIToUTF16(const base::StringPiece& ascii) {
- DCHECK(IsStringASCII(ascii)) << ascii;
- return string16(ascii.begin(), ascii.end());
-}
-
// Latin1 is just the low range of Unicode, so we can copy directly to convert.
bool WideToLatin1(const std::wstring& wide, std::string* latin1) {
std::string output;
diff --git a/base/string_util.h b/base/string_util.h
index 8e3ae83..762779c 100644
--- a/base/string_util.h
+++ b/base/string_util.h
@@ -227,11 +227,20 @@ bool ContainsOnlyChars(const std::wstring& input,
bool ContainsOnlyChars(const string16& input, const string16& characters);
bool ContainsOnlyChars(const std::string& input, const std::string& characters);
-// These convert between ASCII (7-bit) and Wide/UTF16 strings.
+// Converts to 7-bit ASCII by truncating. The result must be known to be ASCII
+// beforehand.
std::string WideToASCII(const std::wstring& wide);
-std::wstring ASCIIToWide(const base::StringPiece& ascii);
std::string UTF16ToASCII(const string16& utf16);
-string16 ASCIIToUTF16(const base::StringPiece& ascii);
+
+// Forward-declares for functions in utf_string_conversions.h. They used to
+// be here and they were moved. We keep these here so the entire project
+// doesn't need to be switched at once.
+// TODO(brettw) delete these when everybody includes utf_string_conversions.h
+// instead.
+std::wstring ASCIIToWide(const char* ascii);
+std::wstring ASCIIToWide(const std::string& ascii);
+string16 ASCIIToUTF16(const char* ascii);
+string16 ASCIIToUTF16(const std::string& ascii);
// Converts the given wide string to the corresponding Latin1. This will fail
// (return false) if any characters are more than 255.
diff --git a/base/utf_string_conversions.cc b/base/utf_string_conversions.cc
index d517e1b..41a70db 100644
--- a/base/utf_string_conversions.cc
+++ b/base/utf_string_conversions.cc
@@ -1,10 +1,11 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/utf_string_conversions.h"
#include "base/string_piece.h"
+#include "base/string_util.h"
#include "base/utf_string_conversion_utils.h"
using base::PrepareForUTF8Output;
@@ -173,3 +174,23 @@ std::string UTF16ToUTF8(const string16& utf16) {
}
#endif
+
+std::wstring ASCIIToWide(const char* ascii) {
+ DCHECK(IsStringASCII(ascii)) << ascii;
+ return std::wstring(ascii, &ascii[strlen(ascii)]);
+}
+
+std::wstring ASCIIToWide(const std::string& ascii) {
+ DCHECK(IsStringASCII(ascii)) << ascii;
+ return std::wstring(ascii.begin(), ascii.end());
+}
+
+string16 ASCIIToUTF16(const char* ascii) {
+ DCHECK(IsStringASCII(ascii)) << ascii;
+ return string16(ascii, &ascii[strlen(ascii)]);
+}
+
+string16 ASCIIToUTF16(const std::string& ascii) {
+ DCHECK(IsStringASCII(ascii)) << ascii;
+ return string16(ascii.begin(), ascii.end());
+}
diff --git a/base/utf_string_conversions.h b/base/utf_string_conversions.h
index 0ffd480..6c49b41 100644
--- a/base/utf_string_conversions.h
+++ b/base/utf_string_conversions.h
@@ -48,4 +48,18 @@ std::string UTF16ToUTF8(const string16& utf16);
# define UTF16ToWideHack UTF16ToWide
#endif
+// These convert an ASCII string, typically a hardcoded constant, to a
+// UTF16/Wide string.
+//
+// Note that this doesn't use StringPiece because it's very common to need
+// ASCIIToUTF16("foo"), and either we have to include it in this file, or
+// forward declare it and force all callers to include string_piece.h. Given
+// that string_piece brings in complicated stuff like <algorithm>, it's
+// easier to just duplicate these very simple definitions for the two calling
+// cases we actually use.
+std::wstring ASCIIToWide(const char* ascii);
+std::wstring ASCIIToWide(const std::string& ascii);
+string16 ASCIIToUTF16(const char* ascii);
+string16 ASCIIToUTF16(const std::string& ascii);
+
#endif // BASE_UTF_STRING_CONVERSIONS_H_
diff --git a/chrome/browser/importer/toolbar_importer.cc b/chrome/browser/importer/toolbar_importer.cc
index a50d4c9..49ce2b6 100644
--- a/chrome/browser/importer/toolbar_importer.cc
+++ b/chrome/browser/importer/toolbar_importer.cc
@@ -7,6 +7,7 @@
#include <limits>
#include "base/rand_util.h"
+#include "base/string_util.h"
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/chrome_thread.h"
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index 8d1f250..a39b35b 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -8,6 +8,7 @@
#include "base/leak_tracker.h"
#include "base/logging.h"
#include "base/string_number_conversions.h"
+#include "base/string_util.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/gpu_process_host.h"
diff --git a/chrome/browser/net/connection_tester.cc b/chrome/browser/net/connection_tester.cc
index 085ef8f..c597789 100644
--- a/chrome/browser/net/connection_tester.cc
+++ b/chrome/browser/net/connection_tester.cc
@@ -8,6 +8,7 @@
#include "base/compiler_specific.h"
#include "base/logging.h"
#include "base/message_loop.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/importer/firefox_proxy_settings.h"
#include "chrome/common/chrome_switches.h"
#include "net/base/cookie_monster.h"
diff --git a/chrome/browser/net/preconnect.cc b/chrome/browser/net/preconnect.cc
index 2d4db36..e8038ff 100644
--- a/chrome/browser/net/preconnect.cc
+++ b/chrome/browser/net/preconnect.cc
@@ -6,6 +6,7 @@
#include "base/histogram.h"
#include "base/logging.h"
+#include "base/string_util.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/common/net/url_request_context_getter.h"
diff --git a/chrome/browser/net/view_http_cache_job_factory.cc b/chrome/browser/net/view_http_cache_job_factory.cc
index 5a3cd65..24d703d 100644
--- a/chrome/browser/net/view_http_cache_job_factory.cc
+++ b/chrome/browser/net/view_http_cache_job_factory.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/net/view_http_cache_job_factory.h"
#include "base/message_loop.h"
+#include "base/string_util.h"
#include "chrome/common/url_constants.h"
#include "net/base/net_errors.h"
#include "net/url_request/url_request.h"
diff --git a/chrome/browser/net/websocket_experiment/websocket_experiment_runner.cc b/chrome/browser/net/websocket_experiment/websocket_experiment_runner.cc
index c380af5..9b56611 100644
--- a/chrome/browser/net/websocket_experiment/websocket_experiment_runner.cc
+++ b/chrome/browser/net/websocket_experiment/websocket_experiment_runner.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,6 +9,7 @@
#include "base/field_trial.h"
#include "base/message_loop.h"
#include "base/task.h"
+#include "base/string_util.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/common/chrome_switches.h"
#include "net/base/net_errors.h"
diff --git a/chrome/installer/util/version.cc b/chrome/installer/util/version.cc
index 94bc9c3..f2ce049 100644
--- a/chrome/installer/util/version.cc
+++ b/chrome/installer/util/version.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,6 +9,8 @@
#include "base/format_macros.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
+#include "chrome/installer/util/version.h"
installer::Version::Version(int64 major, int64 minor, int64 build,
int64 patch)
diff --git a/net/base/cookie_store.h b/net/base/cookie_store.h
index 5c22bb0..2360c96 100644
--- a/net/base/cookie_store.h
+++ b/net/base/cookie_store.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,6 +9,7 @@
#pragma once
#include <string>
+#include <vector>
#include "base/basictypes.h"
#include "base/ref_counted.h"
diff --git a/net/base/net_log.cc b/net/base/net_log.cc
index bc79a30..b86bb2c 100644
--- a/net/base/net_log.cc
+++ b/net/base/net_log.cc
@@ -4,6 +4,7 @@
#include "net/base/net_log.h"
#include "base/time.h"
+#include "base/utf_string_conversions.h"
#include "base/values.h"
namespace net {
diff --git a/net/base/transport_security_state.cc b/net/base/transport_security_state.cc
index 985a940..7bb1907 100644
--- a/net/base/transport_security_state.cc
+++ b/net/base/transport_security_state.cc
@@ -13,6 +13,7 @@
#include "base/string_number_conversions.h"
#include "base/string_tokenizer.h"
#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "googleurl/src/gurl.h"
#include "net/base/dns_util.h"
diff --git a/net/ftp/ftp_directory_listing_parser_ls.cc b/net/ftp/ftp_directory_listing_parser_ls.cc
index 969d26a..143a236 100644
--- a/net/ftp/ftp_directory_listing_parser_ls.cc
+++ b/net/ftp/ftp_directory_listing_parser_ls.cc
@@ -1,6 +1,6 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this
-// source code is governed by a BSD-style license that can be found in the
-// LICENSE file.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
#include "net/ftp/ftp_directory_listing_parser_ls.h"
@@ -8,6 +8,7 @@
#include "base/string_number_conversions.h"
#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
#include "net/ftp/ftp_util.h"
namespace {
diff --git a/net/ftp/ftp_directory_listing_parser_netware.cc b/net/ftp/ftp_directory_listing_parser_netware.cc
index eb6518c..59a579c 100644
--- a/net/ftp/ftp_directory_listing_parser_netware.cc
+++ b/net/ftp/ftp_directory_listing_parser_netware.cc
@@ -1,6 +1,6 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
-// source code is governed by a BSD-style license that can be found in the
-// LICENSE file.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
#include "net/ftp/ftp_directory_listing_parser_netware.h"
@@ -8,6 +8,7 @@
#include "base/string_number_conversions.h"
#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
#include "net/ftp/ftp_util.h"
namespace {
diff --git a/net/http/http_auth_controller.cc b/net/http/http_auth_controller.cc
index 3f2d688..7f8e13c 100644
--- a/net/http/http_auth_controller.cc
+++ b/net/http/http_auth_controller.cc
@@ -4,7 +4,7 @@
#include "net/http/http_auth_controller.h"
-#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
#include "net/base/host_resolver.h"
#include "net/base/net_util.h"
#include "net/http/http_auth_handler_factory.h"
diff --git a/net/http/http_auth_filter.h b/net/http/http_auth_filter.h
index f120b2a..5160513 100644
--- a/net/http/http_auth_filter.h
+++ b/net/http/http_auth_filter.h
@@ -10,7 +10,6 @@
#include <set>
#include <string>
-#include "base/string_util.h"
#include "net/http/http_auth.h"
#include "net/proxy/proxy_bypass_rules.h"
diff --git a/net/http/http_auth_filter_win.h b/net/http/http_auth_filter_win.h
index f201f65..3a25865 100644
--- a/net/http/http_auth_filter_win.h
+++ b/net/http/http_auth_filter_win.h
@@ -11,7 +11,7 @@
#include "build/build_config.h"
#if defined(OS_WIN)
-#include "base/string_util.h"
+#include "base/string16.h"
namespace net {
diff --git a/net/http/http_auth_handler_negotiate.cc b/net/http/http_auth_handler_negotiate.cc
index 889dea2..6986264 100644
--- a/net/http/http_auth_handler_negotiate.cc
+++ b/net/http/http_auth_handler_negotiate.cc
@@ -5,6 +5,8 @@
#include "net/http/http_auth_handler_negotiate.h"
#include "base/logging.h"
+#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
#include "net/base/address_family.h"
#include "net/base/host_resolver.h"
#include "net/base/net_errors.h"
diff --git a/net/net.gyp b/net/net.gyp
index c98a86c..e5dbc99 100644
--- a/net/net.gyp
+++ b/net/net.gyp
@@ -530,6 +530,7 @@
'url_request/url_request.h',
'url_request/url_request_about_job.cc',
'url_request/url_request_about_job.h',
+ 'url_request/url_request_context.cc',
'url_request/url_request_context.h',
'url_request/url_request_data_job.cc',
'url_request/url_request_data_job.h',
diff --git a/net/ocsp/nss_ocsp.cc b/net/ocsp/nss_ocsp.cc
index 702baa6..bd6a70b 100644
--- a/net/ocsp/nss_ocsp.cc
+++ b/net/ocsp/nss_ocsp.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -19,6 +19,7 @@
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/singleton.h"
+#include "base/string_util.h"
#include "base/thread.h"
#include "base/time.h"
#include "googleurl/src/gurl.h"
diff --git a/net/socket_stream/socket_stream.cc b/net/socket_stream/socket_stream.cc
index 6e7f270..fe3afeb 100644
--- a/net/socket_stream/socket_stream.cc
+++ b/net/socket_stream/socket_stream.cc
@@ -14,6 +14,7 @@
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
#include "net/base/auth.h"
#include "net/base/host_resolver.h"
#include "net/base/io_buffer.h"
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index e9ecec3..d195fb9 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -13,6 +13,7 @@
#include "base/stl_util-inl.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
#include "base/time.h"
#include "base/values.h"
#include "net/base/connection_type_histograms.h"
diff --git a/net/url_request/url_request_context.cc b/net/url_request/url_request_context.cc
new file mode 100644
index 0000000..b39843a
--- /dev/null
+++ b/net/url_request/url_request_context.cc
@@ -0,0 +1,11 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/url_request/url_request_context.h"
+
+#include "base/string_util.h"
+
+const std::string& URLRequestContext::GetUserAgent(const GURL& url) const {
+ return EmptyString();
+}
diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h
index 3f6cc64..94cc29f 100644
--- a/net/url_request/url_request_context.h
+++ b/net/url_request/url_request_context.h
@@ -13,7 +13,6 @@
#include "base/non_thread_safe.h"
#include "base/ref_counted.h"
-#include "base/string_util.h"
#include "net/base/cookie_store.h"
#include "net/base/host_resolver.h"
#include "net/base/net_log.h"
@@ -104,9 +103,7 @@ class URLRequestContext
// Gets the UA string to use for the given URL. Pass an invalid URL (such as
// GURL()) to get the default UA string. Subclasses should override this
// method to provide a UA string.
- virtual const std::string& GetUserAgent(const GURL& url) const {
- return EmptyString();
- }
+ virtual const std::string& GetUserAgent(const GURL& url) const;
// In general, referrer_charset is not known when URLRequestContext is
// constructed. So, we need a setter.
diff --git a/net/url_request/url_request_ftp_job.cc b/net/url_request/url_request_ftp_job.cc
index e59f79f..37d6ab0 100644
--- a/net/url_request/url_request_ftp_job.cc
+++ b/net/url_request/url_request_ftp_job.cc
@@ -6,6 +6,7 @@
#include "base/compiler_specific.h"
#include "base/message_loop.h"
+#include "base/utf_string_conversions.h"
#include "net/base/auth.h"
#include "net/base/net_errors.h"
#include "net/base/net_util.h"
diff --git a/net/url_request/url_request_unittest.h b/net/url_request/url_request_unittest.h
index 1a6faf6..19105f0 100644
--- a/net/url_request/url_request_unittest.h
+++ b/net/url_request/url_request_unittest.h
@@ -18,6 +18,7 @@
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/process_util.h"
+#include "base/string_util.h"
#include "base/string16.h"
#include "base/thread.h"
#include "base/time.h"
diff --git a/net/websockets/websocket_job_unittest.cc b/net/websockets/websocket_job_unittest.cc
index 0136759..736be61 100644
--- a/net/websockets/websocket_job_unittest.cc
+++ b/net/websockets/websocket_job_unittest.cc
@@ -6,6 +6,7 @@
#include <vector>
#include "base/ref_counted.h"
+#include "base/string_util.h"
#include "googleurl/src/gurl.h"
#include "net/base/cookie_policy.h"
#include "net/base/cookie_store.h"
diff --git a/webkit/glue/dom_serializer_unittest.cc b/webkit/glue/dom_serializer_unittest.cc
index a1846f3..42a6bf5 100644
--- a/webkit/glue/dom_serializer_unittest.cc
+++ b/webkit/glue/dom_serializer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,6 +6,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/hash_tables.h"
+#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "net/base/net_util.h"
#include "net/url_request/url_request_context.h"