summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-10 21:08:39 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-10 21:08:39 +0000
commit8a16266e66a38bc1bfc6b00893c2a7c8cf8c55ee (patch)
tree5c07a9d5091a56c6d5a1a2b98ec10d19ae3c20e9
parentf8dce00e633d5ffde45e008fb8f51d5a76942f6b (diff)
downloadchromium_src-8a16266e66a38bc1bfc6b00893c2a7c8cf8c55ee.zip
chromium_src-8a16266e66a38bc1bfc6b00893c2a7c8cf8c55ee.tar.gz
chromium_src-8a16266e66a38bc1bfc6b00893c2a7c8cf8c55ee.tar.bz2
Move StringPiece into the base namespace. It is colliding
with the StringPiece class in icu4.2, which is a problem when trying to use the system version of icu. Review URL: http://codereview.chromium.org/193072 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25920 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--DEPS2
-rw-r--r--app/resource_bundle.h4
-rw-r--r--app/resource_bundle_linux.cc10
-rw-r--r--app/resource_bundle_mac.mm10
-rw-r--r--app/resource_bundle_win.cc8
-rw-r--r--base/data_pack.h3
-rw-r--r--base/data_pack_unittest.cc2
-rw-r--r--base/debug_util_posix.cc8
-rw-r--r--base/file_path.cc5
-rw-r--r--base/file_path.h5
-rw-r--r--base/string_piece.cc4
-rw-r--r--base/string_piece.h4
-rw-r--r--base/string_piece_unittest.cc2
-rw-r--r--base/string_util.cc8
-rw-r--r--base/string_util.h10
-rw-r--r--base/string_util_icu.cc2
-rw-r--r--base/sys_string_conversions.h4
-rw-r--r--chrome/browser/browser_about_handler.cc8
-rw-r--r--chrome/browser/browser_main.cc4
-rw-r--r--chrome/browser/dom_ui/dom_ui_theme_source.cc4
-rw-r--r--chrome/browser/dom_ui/downloads_ui.cc2
-rw-r--r--chrome/browser/dom_ui/history_ui.cc2
-rw-r--r--chrome/browser/dom_ui/new_tab_ui.cc6
-rw-r--r--chrome/browser/dom_ui/print_ui.cc2
-rw-r--r--chrome/browser/extensions/extension_host.cc2
-rw-r--r--chrome/browser/extensions/extensions_ui.cc2
-rw-r--r--chrome/browser/extensions/external_pref_extension_provider.cc3
-rw-r--r--chrome/browser/extensions/user_script_master.cc26
-rw-r--r--chrome/browser/extensions/user_script_master.h4
-rw-r--r--chrome/browser/privacy_blacklist/blocked_response.cc2
-rw-r--r--chrome/browser/ssl/ssl_blocking_page.cc2
-rw-r--r--chrome/browser/ssl/ssl_policy.cc2
-rw-r--r--chrome/browser/views/sync/sync_setup_wizard.cc6
-rw-r--r--chrome/common/extensions/user_script.h8
-rw-r--r--chrome/common/jstemplate_builder.cc19
-rw-r--r--chrome/common/jstemplate_builder.h14
-rw-r--r--chrome/renderer/render_view.cc2
-rw-r--r--chrome/renderer/renderer_glue.cc2
-rw-r--r--chrome/renderer/user_script_slave.cc8
-rw-r--r--chrome/renderer/user_script_slave.h2
-rw-r--r--chrome/test/v8_unit_test.cc4
-rw-r--r--chrome/test/v8_unit_test.h6
-rw-r--r--chrome/tools/mac_helpers/infoplist_strings_util.mm2
-rw-r--r--net/base/net_module.cc4
-rw-r--r--net/base/net_module.h4
-rw-r--r--net/base/net_util.cc3
-rw-r--r--net/base/registry_controlled_domain.cc10
-rw-r--r--net/base/registry_controlled_domain.h13
-rw-r--r--net/http/http_chunked_decoder.cc12
-rw-r--r--net/http/http_util.cc4
-rw-r--r--net/url_request/url_request_unittest.cc2
-rw-r--r--webkit/glue/devtools/debugger_agent_impl.cc9
-rw-r--r--webkit/glue/webkit_glue.h7
-rw-r--r--webkit/glue/webkitclient_impl.cc2
-rw-r--r--webkit/tools/test_shell/test_shell.h7
-rw-r--r--webkit/tools/test_shell/test_shell_gtk.cc12
-rw-r--r--webkit/tools/test_shell/test_shell_mac.mm10
-rw-r--r--webkit/tools/test_shell/test_shell_win.cc15
-rw-r--r--webkit/tools/test_shell/test_worker/test_worker_main.cc4
59 files changed, 194 insertions, 159 deletions
diff --git a/DEPS b/DEPS
index d96e830..ca243ba 100644
--- a/DEPS
+++ b/DEPS
@@ -28,7 +28,7 @@ deps = {
"/trunk/deps/third_party/icu42@25717",
"src/third_party/hunspell":
- "/trunk/deps/third_party/hunspell128@25668",
+ "/trunk/deps/third_party/hunspell128@25906",
"src/third_party/protobuf2/src":
"http://protobuf.googlecode.com/svn/trunk@219",
diff --git a/app/resource_bundle.h b/app/resource_bundle.h
index 52c85c5..23f39c5 100644
--- a/app/resource_bundle.h
+++ b/app/resource_bundle.h
@@ -33,7 +33,9 @@ class Font;
}
class SkBitmap;
typedef uint32 SkColor;
+namespace base {
class StringPiece;
+}
#if defined(OS_MACOSX)
#ifdef __OBJC__
@@ -105,7 +107,7 @@ class ResourceBundle {
// Like GetDataResource(), but avoids copying the resource. Instead, it
// returns a StringPiece which points into the actual resource in the image.
- StringPiece GetRawDataResource(int resource_id);
+ base::StringPiece GetRawDataResource(int resource_id);
// Get a localized string given a message id. Returns an empty
// string if the message_id is not found.
diff --git a/app/resource_bundle_linux.cc b/app/resource_bundle_linux.cc
index c84fa33..85f00c6 100644
--- a/app/resource_bundle_linux.cc
+++ b/app/resource_bundle_linux.cc
@@ -121,7 +121,7 @@ void ResourceBundle::LoadThemeResources() {
bool ResourceBundle::LoadResourceBytes(DataHandle module, int resource_id,
std::vector<unsigned char>* bytes) {
DCHECK(module);
- StringPiece data;
+ base::StringPiece data;
if (!module->Get(resource_id, &data))
return false;
@@ -131,11 +131,11 @@ bool ResourceBundle::LoadResourceBytes(DataHandle module, int resource_id,
return true;
}
-StringPiece ResourceBundle::GetRawDataResource(int resource_id) {
+base::StringPiece ResourceBundle::GetRawDataResource(int resource_id) {
DCHECK(resources_data_);
- StringPiece data;
+ base::StringPiece data;
if (!resources_data_->Get(resource_id, &data))
- return StringPiece();
+ return base::StringPiece();
return data;
}
@@ -147,7 +147,7 @@ string16 ResourceBundle::GetLocalizedString(int message_id) {
return string16();
}
- StringPiece data;
+ base::StringPiece data;
if (!locale_resources_data_->Get(message_id, &data)) {
// Fall back on the main data pack (shouldn't be any strings here except in
// unittests).
diff --git a/app/resource_bundle_mac.mm b/app/resource_bundle_mac.mm
index e96ed54..6696617 100644
--- a/app/resource_bundle_mac.mm
+++ b/app/resource_bundle_mac.mm
@@ -75,7 +75,7 @@ void ResourceBundle::LoadThemeResources() {
bool ResourceBundle::LoadResourceBytes(DataHandle module, int resource_id,
std::vector<unsigned char>* bytes) {
DCHECK(module);
- StringPiece data;
+ base::StringPiece data;
if (!module->Get(resource_id, &data))
return false;
@@ -85,11 +85,11 @@ bool ResourceBundle::LoadResourceBytes(DataHandle module, int resource_id,
return true;
}
-StringPiece ResourceBundle::GetRawDataResource(int resource_id) {
+base::StringPiece ResourceBundle::GetRawDataResource(int resource_id) {
DCHECK(resources_data_);
- StringPiece data;
+ base::StringPiece data;
if (!resources_data_->Get(resource_id, &data))
- return StringPiece();
+ return base::StringPiece();
return data;
}
@@ -101,7 +101,7 @@ string16 ResourceBundle::GetLocalizedString(int message_id) {
return string16();
}
- StringPiece data;
+ base::StringPiece data;
if (!locale_resources_data_->Get(message_id, &data)) {
// Fall back on the main data pack (shouldn't be any strings here except in
// unittests).
diff --git a/app/resource_bundle_win.cc b/app/resource_bundle_win.cc
index dcb669e..3526481 100644
--- a/app/resource_bundle_win.cc
+++ b/app/resource_bundle_win.cc
@@ -105,22 +105,22 @@ HICON ResourceBundle::LoadThemeIcon(int icon_id) {
return ::LoadIcon(theme_data_, MAKEINTRESOURCE(icon_id));
}
-StringPiece ResourceBundle::GetRawDataResource(int resource_id) {
+base::StringPiece ResourceBundle::GetRawDataResource(int resource_id) {
void* data_ptr;
size_t data_size;
if (base::GetDataResourceFromModule(_AtlBaseModule.GetModuleInstance(),
resource_id,
&data_ptr,
&data_size)) {
- return StringPiece(static_cast<const char*>(data_ptr), data_size);
+ return base::StringPiece(static_cast<const char*>(data_ptr), data_size);
} else if (locale_resources_data_ &&
base::GetDataResourceFromModule(locale_resources_data_,
resource_id,
&data_ptr,
&data_size)) {
- return StringPiece(static_cast<const char*>(data_ptr), data_size);
+ return base::StringPiece(static_cast<const char*>(data_ptr), data_size);
}
- return StringPiece();
+ return base::StringPiece();
}
// Loads and returns a cursor from the current module.
diff --git a/base/data_pack.h b/base/data_pack.h
index ff4f6d9..02a3849 100644
--- a/base/data_pack.h
+++ b/base/data_pack.h
@@ -16,10 +16,11 @@ namespace file_util {
class MemoryMappedFile;
}
class FilePath;
-class StringPiece;
namespace base {
+class StringPiece;
+
class DataPack {
public:
DataPack();
diff --git a/base/data_pack_unittest.cc b/base/data_pack_unittest.cc
index 71c37e5..7c2cfeb 100644
--- a/base/data_pack_unittest.cc
+++ b/base/data_pack_unittest.cc
@@ -24,7 +24,7 @@ TEST_F(DataPackTest, Load) {
base::DataPack pack;
ASSERT_TRUE(pack.Load(data_path_));
- StringPiece data;
+ base::StringPiece data;
ASSERT_TRUE(pack.Get(4, &data));
EXPECT_EQ("this is id 4", data);
ASSERT_TRUE(pack.Get(6, &data));
diff --git a/base/debug_util_posix.cc b/base/debug_util_posix.cc
index dd22710..081f4c4 100644
--- a/base/debug_util_posix.cc
+++ b/base/debug_util_posix.cc
@@ -92,11 +92,11 @@ bool DebugUtil::BeingDebugged() {
if (num_read <= 0)
return false;
- StringPiece status(buf, num_read);
- StringPiece tracer("TracerPid:\t");
+ base::StringPiece status(buf, num_read);
+ base::StringPiece tracer("TracerPid:\t");
- StringPiece::size_type pid_index = status.find(tracer);
- if (pid_index == StringPiece::npos)
+ base::StringPiece::size_type pid_index = status.find(tracer);
+ if (pid_index == base::StringPiece::npos)
return false;
// Our pid is 0 without a debugger, assume this for any pid starting with 0.
diff --git a/base/file_path.cc b/base/file_path.cc
index 222b225..a521b37 100644
--- a/base/file_path.cc
+++ b/base/file_path.cc
@@ -310,7 +310,8 @@ FilePath FilePath::InsertBeforeExtension(const StringType& suffix) const {
return FilePath(ret);
}
-FilePath FilePath::InsertBeforeExtensionASCII(const StringPiece& suffix) const {
+FilePath FilePath::InsertBeforeExtensionASCII(const base::StringPiece& suffix)
+ const {
DCHECK(IsStringASCII(suffix));
#if defined(OS_WIN)
return InsertBeforeExtension(ASCIIToWide(suffix));
@@ -397,7 +398,7 @@ FilePath FilePath::Append(const FilePath& component) const {
return Append(component.value());
}
-FilePath FilePath::AppendASCII(const StringPiece& component) const {
+FilePath FilePath::AppendASCII(const base::StringPiece& component) const {
DCHECK(IsStringASCII(component));
#if defined(OS_WIN)
return Append(ASCIIToWide(component));
diff --git a/base/file_path.h b/base/file_path.h
index 0b2ba5c..b608651 100644
--- a/base/file_path.h
+++ b/base/file_path.h
@@ -187,7 +187,7 @@ class FilePath {
// path == "C:\pics\jojo" suffix == " (1)", returns "C:\pics\jojo (1)"
// path == "C:\pics.old\jojo" suffix == " (1)", returns "C:\pics.old\jojo (1)"
FilePath InsertBeforeExtension(const StringType& suffix) const;
- FilePath InsertBeforeExtensionASCII(const StringPiece& suffix) const;
+ FilePath InsertBeforeExtensionASCII(const base::StringPiece& suffix) const;
// Replaces the extension of |file_name| with |extension|. If |file_name|
// does not have an extension, them |extension| is added. If |extension| is
@@ -214,7 +214,8 @@ class FilePath {
// On Linux, although it can use any 8-bit encoding for paths, we assume that
// ASCII is a valid subset, regardless of the encoding, since many operating
// system paths will always be ASCII.
- FilePath AppendASCII(const StringPiece& component) const WARN_UNUSED_RESULT;
+ FilePath AppendASCII(const base::StringPiece& component)
+ const WARN_UNUSED_RESULT;
// Returns true if this FilePath contains an absolute path. On Windows, an
// absolute path begins with either a drive letter specification followed by
diff --git a/base/string_piece.cc b/base/string_piece.cc
index 1acb0cb..6844892 100644
--- a/base/string_piece.cc
+++ b/base/string_piece.cc
@@ -8,6 +8,8 @@
#include "base/string_piece.h"
+namespace base {
+
typedef StringPiece::size_type size_type;
std::ostream& operator<<(std::ostream& o, const StringPiece& piece) {
@@ -213,3 +215,5 @@ StringPiece StringPiece::substr(size_type pos, size_type n) const {
}
const StringPiece::size_type StringPiece::npos = size_type(-1);
+
+} // namespace base
diff --git a/base/string_piece.h b/base/string_piece.h
index fe10806..47d4968 100644
--- a/base/string_piece.h
+++ b/base/string_piece.h
@@ -24,6 +24,8 @@
#include "base/basictypes.h"
+namespace base {
+
class StringPiece {
public:
typedef size_t size_type;
@@ -181,4 +183,6 @@ inline bool operator>=(const StringPiece& x, const StringPiece& y) {
// allow StringPiece to be logged (needed for unit testing).
extern std::ostream& operator<<(std::ostream& o, const StringPiece& piece);
+} // namespace base
+
#endif // BASE_STRING_PIECE_H_
diff --git a/base/string_piece_unittest.cc b/base/string_piece_unittest.cc
index ff62d46..8289cf3 100644
--- a/base/string_piece_unittest.cc
+++ b/base/string_piece_unittest.cc
@@ -8,6 +8,8 @@
#include "testing/gtest/include/gtest/gtest.h"
+using namespace base;
+
TEST(StringPieceTest, CheckComparisonOperators) {
#define CMP_Y(op, x, y) \
ASSERT_TRUE( (StringPiece((x)) op StringPiece((y)))); \
diff --git a/base/string_util.cc b/base/string_util.cc
index 82b6c0b..fd33ef0 100644
--- a/base/string_util.cc
+++ b/base/string_util.cc
@@ -506,7 +506,7 @@ std::string WideToASCII(const std::wstring& wide) {
return std::string(wide.begin(), wide.end());
}
-std::wstring ASCIIToWide(const StringPiece& ascii) {
+std::wstring ASCIIToWide(const base::StringPiece& ascii) {
DCHECK(IsStringASCII(ascii)) << ascii;
return std::wstring(ascii.begin(), ascii.end());
}
@@ -516,7 +516,7 @@ std::string UTF16ToASCII(const string16& utf16) {
return std::string(utf16.begin(), utf16.end());
}
-string16 ASCIIToUTF16(const StringPiece& ascii) {
+string16 ASCIIToUTF16(const base::StringPiece& ascii) {
DCHECK(IsStringASCII(ascii)) << ascii;
return string16(ascii.begin(), ascii.end());
}
@@ -563,7 +563,7 @@ bool IsStringASCII(const string16& str) {
}
#endif
-bool IsStringASCII(const StringPiece& str) {
+bool IsStringASCII(const base::StringPiece& str) {
return DoIsStringASCII(str);
}
@@ -745,7 +745,7 @@ bool LowerCaseEqualsASCII(const wchar_t* a_begin,
return DoLowerCaseEqualsASCII(a_begin, a_end, b);
}
-bool EqualsASCII(const string16& a, const StringPiece& b) {
+bool EqualsASCII(const string16& a, const base::StringPiece& b) {
if (a.length() != b.length())
return false;
return std::equal(b.begin(), b.end(), a.begin());
diff --git a/base/string_util.h b/base/string_util.h
index d1767f9..9143346 100644
--- a/base/string_util.h
+++ b/base/string_util.h
@@ -176,9 +176,9 @@ std::string CollapseWhitespaceASCII(const std::string& text,
// These convert between ASCII (7-bit) and Wide/UTF16 strings.
std::string WideToASCII(const std::wstring& wide);
-std::wstring ASCIIToWide(const StringPiece& ascii);
+std::wstring ASCIIToWide(const base::StringPiece& ascii);
std::string UTF16ToASCII(const string16& utf16);
-string16 ASCIIToUTF16(const StringPiece& ascii);
+string16 ASCIIToUTF16(const base::StringPiece& ascii);
// These convert between UTF-8, -16, and -32 strings. They are potentially slow,
// so avoid unnecessary conversions. The low-level versions return a boolean
@@ -196,7 +196,7 @@ string16 ASCIIToUTF16(const StringPiece& ascii);
bool WideToUTF8(const wchar_t* src, size_t src_len, std::string* output);
std::string WideToUTF8(const std::wstring& wide);
bool UTF8ToWide(const char* src, size_t src_len, std::wstring* output);
-std::wstring UTF8ToWide(const StringPiece& utf8);
+std::wstring UTF8ToWide(const base::StringPiece& utf8);
bool WideToUTF16(const wchar_t* src, size_t src_len, string16* output);
string16 WideToUTF16(const std::wstring& wide);
@@ -287,7 +287,7 @@ bool IsString8Bit(const std::wstring& str);
bool IsStringUTF8(const std::string& str);
bool IsStringWideUTF8(const std::wstring& str);
bool IsStringASCII(const std::wstring& str);
-bool IsStringASCII(const StringPiece& str);
+bool IsStringASCII(const base::StringPiece& str);
bool IsStringASCII(const string16& str);
// ASCII-specific tolower. The standard library's tolower is locale sensitive,
@@ -353,7 +353,7 @@ bool LowerCaseEqualsASCII(const wchar_t* a_begin,
// Performs a case-sensitive string compare. The behavior is undefined if both
// strings are not ASCII.
-bool EqualsASCII(const string16& a, const StringPiece& b);
+bool EqualsASCII(const string16& a, const base::StringPiece& b);
// Returns true if str starts with search, or false otherwise.
bool StartsWithASCII(const std::string& str,
diff --git a/base/string_util_icu.cc b/base/string_util_icu.cc
index a043e97..d3c9edf 100644
--- a/base/string_util_icu.cc
+++ b/base/string_util_icu.cc
@@ -333,7 +333,7 @@ bool WideToUTF8(const wchar_t* src, size_t src_len, std::string* output) {
return ConvertUnicode<wchar_t, std::string>(src, src_len, output);
}
-std::wstring UTF8ToWide(const StringPiece& utf8) {
+std::wstring UTF8ToWide(const base::StringPiece& utf8) {
std::wstring ret;
if (utf8.empty())
return ret;
diff --git a/base/sys_string_conversions.h b/base/sys_string_conversions.h
index 420c301..18be826 100644
--- a/base/sys_string_conversions.h
+++ b/base/sys_string_conversions.h
@@ -22,10 +22,10 @@ class NSString;
#endif
#endif // OS_MACOSX
-class StringPiece;
-
namespace base {
+class StringPiece;
+
// Converts between wide and UTF-8 representations of a string. On error, the
// result is system-dependent.
std::string SysWideToUTF8(const std::wstring& wide);
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc
index c7805eb..047ca97 100644
--- a/chrome/browser/browser_about_handler.cc
+++ b/chrome/browser/browser_about_handler.cc
@@ -247,7 +247,7 @@ std::string AboutPlugins() {
localized_strings.SetString(L"enabled_no",
l10n_util::GetString(IDS_ABOUT_PLUGINS_ENABLED_NO));
- static const StringPiece plugins_html(
+ static const base::StringPiece plugins_html(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_ABOUT_PLUGINS_HTML));
@@ -348,7 +348,7 @@ std::string AboutStats() {
}
// Get about_stats.html
- static const StringPiece stats_html(
+ static const base::StringPiece stats_html(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_ABOUT_STATS_HTML));
@@ -514,7 +514,7 @@ std::string AboutSync() {
full_status.max_consecutive_errors);
}
- static const StringPiece sync_html(
+ static const base::StringPiece sync_html(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_ABOUT_SYNC_HTML));
@@ -720,7 +720,7 @@ void AboutMemoryHandler::OnDetailsAvailable() {
}
// Get about_memory.html
- static const StringPiece memory_html(
+ static const base::StringPiece memory_html(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_ABOUT_MEMORY_HTML));
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index c2450f7..c15274b 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -192,9 +192,9 @@ base::LazyInstance<LazyDirectoryListerCacher> lazy_dir_lister(
base::LINKER_INITIALIZED);
// This is called indirectly by the network layer to access resources.
-StringPiece NetResourceProvider(int key) {
+base::StringPiece NetResourceProvider(int key) {
if (IDR_DIR_HEADER_HTML == key)
- return StringPiece(lazy_dir_lister.Pointer()->html_data);
+ return base::StringPiece(lazy_dir_lister.Pointer()->html_data);
return ResourceBundle::GetSharedInstance().GetRawDataResource(key);
}
diff --git a/chrome/browser/dom_ui/dom_ui_theme_source.cc b/chrome/browser/dom_ui/dom_ui_theme_source.cc
index f2ebbf5..bcdc813 100644
--- a/chrome/browser/dom_ui/dom_ui_theme_source.cc
+++ b/chrome/browser/dom_ui/dom_ui_theme_source.cc
@@ -181,7 +181,7 @@ void DOMUIThemeSource::InitNewTabCSS() {
subst2.push_back(SkColorToRGBAString(color_section_link_underline)); // $$7
// Get our template.
- static const StringPiece new_tab_theme_css(
+ static const base::StringPiece new_tab_theme_css(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_NEW_TAB_THEME_CSS));
@@ -215,7 +215,7 @@ void DOMUIThemeSource::InitNewIncognitoTabCSS() {
subst.push_back(UTF8ToUTF16(GetNewTabBackgroundTilingCSS())); // $5
// Get our template.
- static const StringPiece new_tab_theme_css(
+ static const base::StringPiece new_tab_theme_css(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_NEW_INCOGNITO_TAB_THEME_CSS));
diff --git a/chrome/browser/dom_ui/downloads_ui.cc b/chrome/browser/dom_ui/downloads_ui.cc
index deb5ef1..52a26df 100644
--- a/chrome/browser/dom_ui/downloads_ui.cc
+++ b/chrome/browser/dom_ui/downloads_ui.cc
@@ -99,7 +99,7 @@ void DownloadsUIHTMLSource::StartDataRequest(const std::string& path,
SetFontAndTextDirection(&localized_strings);
- static const StringPiece downloads_html(
+ static const base::StringPiece downloads_html(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_DOWNLOADS_HTML));
const std::string full_html = jstemplate_builder::GetI18nTemplateHtml(
diff --git a/chrome/browser/dom_ui/history_ui.cc b/chrome/browser/dom_ui/history_ui.cc
index c3eb8ad..45a994b 100644
--- a/chrome/browser/dom_ui/history_ui.cc
+++ b/chrome/browser/dom_ui/history_ui.cc
@@ -79,7 +79,7 @@ void HistoryUIHTMLSource::StartDataRequest(const std::string& path,
SetFontAndTextDirection(&localized_strings);
- static const StringPiece history_html(
+ static const base::StringPiece history_html(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_HISTORY_HTML));
const std::string full_html = jstemplate_builder::GetI18nTemplateHtml(
diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc
index 4f5bada..93fc8cb 100644
--- a/chrome/browser/dom_ui/new_tab_ui.cc
+++ b/chrome/browser/dom_ui/new_tab_ui.cc
@@ -421,12 +421,12 @@ void NewTabHTMLSource::InitFullHTML() {
// In case we have the new new tab page enabled we first try to read the file
// provided on the command line. If that fails we just get the resource from
// the resource bundle.
- StringPiece new_tab_html;
+ base::StringPiece new_tab_html;
std::string new_tab_html_str;
new_tab_html_str = GetCustomNewTabPageFromCommandLine();
if (!new_tab_html_str.empty()) {
- new_tab_html = StringPiece(new_tab_html_str);
+ new_tab_html = base::StringPiece(new_tab_html_str);
}
if (new_tab_html.empty()) {
@@ -510,7 +510,7 @@ void IncognitoTabHTMLSource::InitFullHTML() {
SetFontAndTextDirection(&localized_strings);
- static const StringPiece incognito_tab_html(
+ static const base::StringPiece incognito_tab_html(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_INCOGNITO_TAB_HTML));
diff --git a/chrome/browser/dom_ui/print_ui.cc b/chrome/browser/dom_ui/print_ui.cc
index 574abda..56514f9a 100644
--- a/chrome/browser/dom_ui/print_ui.cc
+++ b/chrome/browser/dom_ui/print_ui.cc
@@ -51,7 +51,7 @@ void PrintUIHTMLSource::StartDataRequest(const std::string& path,
SetFontAndTextDirection(&localized_strings);
// Setup the print html page.
- static const StringPiece print_html(
+ static const base::StringPiece print_html(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_PRINT_TAB_HTML));
const std::string full_html = jstemplate_builder::GetI18nTemplateHtml(
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc
index 168e002..39de133 100644
--- a/chrome/browser/extensions/extension_host.cc
+++ b/chrome/browser/extensions/extension_host.cc
@@ -151,7 +151,7 @@ void ExtensionHost::DidNavigate(RenderViewHost* render_view_host,
}
void ExtensionHost::DidStopLoading(RenderViewHost* render_view_host) {
- static const StringPiece toolstrip_css(
+ static const base::StringPiece toolstrip_css(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_EXTENSIONS_TOOLSTRIP_CSS));
#if defined(TOOLKIT_VIEWS)
diff --git a/chrome/browser/extensions/extensions_ui.cc b/chrome/browser/extensions/extensions_ui.cc
index 708b7e6..db10a9a 100644
--- a/chrome/browser/extensions/extensions_ui.cc
+++ b/chrome/browser/extensions/extensions_ui.cc
@@ -48,7 +48,7 @@ void ExtensionsUIHTMLSource::StartDataRequest(const std::string& path,
localized_strings.SetString(L"title",
l10n_util::GetString(IDS_EXTENSIONS_TITLE));
- static const StringPiece extensions_html(
+ static const base::StringPiece extensions_html(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_EXTENSIONS_UI_HTML));
std::string full_html(extensions_html.data(), extensions_html.size());
diff --git a/chrome/browser/extensions/external_pref_extension_provider.cc b/chrome/browser/extensions/external_pref_extension_provider.cc
index 7b371ed..e0f491f 100644
--- a/chrome/browser/extensions/external_pref_extension_provider.cc
+++ b/chrome/browser/extensions/external_pref_extension_provider.cc
@@ -58,7 +58,8 @@ void ExternalPrefExtensionProvider::VisitRegisteredExtension(
continue;
}
- if (external_crx.find(FilePath::kParentDirectory) != StringPiece::npos) {
+ if (external_crx.find(FilePath::kParentDirectory) !=
+ base::StringPiece::npos) {
LOG(WARNING) << "Path traversal not allowed in path: "
<< external_crx.c_str();
continue;
diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc
index 7fa7832..b4130c8 100644
--- a/chrome/browser/extensions/user_script_master.cc
+++ b/chrome/browser/extensions/user_script_master.cc
@@ -23,8 +23,8 @@
// Helper function to parse greasesmonkey headers
-static bool GetDeclarationValue(const StringPiece& line,
- const StringPiece& prefix,
+static bool GetDeclarationValue(const base::StringPiece& line,
+ const base::StringPiece& prefix,
std::string* value) {
if (!line.starts_with(prefix))
return false;
@@ -42,20 +42,20 @@ UserScriptMaster::ScriptReloader::ScriptReloader(UserScriptMaster* master)
// static
bool UserScriptMaster::ScriptReloader::ParseMetadataHeader(
- const StringPiece& script_text, UserScript* script) {
+ const base::StringPiece& script_text, UserScript* script) {
// http://wiki.greasespot.net/Metadata_block
- StringPiece line;
+ base::StringPiece line;
size_t line_start = 0;
size_t line_end = 0;
bool in_metadata = false;
- static const StringPiece kUserScriptBegin("// ==UserScript==");
- static const StringPiece kUserScriptEng("// ==/UserScript==");
- static const StringPiece kIncludeDeclaration("// @include ");
- static const StringPiece kMatchDeclaration("// @match ");
- static const StringPiece kRunAtDeclaration("// @run-at ");
- static const StringPiece kRunAtDocumentStartValue("document-start");
- static const StringPiece kRunAtDocumentEndValue("document-end");
+ static const base::StringPiece kUserScriptBegin("// ==UserScript==");
+ static const base::StringPiece kUserScriptEng("// ==/UserScript==");
+ static const base::StringPiece kIncludeDeclaration("// @include ");
+ static const base::StringPiece kMatchDeclaration("// @match ");
+ static const base::StringPiece kRunAtDeclaration("// @run-at ");
+ static const base::StringPiece kRunAtDocumentStartValue("document-start");
+ static const base::StringPiece kRunAtDocumentEndValue("document-end");
while (line_start < script_text.length()) {
line_end = script_text.find('\n', line_start);
@@ -204,11 +204,11 @@ static base::SharedMemory* Serialize(const UserScriptList& scripts) {
// Write scripts as 'data' so that we can read it out in the slave without
// allocating a new string.
for (size_t j = 0; j < script.js_scripts().size(); j++) {
- StringPiece contents = script.js_scripts()[j].GetContent();
+ base::StringPiece contents = script.js_scripts()[j].GetContent();
pickle.WriteData(contents.data(), contents.length());
}
for (size_t j = 0; j < script.css_scripts().size(); j++) {
- StringPiece contents = script.css_scripts()[j].GetContent();
+ base::StringPiece contents = script.css_scripts()[j].GetContent();
pickle.WriteData(contents.data(), contents.length());
}
}
diff --git a/chrome/browser/extensions/user_script_master.h b/chrome/browser/extensions/user_script_master.h
index 56aab84..af66879 100644
--- a/chrome/browser/extensions/user_script_master.h
+++ b/chrome/browser/extensions/user_script_master.h
@@ -16,7 +16,9 @@
#include "testing/gtest/include/gtest/gtest_prod.h"
class MessageLoop;
+namespace base {
class StringPiece;
+}
// Manages a segment of shared memory that contains the user scripts the user
// has installed. Lives on the UI thread.
@@ -70,7 +72,7 @@ class UserScriptMaster : public base::RefCounted<UserScriptMaster>,
: public base::RefCounted<UserScriptMaster::ScriptReloader> {
public:
// Parses the includes out of |script| and returns them in |includes|.
- static bool ParseMetadataHeader(const StringPiece& script_text,
+ static bool ParseMetadataHeader(const base::StringPiece& script_text,
UserScript* script);
static void LoadScriptsFromDirectory(const FilePath& script_dir,
diff --git a/chrome/browser/privacy_blacklist/blocked_response.cc b/chrome/browser/privacy_blacklist/blocked_response.cc
index aacb344..228886a 100644
--- a/chrome/browser/privacy_blacklist/blocked_response.cc
+++ b/chrome/browser/privacy_blacklist/blocked_response.cc
@@ -40,7 +40,7 @@ std::string GetHTML(const Blacklist::Match* match) {
strings.SetString(L"name", entry->provider()->name());
strings.SetString(L"url", entry->provider()->url());
- const StringPiece html =
+ const base::StringPiece html =
ResourceBundle::GetSharedInstance().GetRawDataResource(IDR_BLACKLIST_HTML);
return jstemplate_builder::GetI18nTemplateHtml(html, &strings);
}
diff --git a/chrome/browser/ssl/ssl_blocking_page.cc b/chrome/browser/ssl/ssl_blocking_page.cc
index a25fda3..d9fb4e6 100644
--- a/chrome/browser/ssl/ssl_blocking_page.cc
+++ b/chrome/browser/ssl/ssl_blocking_page.cc
@@ -81,7 +81,7 @@ std::string SSLBlockingPage::GetHTMLContents() {
(l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ?
L"rtl" : L"ltr");
- static const StringPiece html(
+ static const base::StringPiece html(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_SSL_ROAD_BLOCK_HTML));
diff --git a/chrome/browser/ssl/ssl_policy.cc b/chrome/browser/ssl/ssl_policy.cc
index a5ecfdc..c8a6c7c 100644
--- a/chrome/browser/ssl/ssl_policy.cc
+++ b/chrome/browser/ssl/ssl_policy.cc
@@ -286,7 +286,7 @@ void SSLPolicy::ShowErrorPage(SSLCertErrorHandler* handler) {
(l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ?
L"rtl" : L"ltr");
- static const StringPiece html(
+ static const base::StringPiece html(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_SSL_ERROR_HTML));
diff --git a/chrome/browser/views/sync/sync_setup_wizard.cc b/chrome/browser/views/sync/sync_setup_wizard.cc
index 0421e4e..3b187f7 100644
--- a/chrome/browser/views/sync/sync_setup_wizard.cc
+++ b/chrome/browser/views/sync/sync_setup_wizard.cc
@@ -49,15 +49,15 @@ void SyncResourcesSource::StartDataRequest(const std::string& path_raw,
std::string response;
if (path_raw == chrome::kSyncGaiaLoginPath) {
- static const StringPiece html(ResourceBundle::GetSharedInstance()
+ static const base::StringPiece html(ResourceBundle::GetSharedInstance()
.GetRawDataResource(IDR_GAIA_LOGIN_HTML));
response = html.as_string();
} else if (path_raw == chrome::kSyncMergeAndSyncPath) {
- static const StringPiece html(ResourceBundle::GetSharedInstance()
+ static const base::StringPiece html(ResourceBundle::GetSharedInstance()
.GetRawDataResource(IDR_MERGE_AND_SYNC_HTML));
response = html.as_string();
} else if (path_raw == chrome::kSyncSetupFlowPath) {
- static const StringPiece html(ResourceBundle::GetSharedInstance()
+ static const base::StringPiece html(ResourceBundle::GetSharedInstance()
.GetRawDataResource(IDR_SYNC_SETUP_FLOW_HTML));
response = html.as_string();
}
diff --git a/chrome/common/extensions/user_script.h b/chrome/common/extensions/user_script.h
index 7416472..4b571799 100644
--- a/chrome/common/extensions/user_script.h
+++ b/chrome/common/extensions/user_script.h
@@ -48,16 +48,16 @@ class UserScript {
// If external_content_ is set returns it as content otherwise it returns
// content_
- const StringPiece GetContent() const {
+ const base::StringPiece GetContent() const {
if (external_content_.data())
return external_content_;
else
return content_;
}
- void set_external_content(const StringPiece& content) {
+ void set_external_content(const base::StringPiece& content) {
external_content_ = content;
}
- const void set_content(const StringPiece& content) {
+ const void set_content(const base::StringPiece& content) {
content_.assign(content.begin(), content.end());
}
@@ -75,7 +75,7 @@ class UserScript {
// The script content. It can be set to either loaded_content_ or
// externally allocated string.
- StringPiece external_content_;
+ base::StringPiece external_content_;
// Set when the content is loaded by LoadContent
std::string content_;
diff --git a/chrome/common/jstemplate_builder.cc b/chrome/common/jstemplate_builder.cc
index bb3a78f..30a7ba9 100644
--- a/chrome/common/jstemplate_builder.cc
+++ b/chrome/common/jstemplate_builder.cc
@@ -16,9 +16,9 @@
namespace jstemplate_builder {
-std::string GetTemplateHtml(const StringPiece& html_template,
+std::string GetTemplateHtml(const base::StringPiece& html_template,
const DictionaryValue* json,
- const StringPiece& template_id) {
+ const base::StringPiece& template_id) {
std::string output(html_template.data(), html_template.size());
AppendJsonHtml(json, &output);
AppendJsTemplateSourceHtml(&output);
@@ -26,7 +26,7 @@ std::string GetTemplateHtml(const StringPiece& html_template,
return output;
}
-std::string GetI18nTemplateHtml(const StringPiece& html_template,
+std::string GetI18nTemplateHtml(const base::StringPiece& html_template,
const DictionaryValue* json) {
std::string output(html_template.data(), html_template.size());
AppendJsonHtml(json, &output);
@@ -35,9 +35,9 @@ std::string GetI18nTemplateHtml(const StringPiece& html_template,
return output;
}
-std::string GetTemplatesHtml(const StringPiece& html_template,
+std::string GetTemplatesHtml(const base::StringPiece& html_template,
const DictionaryValue* json,
- const StringPiece& template_id) {
+ const base::StringPiece& template_id) {
std::string output(html_template.data(), html_template.size());
AppendI18nTemplateSourceHtml(&output);
AppendJsTemplateSourceHtml(&output);
@@ -67,8 +67,9 @@ void AppendJsonHtml(const DictionaryValue* json, std::string* output) {
void AppendJsTemplateSourceHtml(std::string* output) {
// fetch and cache the pointer of the jstemplate resource source text.
- static const StringPiece jstemplate_src(ResourceBundle::GetSharedInstance().
- GetRawDataResource(IDR_JSTEMPLATE_JS));
+ static const base::StringPiece jstemplate_src(
+ ResourceBundle::GetSharedInstance().GetRawDataResource(
+ IDR_JSTEMPLATE_JS));
if (jstemplate_src.empty()) {
NOTREACHED() << "Unable to get jstemplate src";
@@ -80,7 +81,7 @@ void AppendJsTemplateSourceHtml(std::string* output) {
output->append("</script>");
}
-void AppendJsTemplateProcessHtml(const StringPiece& template_id,
+void AppendJsTemplateProcessHtml(const base::StringPiece& template_id,
std::string* output) {
output->append("<script>");
output->append("var tp = document.getElementById('");
@@ -92,7 +93,7 @@ void AppendJsTemplateProcessHtml(const StringPiece& template_id,
void AppendI18nTemplateSourceHtml(std::string* output) {
// fetch and cache the pointer of the jstemplate resource source text.
- static const StringPiece i18n_template_src(
+ static const base::StringPiece i18n_template_src(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_I18N_TEMPLATE_JS));
diff --git a/chrome/common/jstemplate_builder.h b/chrome/common/jstemplate_builder.h
index e1861d2..ac8285f 100644
--- a/chrome/common/jstemplate_builder.h
+++ b/chrome/common/jstemplate_builder.h
@@ -16,29 +16,31 @@
#include <string>
class DictionaryValue;
+namespace base {
class StringPiece;
+}
namespace jstemplate_builder {
// A helper function that generates a string of HTML to be loaded. The
// string includes the HTML and the javascript code necessary to generate the
// full page with support for JsTemplates.
-std::string GetTemplateHtml(const StringPiece& html_template,
+std::string GetTemplateHtml(const base::StringPiece& html_template,
const DictionaryValue* json,
- const StringPiece& template_id);
+ const base::StringPiece& template_id);
// A helper function that generates a string of HTML to be loaded. The
// string includes the HTML and the javascript code necessary to generate the
// full page with support for i18n Templates.
-std::string GetI18nTemplateHtml(const StringPiece& html_template,
+std::string GetI18nTemplateHtml(const base::StringPiece& html_template,
const DictionaryValue* json);
// A helper function that generates a string of HTML to be loaded. The
// string includes the HTML and the javascript code necessary to generate the
// full page with support for both i18n Templates and JsTemplates.
-std::string GetTemplatesHtml(const StringPiece& html_template,
+std::string GetTemplatesHtml(const base::StringPiece& html_template,
const DictionaryValue* json,
- const StringPiece& template_id);
+ const base::StringPiece& template_id);
// The following functions build up the different parts that the above
// templates use.
@@ -52,7 +54,7 @@ void AppendJsTemplateSourceHtml(std::string* output);
// Appends the code that processes the JsTemplate with the JSON. You should
// call AppendJsTemplateSourceHtml and AppendJsonHtml before calling this.
-void AppendJsTemplateProcessHtml(const StringPiece& template_id,
+void AppendJsTemplateProcessHtml(const base::StringPiece& template_id,
std::string* output);
// Appends the source for i18n Templates in a script tag.
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index cb4f6e7..31739d3 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -3129,7 +3129,7 @@ bool RenderView::MaybeLoadAlternateErrorPage(WebFrame* frame,
std::string RenderView::GetAltHTMLForTemplate(
const DictionaryValue& error_strings, int template_resource_id) const {
- const StringPiece template_html(
+ const base::StringPiece template_html(
ResourceBundle::GetSharedInstance().GetRawDataResource(
template_resource_id));
diff --git a/chrome/renderer/renderer_glue.cc b/chrome/renderer/renderer_glue.cc
index 2597264..c992010 100644
--- a/chrome/renderer/renderer_glue.cc
+++ b/chrome/renderer/renderer_glue.cc
@@ -158,7 +158,7 @@ void AppendToLog(const char* file, int line, const char* msg) {
logging::LogMessage(file, line).stream() << msg;
}
-StringPiece GetDataResource(int resource_id) {
+base::StringPiece GetDataResource(int resource_id) {
return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id);
}
diff --git a/chrome/renderer/user_script_slave.cc b/chrome/renderer/user_script_slave.cc
index 07e8746..2ebd68f 100644
--- a/chrome/renderer/user_script_slave.cc
+++ b/chrome/renderer/user_script_slave.cc
@@ -42,8 +42,8 @@ UserScriptSlave::UserScriptSlave()
IDR_GREASEMONKEY_API_JS);
// Count the number of lines that will be injected before the user script.
- StringPiece::size_type pos = 0;
- while ((pos = api_js_.find('\n', pos)) != StringPiece::npos) {
+ base::StringPiece::size_type pos = 0;
+ while ((pos = api_js_.find('\n', pos)) != base::StringPiece::npos) {
user_script_start_line_++;
pos++;
}
@@ -95,14 +95,14 @@ bool UserScriptSlave::UpdateScripts(base::SharedMemoryHandle shared_memory) {
int body_length = 0;
CHECK(pickle.ReadData(&iter, &body, &body_length));
script->js_scripts()[j].set_external_content(
- StringPiece(body, body_length));
+ base::StringPiece(body, body_length));
}
for (size_t j = 0; j < script->css_scripts().size(); ++j) {
const char* body = NULL;
int body_length = 0;
CHECK(pickle.ReadData(&iter, &body, &body_length));
script->css_scripts()[j].set_external_content(
- StringPiece(body, body_length));
+ base::StringPiece(body, body_length));
}
}
diff --git a/chrome/renderer/user_script_slave.h b/chrome/renderer/user_script_slave.h
index 8f1fc9b..614dd85 100644
--- a/chrome/renderer/user_script_slave.h
+++ b/chrome/renderer/user_script_slave.h
@@ -40,7 +40,7 @@ class UserScriptSlave {
STLElementDeleter<std::vector<UserScript*> > script_deleter_;
// Greasemonkey API source that is injected with the scripts.
- StringPiece api_js_;
+ base::StringPiece api_js_;
// The line number of the first line of the user script among all of the
// injected javascript. This is used to make reported errors correspond with
diff --git a/chrome/test/v8_unit_test.cc b/chrome/test/v8_unit_test.cc
index 43db5f1..4b94ad9 100644
--- a/chrome/test/v8_unit_test.cc
+++ b/chrome/test/v8_unit_test.cc
@@ -14,8 +14,8 @@ void V8UnitTest::SetUp() {
context_ = v8::Context::New(NULL, global);
}
-void V8UnitTest::ExecuteScriptInContext(const StringPiece& script_source,
- const StringPiece& script_name) {
+void V8UnitTest::ExecuteScriptInContext(const base::StringPiece& script_source,
+ const base::StringPiece& script_name) {
v8::Context::Scope context_scope(context_);
v8::HandleScope handle_scope;
v8::Handle<v8::String> source = v8::String::New(script_source.data(),
diff --git a/chrome/test/v8_unit_test.h b/chrome/test/v8_unit_test.h
index 1502e9d..644c660 100644
--- a/chrome/test/v8_unit_test.h
+++ b/chrome/test/v8_unit_test.h
@@ -10,7 +10,9 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "v8/include/v8.h"
+namespace base {
class StringPiece;
+}
// A superclass for unit tests that involve running JavaScript. This class
// sets up V8 context and has methods that make it easy to execute scripts in
@@ -23,8 +25,8 @@ class V8UnitTest : public testing::Test {
protected:
// Executes the given script source in the context. The specified script
// name is used when reporting errors.
- virtual void ExecuteScriptInContext(const StringPiece& script_source,
- const StringPiece& script_name);
+ virtual void ExecuteScriptInContext(const base::StringPiece& script_source,
+ const base::StringPiece& script_name);
// Converts a v8::TryCatch into a human readable string.
virtual std::string ExceptionToString(v8::TryCatch* try_catch);
diff --git a/chrome/tools/mac_helpers/infoplist_strings_util.mm b/chrome/tools/mac_helpers/infoplist_strings_util.mm
index f2bbf7a..fbdc924 100644
--- a/chrome/tools/mac_helpers/infoplist_strings_util.mm
+++ b/chrome/tools/mac_helpers/infoplist_strings_util.mm
@@ -76,7 +76,7 @@ NSString* LoadStringFromDataPack(base::DataPack* data_pack,
uint32_t resource_id,
const char* resource_id_str) {
NSString* result = nil;
- StringPiece data;
+ base::StringPiece data;
if (data_pack->Get(resource_id, &data)) {
// Data pack encodes strings as UTF16.
result =
diff --git a/net/base/net_module.cc b/net/base/net_module.cc
index de9a586..d7f1918 100644
--- a/net/base/net_module.cc
+++ b/net/base/net_module.cc
@@ -14,8 +14,8 @@ void NetModule::SetResourceProvider(ResourceProvider func) {
}
// static
-StringPiece NetModule::GetResource(int key) {
- return resource_provider ? resource_provider(key) : StringPiece();
+base::StringPiece NetModule::GetResource(int key) {
+ return resource_provider ? resource_provider(key) : base::StringPiece();
}
} // namespace net
diff --git a/net/base/net_module.h b/net/base/net_module.h
index 06404d0..6df4bfe 100644
--- a/net/base/net_module.h
+++ b/net/base/net_module.h
@@ -19,7 +19,7 @@ namespace net {
//
class NetModule {
public:
- typedef StringPiece (*ResourceProvider)(int key);
+ typedef base::StringPiece (*ResourceProvider)(int key);
// Set the function to call when the net module needs resources
static void SetResourceProvider(ResourceProvider func);
@@ -27,7 +27,7 @@ class NetModule {
// Call the resource provider (if one exists) to get the specified resource.
// Returns an empty string if the resource does not exist or if there is no
// resource provider.
- static StringPiece GetResource(int key);
+ static base::StringPiece GetResource(int key);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(NetModule);
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index 13e99a5..5f6b548 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -918,7 +918,8 @@ std::string CanonicalizeHost(const std::wstring& host,
}
std::string GetDirectoryListingHeader(const string16& title) {
- static const StringPiece header(NetModule::GetResource(IDR_DIR_HEADER_HTML));
+ static const base::StringPiece header(
+ NetModule::GetResource(IDR_DIR_HEADER_HTML));
// This can be null in unit tests.
DLOG_IF(WARNING, header.empty()) <<
"Missing resource: directory listing header";
diff --git a/net/base/registry_controlled_domain.cc b/net/base/registry_controlled_domain.cc
index 2bcfba5..40dea62 100644
--- a/net/base/registry_controlled_domain.cc
+++ b/net/base/registry_controlled_domain.cc
@@ -276,21 +276,23 @@ void RegistryControlledDomainService::Init() {
ParseDomainData(kDomainData);
}
-void RegistryControlledDomainService::ParseDomainData(const StringPiece& data) {
+void RegistryControlledDomainService::ParseDomainData(
+ const base::StringPiece& data) {
domain_set_.clear();
size_t line_end = 0;
size_t line_start = 0;
while (line_start < data.size()) {
line_end = data.find('\n', line_start);
- if (line_end == StringPiece::npos)
+ if (line_end == base::StringPiece::npos)
line_end = data.size();
- AddRule(StringPiece(data.data() + line_start, line_end - line_start));
+ AddRule(base::StringPiece(data.data() + line_start, line_end - line_start));
line_start = line_end + 1;
}
}
-void RegistryControlledDomainService::AddRule(const StringPiece& rule_str) {
+void RegistryControlledDomainService::AddRule(
+ const base::StringPiece& rule_str) {
DomainEntry rule(rule_str.data(), rule_str.size());
// Valid rules may be either wild or exceptions, but not both.
diff --git a/net/base/registry_controlled_domain.h b/net/base/registry_controlled_domain.h
index 2c6edb7..1897e8b5 100644
--- a/net/base/registry_controlled_domain.h
+++ b/net/base/registry_controlled_domain.h
@@ -227,7 +227,7 @@ class RegistryControlledDomainService {
// consider the attributes when doing comparisons, so as far as any data
// structures our concerned (ex our set), two DomainEntry's are equal as long
// as their StringPiece (the domain) is equal. This is the behavior we want.
- class DomainEntry : public StringPiece {
+ class DomainEntry : public base::StringPiece {
public:
struct DomainEntryAttributes {
DomainEntryAttributes() : exception(false), wildcard(false) { }
@@ -242,8 +242,9 @@ class RegistryControlledDomainService {
bool wildcard;
};
- DomainEntry() : StringPiece() { }
- DomainEntry(const char* ptr, size_type size) : StringPiece(ptr, size) { }
+ DomainEntry() : base::StringPiece() { }
+ DomainEntry(const char* ptr, size_type size)
+ : base::StringPiece(ptr, size) { }
~DomainEntry() { }
// We override StringPiece's operator < to make it more efficent, since we
@@ -252,7 +253,7 @@ class RegistryControlledDomainService {
bool operator<(const DomainEntry& other) const {
// If we are the same size, call up to StringPiece's real less than.
if (size() == other.size())
- return *static_cast<const StringPiece*>(this) < other;
+ return *static_cast<const base::StringPiece*>(this) < other;
// Consider ourselves less if we are smaller
return size() < other.size();
}
@@ -269,7 +270,7 @@ class RegistryControlledDomainService {
// were populated from an embedded resource, we will reference the embedded
// resource directly. If we were populated through UseDomainData, then our
// StringPiece will reference our local copy in copied_domain_data_.
- void ParseDomainData(const StringPiece& data);
+ void ParseDomainData(const base::StringPiece& data);
// Returns the singleton instance, after attempting to initialize it.
// NOTE that if the effective-TLD data resource can't be found, the instance
@@ -277,7 +278,7 @@ class RegistryControlledDomainService {
static RegistryControlledDomainService* GetInstance();
// Adds one rule, assumed to be valid, to the domain_set_.
- void AddRule(const StringPiece& rule_str);
+ void AddRule(const base::StringPiece& rule_str);
// Internal workings of the static public methods. See above.
static std::string GetDomainAndRegistryImpl(const std::string& host);
diff --git a/net/http/http_chunked_decoder.cc b/net/http/http_chunked_decoder.cc
index 71f7554..25b789f 100644
--- a/net/http/http_chunked_decoder.cc
+++ b/net/http/http_chunked_decoder.cc
@@ -93,8 +93,8 @@ int HttpChunkedDecoder::ScanForChunkRemaining(const char* buf, int buf_len) {
int bytes_consumed = 0;
- size_t index_of_lf = StringPiece(buf, buf_len).find('\n');
- if (index_of_lf != StringPiece::npos) {
+ size_t index_of_lf = base::StringPiece(buf, buf_len).find('\n');
+ if (index_of_lf != base::StringPiece::npos) {
buf_len = static_cast<int>(index_of_lf);
if (buf_len && buf[buf_len - 1] == '\r') // Eliminate a preceding CR.
buf_len--;
@@ -121,8 +121,8 @@ int HttpChunkedDecoder::ScanForChunkRemaining(const char* buf, int buf_len) {
chunk_terminator_remaining_ = false;
} else if (buf_len) {
// Ignore any chunk-extensions.
- size_t index_of_semicolon = StringPiece(buf, buf_len).find(';');
- if (index_of_semicolon != StringPiece::npos)
+ size_t index_of_semicolon = base::StringPiece(buf, buf_len).find(';');
+ if (index_of_semicolon != base::StringPiece::npos)
buf_len = static_cast<int>(index_of_semicolon);
if (!ParseChunkSize(buf, buf_len, &chunk_remaining_)) {
@@ -181,8 +181,8 @@ bool HttpChunkedDecoder::ParseChunkSize(const char* start, int len, int* out) {
// Be more restrictive than HexStringToInt;
// don't allow inputs with leading "-", "+", "0x", "0X"
- if (StringPiece(start, len).find_first_not_of("0123456789abcdefABCDEF")!=
- StringPiece::npos)
+ if (base::StringPiece(start, len).find_first_not_of("0123456789abcdefABCDEF")
+ != base::StringPiece::npos)
return false;
int parsed_number;
diff --git a/net/http/http_util.cc b/net/http/http_util.cc
index 4381117..41aa554 100644
--- a/net/http/http_util.cc
+++ b/net/http/http_util.cc
@@ -500,8 +500,8 @@ static bool IsLineSegmentContinuable(const char* begin, const char* end) {
// Helper used by AssembleRawHeaders, to find the end of the status line.
static const char* FindStatusLineEnd(const char* begin, const char* end) {
- size_t i = StringPiece(begin, end - begin).find_first_of("\r\n");
- if (i == StringPiece::npos)
+ size_t i = base::StringPiece(begin, end - begin).find_first_of("\r\n");
+ if (i == base::StringPiece::npos)
return end;
return begin + i;
}
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc
index 2f2f2e1..d82e085 100644
--- a/net/url_request/url_request_unittest.cc
+++ b/net/url_request/url_request_unittest.cc
@@ -78,7 +78,7 @@ class TestURLRequest : public URLRequest {
}
};
-StringPiece TestNetResourceProvider(int key) {
+base::StringPiece TestNetResourceProvider(int key) {
return "header";
}
diff --git a/webkit/glue/devtools/debugger_agent_impl.cc b/webkit/glue/devtools/debugger_agent_impl.cc
index 70353ae..45b5470 100644
--- a/webkit/glue/devtools/debugger_agent_impl.cc
+++ b/webkit/glue/devtools/debugger_agent_impl.cc
@@ -132,18 +132,19 @@ void DebuggerAgentImpl::CreateUtilityContext(
global->Set(v8::String::New("contentWindow"), window_global);
// Inject javascript into the context.
- StringPiece basejs = webkit_glue::GetDataResource(IDR_DEVTOOLS_BASE_JS);
+ base::StringPiece basejs = webkit_glue::GetDataResource(IDR_DEVTOOLS_BASE_JS);
v8::Script::Compile(v8::String::New(basejs.as_string().c_str()))->Run();
- StringPiece injectjs_webkit =
+ base::StringPiece injectjs_webkit =
webkit_glue::GetDataResource(IDR_DEVTOOLS_INJECT_WEBKIT_JS);
v8::Script::Compile(
v8::String::New(injectjs_webkit.as_string().c_str()))->Run();
- StringPiece injectjs = webkit_glue::GetDataResource(IDR_DEVTOOLS_INJECT_JS);
+ base::StringPiece injectjs = webkit_glue::GetDataResource(
+ IDR_DEVTOOLS_INJECT_JS);
v8::Script::Compile(v8::String::New(injectjs.as_string().c_str()))->Run();
- StringPiece inject_dispatchjs = webkit_glue::GetDataResource(
+ base::StringPiece inject_dispatchjs = webkit_glue::GetDataResource(
IDR_DEVTOOLS_INJECT_DISPATCH_JS);
v8::Script::Compile(v8::String::New(
inject_dispatchjs.as_string().c_str()))->Run();
diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h
index 302f047..eab53a4 100644
--- a/webkit/glue/webkit_glue.h
+++ b/webkit/glue/webkit_glue.h
@@ -21,10 +21,13 @@
class GURL;
class SkBitmap;
-class StringPiece;
class WebView;
struct WebPluginInfo;
+namespace base {
+class StringPiece;
+}
+
namespace skia {
class PlatformCanvas;
}
@@ -139,7 +142,7 @@ string16 GetLocalizedString(int message_id);
// Returns the raw data for a resource. This resource must have been
// specified as BINDATA in the relevant .rc file.
-StringPiece GetDataResource(int resource_id);
+base::StringPiece GetDataResource(int resource_id);
#if defined(OS_WIN)
// Loads and returns a cursor.
diff --git a/webkit/glue/webkitclient_impl.cc b/webkit/glue/webkitclient_impl.cc
index b4acce3..ddd213d 100644
--- a/webkit/glue/webkitclient_impl.cc
+++ b/webkit/glue/webkitclient_impl.cc
@@ -185,7 +185,7 @@ WebData WebKitClientImpl::loadResource(const char* name) {
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(resources); ++i) {
if (!strcmp(name, resources[i].name)) {
- StringPiece resource = GetDataResource(resources[i].id);
+ base::StringPiece resource = GetDataResource(resources[i].id);
return WebData(resource.data(), resource.size());
}
}
diff --git a/webkit/tools/test_shell/test_shell.h b/webkit/tools/test_shell/test_shell.h
index b99cbea..5d14c55 100644
--- a/webkit/tools/test_shell/test_shell.h
+++ b/webkit/tools/test_shell/test_shell.h
@@ -47,10 +47,13 @@
typedef std::list<gfx::NativeWindow> WindowList;
struct WebPreferences;
-class StringPiece;
class TestNavigationEntry;
class TestNavigationController;
+namespace base {
+class StringPiece;
+}
+
class TestShell {
public:
struct TestParams {
@@ -268,7 +271,7 @@ public:
static void ShowStartupDebuggingDialog();
// This is called indirectly by the network layer to access resources.
- static StringPiece NetResourceProvider(int key);
+ static base::StringPiece NetResourceProvider(int key);
protected:
bool Initialize(const GURL& starting_url);
diff --git a/webkit/tools/test_shell/test_shell_gtk.cc b/webkit/tools/test_shell/test_shell_gtk.cc
index 87e80a5..848751d 100644
--- a/webkit/tools/test_shell/test_shell_gtk.cc
+++ b/webkit/tools/test_shell/test_shell_gtk.cc
@@ -181,7 +181,7 @@ void TestShell::InitializeTestShell(bool layout_test_mode) {
// fontconfig only knows how to load font config configs from a file name, so
// we write to a temp file.
- StringPiece font_config_xml;
+ base::StringPiece font_config_xml;
g_resource_data_pack->Get(IDR_LINUX_FONT_CONFIG, &font_config_xml);
FilePath fontconfig_path;
if (!file_util::CreateTemporaryFile(&fontconfig_path)) {
@@ -270,7 +270,7 @@ void TestShell::InitializeTestShell(bool layout_test_mode) {
}
// Also load the layout-test-specific "Ahem" font.
- StringPiece ahem_font;
+ base::StringPiece ahem_font;
g_resource_data_pack->Get(IDR_AHEM_FONT, &ahem_font);
g_ahem_path = new FilePath;
if (!file_util::CreateTemporaryFile(g_ahem_path)) {
@@ -632,8 +632,8 @@ void TestShell::ShowStartupDebuggingDialog() {
}
// static
-StringPiece TestShell::NetResourceProvider(int key) {
- StringPiece res;
+base::StringPiece TestShell::NetResourceProvider(int key) {
+ base::StringPiece res;
g_resource_data_pack->Get(key, &res);
return res;
}
@@ -643,7 +643,7 @@ StringPiece TestShell::NetResourceProvider(int key) {
namespace webkit_glue {
string16 GetLocalizedString(int message_id) {
- StringPiece res;
+ base::StringPiece res;
if (!g_resource_data_pack->Get(message_id, &res)) {
LOG(FATAL) << "failed to load webkit string with id " << message_id;
}
@@ -652,7 +652,7 @@ string16 GetLocalizedString(int message_id) {
res.length() / 2);
}
-StringPiece GetDataResource(int resource_id) {
+base::StringPiece GetDataResource(int resource_id) {
switch (resource_id) {
case IDR_FEED_PREVIEW:
// It is necessary to return a feed preview template that contains
diff --git a/webkit/tools/test_shell/test_shell_mac.mm b/webkit/tools/test_shell/test_shell_mac.mm
index 5566380..299876a 100644
--- a/webkit/tools/test_shell/test_shell_mac.mm
+++ b/webkit/tools/test_shell/test_shell_mac.mm
@@ -609,9 +609,9 @@ void TestShell::ShowStartupDebuggingDialog() {
[alert runModal];
}
-StringPiece TestShell::NetResourceProvider(int key) {
+base::StringPiece TestShell::NetResourceProvider(int key) {
// TODO(port): Return the requested resource.
- return StringPiece();
+ return base::StringPiece();
}
//-----------------------------------------------------------------------------
@@ -619,7 +619,7 @@ StringPiece TestShell::NetResourceProvider(int key) {
namespace webkit_glue {
string16 GetLocalizedString(int message_id) {
- StringPiece res;
+ base::StringPiece res;
if (!g_resource_data_pack->Get(message_id, &res)) {
LOG(FATAL) << "failed to load webkit string with id " << message_id;
}
@@ -628,7 +628,7 @@ string16 GetLocalizedString(int message_id) {
res.length() / 2);
}
-StringPiece GetDataResource(int resource_id) {
+base::StringPiece GetDataResource(int resource_id) {
switch (resource_id) {
case IDR_BROKENIMAGE: {
// Use webkit's broken image icon (16x16)
@@ -678,7 +678,7 @@ StringPiece GetDataResource(int resource_id) {
break;
}
- return StringPiece();
+ return base::StringPiece();
}
void GetPlugins(bool refresh, std::vector<WebPluginInfo>* plugins) {
diff --git a/webkit/tools/test_shell/test_shell_win.cc b/webkit/tools/test_shell/test_shell_win.cc
index e097b25..2bde111 100644
--- a/webkit/tools/test_shell/test_shell_win.cc
+++ b/webkit/tools/test_shell/test_shell_win.cc
@@ -126,16 +126,17 @@ FilePath GetResourcesFilePath() {
return path.AppendASCII("resources");
}
-static StringPiece GetRawDataResource(HMODULE module, int resource_id) {
+static base::StringPiece GetRawDataResource(HMODULE module, int resource_id) {
void* data_ptr;
size_t data_size;
return base::GetDataResourceFromModule(module, resource_id, &data_ptr,
- &data_size) ?
- StringPiece(static_cast<char*>(data_ptr), data_size) : StringPiece();
+ &data_size)
+ ? base::StringPiece(static_cast<char*>(data_ptr), data_size)
+ : base::StringPiece();
}
// This is called indirectly by the network layer to access resources.
-StringPiece NetResourceProvider(int key) {
+base::StringPiece NetResourceProvider(int key) {
return GetRawDataResource(::GetModuleHandle(NULL), key);
}
@@ -655,7 +656,7 @@ void TestShell::ShowStartupDebuggingDialog() {
}
// static
-StringPiece TestShell::NetResourceProvider(int key) {
+base::StringPiece TestShell::NetResourceProvider(int key) {
return GetRawDataResource(::GetModuleHandle(NULL), key);
}
@@ -677,7 +678,7 @@ string16 GetLocalizedString(int message_id) {
}
// TODO(tc): Convert this to using resources from test_shell.rc.
-StringPiece GetDataResource(int resource_id) {
+base::StringPiece GetDataResource(int resource_id) {
switch (resource_id) {
case IDR_BROKENIMAGE: {
// Use webkit's broken image icon (16x16)
@@ -730,7 +731,7 @@ StringPiece GetDataResource(int resource_id) {
break;
}
- return StringPiece();
+ return base::StringPiece();
}
HCURSOR LoadCursor(int cursor_id) {
diff --git a/webkit/tools/test_shell/test_worker/test_worker_main.cc b/webkit/tools/test_shell/test_worker/test_worker_main.cc
index 1002fbe..94c966d 100644
--- a/webkit/tools/test_shell/test_worker/test_worker_main.cc
+++ b/webkit/tools/test_shell/test_worker/test_worker_main.cc
@@ -166,8 +166,8 @@ string16 GetLocalizedString(int message_id) {
return EmptyString16();
}
-StringPiece GetDataResource(int resource_id) {
- return StringPiece();
+base::StringPiece GetDataResource(int resource_id) {
+ return base::StringPiece();
}
void SetMediaPlayerAvailable(bool value) {