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_PERMISSIONS_INFO_H_ | 5 #ifndef EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_INFO_H_ |
6 #define EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_INFO_H_ | 6 #define EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_INFO_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 const std::set<std::string>& permission_names) const; | 49 const std::set<std::string>& permission_names) const; |
50 | 50 |
51 // Checks if any permissions have names that start with |name| followed by a | 51 // Checks if any permissions have names that start with |name| followed by a |
52 // period. | 52 // period. |
53 bool HasChildPermissions(const std::string& name) const; | 53 bool HasChildPermissions(const std::string& name) const; |
54 | 54 |
55 // Gets the total number of API permissions. | 55 // Gets the total number of API permissions. |
56 size_t get_permission_count() const { return permission_count_; } | 56 size_t get_permission_count() const { return permission_count_; } |
57 | 57 |
58 private: | 58 private: |
59 friend struct base::DefaultLazyInstanceTraits<PermissionsInfo>; | 59 friend struct base::LazyInstanceTraitsBase<PermissionsInfo>; |
60 | 60 |
61 PermissionsInfo(); | 61 PermissionsInfo(); |
62 | 62 |
63 virtual ~PermissionsInfo(); | 63 virtual ~PermissionsInfo(); |
64 | 64 |
65 // Registers an |alias| for a given permission |name|. | 65 // Registers an |alias| for a given permission |name|. |
66 void RegisterAlias(const Alias& alias); | 66 void RegisterAlias(const Alias& alias); |
67 | 67 |
68 // Registers a permission with the specified attributes and flags. | 68 // Registers a permission with the specified attributes and flags. |
69 void RegisterPermission(std::unique_ptr<APIPermissionInfo> permission); | 69 void RegisterPermission(std::unique_ptr<APIPermissionInfo> permission); |
70 | 70 |
71 // Maps permission ids to permissions. Owns the permissions. | 71 // Maps permission ids to permissions. Owns the permissions. |
72 typedef std::map<APIPermission::ID, std::unique_ptr<APIPermissionInfo>> IDMap; | 72 typedef std::map<APIPermission::ID, std::unique_ptr<APIPermissionInfo>> IDMap; |
73 | 73 |
74 // Maps names and aliases to permissions. Doesn't own the permissions. | 74 // Maps names and aliases to permissions. Doesn't own the permissions. |
75 typedef std::map<std::string, APIPermissionInfo*> NameMap; | 75 typedef std::map<std::string, APIPermissionInfo*> NameMap; |
76 | 76 |
77 IDMap id_map_; | 77 IDMap id_map_; |
78 NameMap name_map_; | 78 NameMap name_map_; |
79 | 79 |
80 size_t permission_count_; | 80 size_t permission_count_; |
81 | 81 |
82 DISALLOW_COPY_AND_ASSIGN(PermissionsInfo); | 82 DISALLOW_COPY_AND_ASSIGN(PermissionsInfo); |
83 }; | 83 }; |
84 | 84 |
85 } // namespace extensions | 85 } // namespace extensions |
86 | 86 |
87 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_INFO_H_ | 87 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_INFO_H_ |
OLD | NEW |