Index: extensions/common/permissions/permission_set.cc |
diff --git a/extensions/common/permissions/permission_set.cc b/extensions/common/permissions/permission_set.cc |
index 4a8d158e91fe37329565fd9ce96e1c05e0e9dcea..6109519d8fba262c976fd8eb3c5f9dc9d18b7c00 100644 |
--- a/extensions/common/permissions/permission_set.cc |
+++ b/extensions/common/permissions/permission_set.cc |
@@ -8,11 +8,9 @@ |
#include <iterator> |
#include <string> |
-#include "base/strings/stringprintf.h" |
#include "extensions/common/permissions/permissions_info.h" |
#include "extensions/common/url_pattern.h" |
#include "extensions/common/url_pattern_set.h" |
-#include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
#include "url/gurl.h" |
namespace extensions { |
@@ -278,33 +276,7 @@ void PermissionSet::InitShouldWarnAllHosts() const { |
for (URLPatternSet::const_iterator iter = effective_hosts_.begin(); |
iter != effective_hosts_.end(); |
++iter) { |
- // If this doesn't even match subdomains, it can't possibly imply all hosts. |
- if (!iter->match_subdomains()) |
- continue; |
- |
- // If iter->host() is a recognized TLD, this will be 0. We don't include |
- // private TLDs, so that, e.g., *.appspot.com does not imply all hosts. |
- size_t registry_length = |
- net::registry_controlled_domains::GetRegistryLength( |
- iter->host(), |
- net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, |
- net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); |
- // If there was more than just a TLD in the host (e.g., *.foobar.com), it |
- // doesn't imply all hosts. |
- if (registry_length > 0) |
- continue; |
- |
- // At this point the host could either be just a TLD ("com") or some unknown |
- // TLD-like string ("notatld"). To disambiguate between them construct a |
- // fake URL, and check the registry. This returns 0 if the TLD is |
- // unrecognized, or the length of the recognized TLD. |
- registry_length = net::registry_controlled_domains::GetRegistryLength( |
- base::StringPrintf("foo.%s", iter->host().c_str()), |
- net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, |
- net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); |
- // If we recognized this TLD, then this is a pattern like *.com, and it |
- // should imply all hosts. |
- if (registry_length > 0) { |
+ if (iter->ImpliesAllHosts()) { |
should_warn_all_hosts_ = WARN_ALL_HOSTS; |
return; |
} |