| OLD | NEW |
| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 std::set<std::string> GetAPIsAsStrings() const; | 71 std::set<std::string> GetAPIsAsStrings() const; |
| 72 | 72 |
| 73 // Returns whether this namespace has any functions which the extension has | 73 // Returns whether this namespace has any functions which the extension has |
| 74 // permission to use. For example, even though the extension may not have | 74 // permission to use. For example, even though the extension may not have |
| 75 // the "tabs" permission, "tabs.create" requires no permissions so | 75 // the "tabs" permission, "tabs.create" requires no permissions so |
| 76 // HasAnyAccessToAPI("tabs") will return true. | 76 // HasAnyAccessToAPI("tabs") will return true. |
| 77 bool HasAnyAccessToAPI(const std::string& api_name) const; | 77 bool HasAnyAccessToAPI(const std::string& api_name) const; |
| 78 | 78 |
| 79 // Gets the localized permission messages that represent this set. | 79 // Gets the localized permission messages that represent this set. |
| 80 // The set of permission messages shown varies by extension type. | 80 // The set of permission messages shown varies by extension type. |
| 81 PermissionMessages GetPermissionMessages(Manifest::Type extension_type) | 81 // PermissionMessages come in two flavors, overview or detailed and the way to |
| 82 const; | 82 // request one or the other is through the |details_only| parameter. |
| 83 PermissionMessages GetPermissionMessages( |
| 84 Manifest::Type extension_type, bool details_only) const; |
| 83 | 85 |
| 84 // Gets the localized permission messages that represent this set (represented | 86 // Gets the localized permission messages that represent this set (represented |
| 85 // as strings). The set of permission messages shown varies by extension type. | 87 // as strings). The set of permission messages shown varies by extension type. |
| 86 std::vector<string16> GetWarningMessages(Manifest::Type extension_type) | 88 // PermissionMessages come in two flavors, overview or detailed and the way to |
| 87 const; | 89 // request one or the other is through the |details_only| parameter. |
| 90 std::vector<string16> GetWarningMessages( |
| 91 Manifest::Type extension_type, bool details_only) const; |
| 88 | 92 |
| 89 // Returns true if this is an empty set (e.g., the default permission set). | 93 // Returns true if this is an empty set (e.g., the default permission set). |
| 90 bool IsEmpty() const; | 94 bool IsEmpty() const; |
| 91 | 95 |
| 92 // Returns true if the set has the specified API permission. | 96 // Returns true if the set has the specified API permission. |
| 93 bool HasAPIPermission(APIPermission::ID permission) const; | 97 bool HasAPIPermission(APIPermission::ID permission) const; |
| 94 | 98 |
| 95 // Returns true if the set allows the given permission with the default | 99 // Returns true if the set allows the given permission with the default |
| 96 // permission detal. | 100 // permission detal. |
| 97 bool CheckAPIPermission(APIPermission::ID permission) const; | 101 bool CheckAPIPermission(APIPermission::ID permission) const; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 // Adds permissions implied independently of other context. | 168 // Adds permissions implied independently of other context. |
| 165 void InitImplicitPermissions(); | 169 void InitImplicitPermissions(); |
| 166 | 170 |
| 167 // Initializes the effective host permission based on the data in this set. | 171 // Initializes the effective host permission based on the data in this set. |
| 168 void InitEffectiveHosts(); | 172 void InitEffectiveHosts(); |
| 169 | 173 |
| 170 // Gets the permission messages for the API permissions. | 174 // Gets the permission messages for the API permissions. |
| 171 std::set<PermissionMessage> GetAPIPermissionMessages() const; | 175 std::set<PermissionMessage> GetAPIPermissionMessages() const; |
| 172 | 176 |
| 173 // Gets the permission messages for the host permissions. | 177 // Gets the permission messages for the host permissions. |
| 178 // PermissionMessages come in two flavors, overview or detailed and the way to |
| 179 // request one or the other is through the |details_only| parameter. |
| 174 std::set<PermissionMessage> GetHostPermissionMessages( | 180 std::set<PermissionMessage> GetHostPermissionMessages( |
| 175 Manifest::Type extension_type) const; | 181 Manifest::Type extension_type, bool details_only) const; |
| 176 | 182 |
| 177 // Returns true if |permissions| has an elevated API privilege level than | 183 // Returns true if |permissions| has an elevated API privilege level than |
| 178 // this set. | 184 // this set. |
| 179 bool HasLessAPIPrivilegesThan(const PermissionSet* permissions) const; | 185 bool HasLessAPIPrivilegesThan(const PermissionSet* permissions) const; |
| 180 | 186 |
| 181 // Returns true if |permissions| has more host permissions compared to this | 187 // Returns true if |permissions| has more host permissions compared to this |
| 182 // set. | 188 // set. |
| 183 bool HasLessHostPrivilegesThan(const PermissionSet* permissions, | 189 bool HasLessHostPrivilegesThan(const PermissionSet* permissions, |
| 184 Manifest::Type extension_type) const; | 190 Manifest::Type extension_type) const; |
| 185 | 191 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 200 // TODO(jstritar): Rename to "user_script_hosts_"? | 206 // TODO(jstritar): Rename to "user_script_hosts_"? |
| 201 URLPatternSet scriptable_hosts_; | 207 URLPatternSet scriptable_hosts_; |
| 202 | 208 |
| 203 // The list of hosts this effectively grants access to. | 209 // The list of hosts this effectively grants access to. |
| 204 URLPatternSet effective_hosts_; | 210 URLPatternSet effective_hosts_; |
| 205 }; | 211 }; |
| 206 | 212 |
| 207 } // namespace extensions | 213 } // namespace extensions |
| 208 | 214 |
| 209 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_ | 215 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_ |
| OLD | NEW |