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

Side by Side Diff: chrome/common/extensions/extension_permission_set.cc

Issue 8138004: Fix issues related to <all_urls> in extensions. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: make the plugin.dll empty so it loads everywhere Created 9 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/extensions/extension_permission_set.h" 5 #include "chrome/common/extensions/extension_permission_set.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 std::set<std::string> distinct_hosts; 743 std::set<std::string> distinct_hosts;
744 for (HostVector::iterator it = hosts_best_rcd.begin(); 744 for (HostVector::iterator it = hosts_best_rcd.begin();
745 it != hosts_best_rcd.end(); ++it) 745 it != hosts_best_rcd.end(); ++it)
746 distinct_hosts.insert(it->first + it->second); 746 distinct_hosts.insert(it->first + it->second);
747 return distinct_hosts; 747 return distinct_hosts;
748 } 748 }
749 749
750 void ExtensionPermissionSet::InitEffectiveHosts() { 750 void ExtensionPermissionSet::InitEffectiveHosts() {
751 effective_hosts_.ClearPatterns(); 751 effective_hosts_.ClearPatterns();
752 752
753 if (HasEffectiveAccessToAllHosts()) {
754 URLPattern all_urls(URLPattern::SCHEME_ALL);
755 all_urls.SetMatchAllURLs(true);
756 effective_hosts_.AddPattern(all_urls);
757 return;
758 }
759
760 URLPatternSet::CreateUnion( 753 URLPatternSet::CreateUnion(
761 explicit_hosts(), scriptable_hosts(), &effective_hosts_); 754 explicit_hosts(), scriptable_hosts(), &effective_hosts_);
762 } 755 }
763 756
764 void ExtensionPermissionSet::InitImplicitExtensionPermissions( 757 void ExtensionPermissionSet::InitImplicitExtensionPermissions(
765 const Extension* extension) { 758 const Extension* extension) {
766 // Add the implied permissions. 759 // Add the implied permissions.
767 if (!extension->plugins().empty()) 760 if (!extension->plugins().empty())
768 apis_.insert(ExtensionAPIPermission::kPlugin); 761 apis_.insert(ExtensionAPIPermission::kPlugin);
769 762
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 std::set<std::string> new_hosts_set(GetDistinctHosts(new_list, false, false)); 833 std::set<std::string> new_hosts_set(GetDistinctHosts(new_list, false, false));
841 std::set<std::string> old_hosts_set(GetDistinctHosts(old_list, false, false)); 834 std::set<std::string> old_hosts_set(GetDistinctHosts(old_list, false, false));
842 std::set<std::string> new_hosts_only; 835 std::set<std::string> new_hosts_only;
843 836
844 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), 837 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(),
845 old_hosts_set.begin(), old_hosts_set.end(), 838 old_hosts_set.begin(), old_hosts_set.end(),
846 std::inserter(new_hosts_only, new_hosts_only.begin())); 839 std::inserter(new_hosts_only, new_hosts_only.begin()));
847 840
848 return !new_hosts_only.empty(); 841 return !new_hosts_only.empty();
849 } 842 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_browsertest.cc ('k') | chrome/common/extensions/extension_permission_set_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698