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

Unified Diff: chrome/common/extensions/extension_permission_set.cc

Issue 7582017: Do not display warnings for file:/// extension permissions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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
Index: chrome/common/extensions/extension_permission_set.cc
diff --git a/chrome/common/extensions/extension_permission_set.cc b/chrome/common/extensions/extension_permission_set.cc
index 7568c85f21848ecdd627551ee4f462eb33b2c903..18ebeee6e5c27513861cac269619def18f94f0f7 100644
--- a/chrome/common/extensions/extension_permission_set.cc
+++ b/chrome/common/extensions/extension_permission_set.cc
@@ -517,7 +517,7 @@ std::set<std::string> ExtensionPermissionSet::GetAPIsAsStrings() const {
std::set<std::string>
ExtensionPermissionSet::GetDistinctHostsForDisplay() const {
- return GetDistinctHosts(effective_hosts_, true);
+ return GetDistinctHosts(effective_hosts_, true, true);
}
ExtensionPermissionMessages
@@ -687,7 +687,9 @@ bool ExtensionPermissionSet::HasLessPrivilegesThan(
// static
std::set<std::string> ExtensionPermissionSet::GetDistinctHosts(
- const URLPatternSet& host_patterns, bool include_rcd) {
+ const URLPatternSet& host_patterns,
+ bool include_rcd,
+ bool exclude_file_scheme) {
// Use a vector to preserve order (also faster than a map on small sets).
// Each item is a host split into two parts: host without RCDs and
// current best RCD.
@@ -695,6 +697,9 @@ std::set<std::string> ExtensionPermissionSet::GetDistinctHosts(
HostVector hosts_best_rcd;
for (URLPatternSet::const_iterator i = host_patterns.begin();
i != host_patterns.end(); ++i) {
+ if (exclude_file_scheme && i->scheme() == "file")
asargent_no_longer_on_chrome 2011/08/05 22:56:37 nit: change "file" to chrome::kFileScheme, save a
+ continue;
+
std::string host = i->host();
// Add the subdomain wildcard back to the host, if necessary.
@@ -824,8 +829,8 @@ bool ExtensionPermissionSet::HasLessHostPrivilegesThan(
// TODO(jstritar): This is overly conservative with respect to subdomains.
// For example, going from *.google.com to www.google.com will be
// considered an elevation, even though it is not (http://crbug.com/65337).
- std::set<std::string> new_hosts_set = GetDistinctHosts(new_list, false);
- std::set<std::string> old_hosts_set = GetDistinctHosts(old_list, false);
+ std::set<std::string> new_hosts_set(GetDistinctHosts(new_list, false, false));
+ std::set<std::string> old_hosts_set(GetDistinctHosts(old_list, false, false));
std::set<std::string> new_hosts_only;
std::set_difference(new_hosts_set.begin(), new_hosts_set.end(),

Powered by Google App Engine
This is Rietveld 408576698