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

Side by Side Diff: chrome/common/extensions/permissions/permission_set.h

Issue 12209094: Support requesting subsets of host permissions using the permissions API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: are you happy yet?!?!? Created 7 years, 10 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
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | chrome/common/extensions/permissions/permission_set.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_
6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_ 6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 static PermissionSet* CreateUnion( 60 static PermissionSet* CreateUnion(
61 const PermissionSet* set1, const PermissionSet* set2); 61 const PermissionSet* set1, const PermissionSet* set2);
62 62
63 // Creates a new permission set that only contains permissions that must be 63 // Creates a new permission set that only contains permissions that must be
64 // in the manifest. Passes ownership of the new set to the caller. 64 // in the manifest. Passes ownership of the new set to the caller.
65 static PermissionSet* ExcludeNotInManifestPermissions( 65 static PermissionSet* ExcludeNotInManifestPermissions(
66 const PermissionSet* set); 66 const PermissionSet* set);
67 67
68 bool operator==(const PermissionSet& rhs) const; 68 bool operator==(const PermissionSet& rhs) const;
69 69
70 // Returns true if |set| is a subset of this. 70 // Returns true if every API or host permission available to |set| is also
71 // available to this. In other words, if the API permissions of |set| are a
72 // subset of this, and the host permissions in this encompass those in |set|.
71 bool Contains(const PermissionSet& set) const; 73 bool Contains(const PermissionSet& set) const;
72 74
73 // Gets the API permissions in this set as a set of strings. 75 // Gets the API permissions in this set as a set of strings.
74 std::set<std::string> GetAPIsAsStrings() const; 76 std::set<std::string> GetAPIsAsStrings() const;
75 77
76 // Returns whether this namespace has any functions which the extension has 78 // Returns whether this namespace has any functions which the extension has
77 // permission to use. For example, even though the extension may not have 79 // permission to use. For example, even though the extension may not have
78 // the "tabs" permission, "tabs.create" requires no permissions so 80 // the "tabs" permission, "tabs.create" requires no permissions so
79 // HasAnyAccessToAPI("tabs") will return true. 81 // HasAnyAccessToAPI("tabs") will return true.
80 bool HasAnyAccessToAPI(const std::string& api_name) const; 82 bool HasAnyAccessToAPI(const std::string& api_name) const;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 // TODO(jstritar): Rename to "user_script_hosts_"? 203 // TODO(jstritar): Rename to "user_script_hosts_"?
202 URLPatternSet scriptable_hosts_; 204 URLPatternSet scriptable_hosts_;
203 205
204 // The list of hosts this effectively grants access to. 206 // The list of hosts this effectively grants access to.
205 URLPatternSet effective_hosts_; 207 URLPatternSet effective_hosts_;
206 }; 208 };
207 209
208 } // namespace extensions 210 } // namespace extensions
209 211
210 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_ 212 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_
OLDNEW
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | chrome/common/extensions/permissions/permission_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698