Chromium Code Reviews| 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(), |