Index: chrome/common/extensions/permissions/chrome_permission_message_provider.cc |
diff --git a/chrome/common/extensions/permissions/chrome_permission_message_provider.cc b/chrome/common/extensions/permissions/chrome_permission_message_provider.cc |
index 26a5ae4693564a2b7aa4e46377cd583a2b66e826..fd7f3c599d49942a1c141343ee05a56552351c67 100644 |
--- a/chrome/common/extensions/permissions/chrome_permission_message_provider.cc |
+++ b/chrome/common/extensions/permissions/chrome_permission_message_provider.cc |
@@ -13,7 +13,6 @@ |
#include "extensions/common/url_pattern.h" |
#include "extensions/common/url_pattern_set.h" |
#include "grit/generated_resources.h" |
-#include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
#include "ui/base/l10n/l10n_util.h" |
#include "url/gurl.h" |
@@ -23,47 +22,6 @@ namespace { |
typedef std::set<PermissionMessage> PermissionMsgSet; |
-bool ShouldWarnAllHosts(const PermissionSet* permissions) { |
- if (permissions->HasEffectiveAccessToAllHosts()) |
- return true; |
- |
- const URLPatternSet& effective_hosts = permissions->effective_hosts(); |
- 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) |
- return true; |
- } |
- |
- return false; |
-} |
- |
template<typename T> |
typename T::iterator FindMessageByID(T& messages, int id) { |
for (typename T::iterator it = messages.begin(); |
@@ -267,7 +225,7 @@ ChromePermissionMessageProvider::GetAPIPermissionMessages( |
// subset of what the "<all_urls>" access allows. Therefore we |
// display only the "<all_urls>" warning message if both permissions |
// are required. |
- if (ShouldWarnAllHosts(permissions)) { |
+ if (permissions->ShouldWarnAllHosts()) { |
messages.erase( |
PermissionMessage( |
PermissionMessage::kDeclarativeWebRequest, base::string16())); |
@@ -303,7 +261,7 @@ ChromePermissionMessageProvider::GetHostPermissionMessages( |
if (extension_type == Manifest::TYPE_PLATFORM_APP) |
return messages; |
- if (ShouldWarnAllHosts(permissions)) { |
+ if (permissions->ShouldWarnAllHosts()) { |
messages.insert(PermissionMessage( |
PermissionMessage::kHostsAll, |
l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WARNING_ALL_HOSTS))); |