summaryrefslogtreecommitdiffstats
path: root/net/base
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 /net/base
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
Diffstat (limited to 'net/base')
-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
5 files changed, 19 insertions, 15 deletions
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);