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

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

Issue 12093036: Move Extension Location and Type enums to Manifest, and move InstallWarning to its own file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/singleton.h" 15 #include "base/memory/singleton.h"
16 #include "base/string16.h" 16 #include "base/string16.h"
17 #include "chrome/common/extensions/extension.h" 17 #include "chrome/common/extensions/manifest.h"
18 #include "chrome/common/extensions/permissions/api_permission.h" 18 #include "chrome/common/extensions/permissions/api_permission.h"
19 #include "chrome/common/extensions/permissions/api_permission_set.h" 19 #include "chrome/common/extensions/permissions/api_permission_set.h"
20 #include "chrome/common/extensions/permissions/permission_message.h" 20 #include "chrome/common/extensions/permissions/permission_message.h"
21 #include "extensions/common/url_pattern_set.h" 21 #include "extensions/common/url_pattern_set.h"
22 22
23 namespace extensions { 23 namespace extensions {
24 class Extension;
24 25
25 // The PermissionSet is an immutable class that encapsulates an 26 // The PermissionSet is an immutable class that encapsulates an
26 // extension's permissions. The class exposes set operations for combining and 27 // extension's permissions. The class exposes set operations for combining and
27 // manipulating the permissions. 28 // manipulating the permissions.
28 class PermissionSet 29 class PermissionSet
29 : public base::RefCountedThreadSafe<PermissionSet> { 30 : public base::RefCountedThreadSafe<PermissionSet> {
30 public: 31 public:
31 // Creates an empty permission set (e.g. default permissions). 32 // Creates an empty permission set (e.g. default permissions).
32 PermissionSet(); 33 PermissionSet();
33 34
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 std::set<std::string> GetAPIsAsStrings() const; 74 std::set<std::string> GetAPIsAsStrings() const;
74 75
75 // Returns whether this namespace has any functions which the extension has 76 // Returns whether this namespace has any functions which the extension has
76 // permission to use. For example, even though the extension may not have 77 // permission to use. For example, even though the extension may not have
77 // the "tabs" permission, "tabs.create" requires no permissions so 78 // the "tabs" permission, "tabs.create" requires no permissions so
78 // HasAnyAccessToAPI("tabs") will return true. 79 // HasAnyAccessToAPI("tabs") will return true.
79 bool HasAnyAccessToAPI(const std::string& api_name) const; 80 bool HasAnyAccessToAPI(const std::string& api_name) const;
80 81
81 // Gets the localized permission messages that represent this set. 82 // Gets the localized permission messages that represent this set.
82 // The set of permission messages shown varies by extension type. 83 // The set of permission messages shown varies by extension type.
83 PermissionMessages GetPermissionMessages(Extension::Type extension_type) 84 PermissionMessages GetPermissionMessages(Manifest::Type extension_type)
84 const; 85 const;
85 86
86 // Gets the localized permission messages that represent this set (represented 87 // Gets the localized permission messages that represent this set (represented
87 // as strings). The set of permission messages shown varies by extension type. 88 // as strings). The set of permission messages shown varies by extension type.
88 std::vector<string16> GetWarningMessages(Extension::Type extension_type) 89 std::vector<string16> GetWarningMessages(Manifest::Type extension_type)
89 const; 90 const;
90 91
91 // Returns true if this is an empty set (e.g., the default permission set). 92 // Returns true if this is an empty set (e.g., the default permission set).
92 bool IsEmpty() const; 93 bool IsEmpty() const;
93 94
94 // Returns true if the set has the specified API permission. 95 // Returns true if the set has the specified API permission.
95 bool HasAPIPermission(APIPermission::ID permission) const; 96 bool HasAPIPermission(APIPermission::ID permission) const;
96 97
97 // Returns true if the set allows the given permission with the default 98 // Returns true if the set allows the given permission with the default
98 // permission detal. 99 // permission detal.
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // TODO(jstritar): Rename to "user_script_hosts_"? 198 // TODO(jstritar): Rename to "user_script_hosts_"?
198 URLPatternSet scriptable_hosts_; 199 URLPatternSet scriptable_hosts_;
199 200
200 // The list of hosts this effectively grants access to. 201 // The list of hosts this effectively grants access to.
201 URLPatternSet effective_hosts_; 202 URLPatternSet effective_hosts_;
202 }; 203 };
203 204
204 } // namespace extensions 205 } // namespace extensions
205 206
206 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_ 207 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/manifest_url_handler.cc ('k') | chrome/common/extensions/permissions/permission_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698