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