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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 return (flags_ & kFlagCannotBeOptional) == 0; | 302 return (flags_ & kFlagCannotBeOptional) == 0; |
303 } | 303 } |
304 | 304 |
305 // Returns true if this permission is internal rather than a | 305 // Returns true if this permission is internal rather than a |
306 // "permissions" list entry. | 306 // "permissions" list entry. |
307 bool is_internal() const { | 307 bool is_internal() const { |
308 return (flags_ & kFlagInternal) != 0; | 308 return (flags_ & kFlagInternal) != 0; |
309 } | 309 } |
310 | 310 |
311 private: | 311 private: |
312 // Instances should only be constructed from within a | 312 // Instances should only be constructed from within a PermissionsProvider. |
313 // PermissionsInfo::Delegate. | |
314 friend class ChromeAPIPermissions; | 313 friend class ChromeAPIPermissions; |
315 // Implementations of APIPermission will want to get the permission message, | 314 // Implementations of APIPermission will want to get the permission message, |
316 // but this class's implementation should be hidden from everyone else. | 315 // but this class's implementation should be hidden from everyone else. |
317 friend class APIPermission; | 316 friend class APIPermission; |
318 | 317 |
319 explicit APIPermissionInfo( | 318 explicit APIPermissionInfo( |
320 APIPermission::ID id, | 319 APIPermission::ID id, |
321 const char* name, | 320 const char* name, |
322 int l10n_message_id, | 321 int l10n_message_id, |
323 PermissionMessage::ID message_id, | 322 PermissionMessage::ID message_id, |
324 int flags, | 323 int flags, |
325 APIPermissionConstructor api_permission_constructor); | 324 APIPermissionConstructor api_permission_constructor); |
326 | 325 |
327 // Returns the localized permission message associated with this api. | 326 // Returns the localized permission message associated with this api. |
328 // Use GetMessage_ to avoid name conflict with macro GetMessage on Windows. | 327 // Use GetMessage_ to avoid name conflict with macro GetMessage on Windows. |
329 PermissionMessage GetMessage_() const; | 328 PermissionMessage GetMessage_() const; |
330 | 329 |
331 const APIPermission::ID id_; | 330 const APIPermission::ID id_; |
332 const char* const name_; | 331 const char* const name_; |
333 const int flags_; | 332 const int flags_; |
334 const int l10n_message_id_; | 333 const int l10n_message_id_; |
335 const PermissionMessage::ID message_id_; | 334 const PermissionMessage::ID message_id_; |
336 const APIPermissionConstructor api_permission_constructor_; | 335 const APIPermissionConstructor api_permission_constructor_; |
337 }; | 336 }; |
338 | 337 |
339 } // namespace extensions | 338 } // namespace extensions |
340 | 339 |
341 #endif // EXTENSIONS_COMMON_PERMISSIONS_API_PERMISSION_H_ | 340 #endif // EXTENSIONS_COMMON_PERMISSIONS_API_PERMISSION_H_ |
OLD | NEW |