Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(529)

Unified Diff: chrome/common/content_settings_pattern.cc

Issue 13251012: Fix b180514: Some exception entries cannot be deleted from a setting panel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/common/content_settings_pattern_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | chrome/common/content_settings_pattern_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698