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_BROWSER_EXTENSIONS_EXTENSION_PERMISSIONS_API_HELPERS_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PERMISSIONS_API_HELPERS_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PERMISSIONS_API_HELPERS_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PERMISSIONS_API_HELPERS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | |
12 | |
13 namespace base { | 11 namespace base { |
14 class DictionaryValue; | 12 class DictionaryValue; |
15 } | 13 } |
| 14 |
16 class ExtensionPermissionSet; | 15 class ExtensionPermissionSet; |
17 | 16 |
18 namespace extensions { | 17 namespace extensions { |
19 | 18 |
20 namespace permissions_api { | 19 namespace api { |
| 20 namespace permissions { |
| 21 struct Permissions; |
| 22 } |
| 23 } |
| 24 |
| 25 namespace permissions_api_helpers { |
21 | 26 |
22 // Converts the permission |set| to a dictionary value. | 27 // Converts the permission |set| to a dictionary value. |
23 base::DictionaryValue* PackPermissionsToValue( | 28 base::DictionaryValue* PackPermissionsToValue( |
24 const ExtensionPermissionSet* set); | 29 const ExtensionPermissionSet* set); |
25 | 30 |
26 // Converts the |value| to a permission set. | 31 // Creates a permission set from |permissions|. Returns NULL if the permissions |
27 bool UnpackPermissionsFromValue(base::DictionaryValue* value, | 32 // cannot be converted to a permission set, in which case |error| will be set. |
28 scoped_refptr<ExtensionPermissionSet>* ptr, | 33 ExtensionPermissionSet* UnpackPermissionSet( |
29 bool* bad_message, | 34 const api::permissions::Permissions& permissions, std::string* error); |
30 std::string* error); | |
31 | 35 |
32 } // namespace permissions_api | 36 } // namespace permissions_api |
33 | |
34 } // namespace extensions | 37 } // namespace extensions |
35 | 38 |
36 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PERMISSIONS_API_HELPERS_H__ | 39 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PERMISSIONS_API_HELPERS_H__ |
OLD | NEW |