OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 EXTENSIONS_COMMON_PERMISSIONS_API_PERMISSION_H_ | 5 #ifndef EXTENSIONS_COMMON_PERMISSIONS_API_PERMISSION_H_ |
6 #define EXTENSIONS_COMMON_PERMISSIONS_API_PERMISSION_H_ | 6 #define EXTENSIONS_COMMON_PERMISSIONS_API_PERMISSION_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // Returns true if the given permission is allowed. | 203 // Returns true if the given permission is allowed. |
204 virtual bool Check(const CheckParam* param) const = 0; | 204 virtual bool Check(const CheckParam* param) const = 0; |
205 | 205 |
206 // Returns true if |rhs| is a subset of this. | 206 // Returns true if |rhs| is a subset of this. |
207 virtual bool Contains(const APIPermission* rhs) const = 0; | 207 virtual bool Contains(const APIPermission* rhs) const = 0; |
208 | 208 |
209 // Returns true if |rhs| is equal to this. | 209 // Returns true if |rhs| is equal to this. |
210 virtual bool Equal(const APIPermission* rhs) const = 0; | 210 virtual bool Equal(const APIPermission* rhs) const = 0; |
211 | 211 |
212 // Parses the APIPermission from |value|. Returns false if an error happens | 212 // Parses the APIPermission from |value|. Returns false if an error happens |
213 // and optionally set |error| if |error| is not NULL. | 213 // and optionally set |error| if |error| is not NULL. If |value| represents |
214 virtual bool FromValue(const base::Value* value, std::string* error) = 0; | 214 // multiple permissions, some are invalid, and |unhandled_permissions| is |
| 215 // not NULL, the invalid ones are put into |unhandled_permissions| and the |
| 216 // function returns true. |
| 217 virtual bool FromValue(const base::Value* value, |
| 218 std::string* error, |
| 219 std::vector<std::string>* unhandled_permissions) = 0; |
215 | 220 |
216 // Stores this into a new created |value|. | 221 // Stores this into a new created |value|. |
217 virtual scoped_ptr<base::Value> ToValue() const = 0; | 222 virtual scoped_ptr<base::Value> ToValue() const = 0; |
218 | 223 |
219 // Clones this. | 224 // Clones this. |
220 virtual APIPermission* Clone() const = 0; | 225 virtual APIPermission* Clone() const = 0; |
221 | 226 |
222 // Returns a new API permission which equals this - |rhs|. | 227 // Returns a new API permission which equals this - |rhs|. |
223 virtual APIPermission* Diff(const APIPermission* rhs) const = 0; | 228 virtual APIPermission* Diff(const APIPermission* rhs) const = 0; |
224 | 229 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 const char* const name_; | 341 const char* const name_; |
337 const int flags_; | 342 const int flags_; |
338 const int l10n_message_id_; | 343 const int l10n_message_id_; |
339 const PermissionMessage::ID message_id_; | 344 const PermissionMessage::ID message_id_; |
340 const APIPermissionConstructor api_permission_constructor_; | 345 const APIPermissionConstructor api_permission_constructor_; |
341 }; | 346 }; |
342 | 347 |
343 } // namespace extensions | 348 } // namespace extensions |
344 | 349 |
345 #endif // EXTENSIONS_COMMON_PERMISSIONS_API_PERMISSION_H_ | 350 #endif // EXTENSIONS_COMMON_PERMISSIONS_API_PERMISSION_H_ |
OLD | NEW |