Index: chrome/common/content_settings_pattern.cc |
diff --git a/chrome/common/content_settings_pattern.cc b/chrome/common/content_settings_pattern.cc |
index 98ac6d637e2e52cae9ba9d582122e3d724e53dd6..081a54260eeadfa220095cce2d09c89bf8f0042a 100644 |
--- a/chrome/common/content_settings_pattern.cc |
+++ b/chrome/common/content_settings_pattern.cc |
@@ -16,7 +16,6 @@ |
#include "googleurl/src/gurl.h" |
#include "googleurl/src/url_canon.h" |
#include "ipc/ipc_message_utils.h" |
-#include "net/base/dns_util.h" |
#include "net/base/net_util.h" |
namespace { |
@@ -78,6 +77,14 @@ int CompareDomainNames(const std::string& str1, const std::string& str2) { |
return 0; |
} |
+std::string TrimEndingDots(const base::StringPiece& host) { |
+ size_t len = host.length(); |
+ while (len > 1 && host[len - 1] == '.') { |
+ --len; |
+ } |
+ return host.substr(0, len).as_string(); |
+} |
+ |
typedef ContentSettingsPattern::BuilderInterface BuilderInterface; |
} // namespace |
@@ -178,7 +185,7 @@ bool ContentSettingsPattern::Builder::Canonicalize(PatternParts* parts) { |
std::string canonicalized_host(net::CanonicalizeHost(host, &host_info)); |
if (host_info.IsIPAddress() && parts->has_domain_wildcard) |
return false; |
- canonicalized_host = net::TrimEndingDot(canonicalized_host); |
+ canonicalized_host = TrimEndingDots(canonicalized_host); |
jochen (gone - plz use gerrit)
2013/04/02 08:09:36
this change seems wrong. I'll comment on the bug r
yhirano
2013/04/02 17:38:24
Done.
|
parts->host = ""; |
if ((host.find('*') == std::string::npos) && |
@@ -448,7 +455,7 @@ bool ContentSettingsPattern::Matches( |
parts_.path == std::string(local_url->path()); |
// Match the host part. |
- const std::string host(net::TrimEndingDot(local_url->host())); |
+ const std::string host(TrimEndingDots(local_url->host())); |
if (!parts_.has_domain_wildcard) { |
if (parts_.host != host) |
return false; |