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

Unified Diff: extensions/common/permissions/permission_set.cc

Issue 348313003: Create withheld permissions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Latest master Created 6 years, 5 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 | « extensions/common/extension_messages.cc ('k') | extensions/common/permissions/permissions_data.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « extensions/common/extension_messages.cc ('k') | extensions/common/permissions/permissions_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698