| 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 PPAPI_SHARED_IMPL_PPAPI_PERMISSIONS_H_ | 5 #ifndef PPAPI_SHARED_IMPL_PPAPI_PERMISSIONS_H_ |
| 6 #define PPAPI_SHARED_IMPL_PPAPI_PERMISSIONS_H_ | 6 #define PPAPI_SHARED_IMPL_PPAPI_PERMISSIONS_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include <stdint.h> |
| 9 |
| 9 #include "ppapi/shared_impl/ppapi_shared_export.h" | 10 #include "ppapi/shared_impl/ppapi_shared_export.h" |
| 10 | 11 |
| 11 namespace ppapi { | 12 namespace ppapi { |
| 12 | 13 |
| 13 enum Permission { | 14 enum Permission { |
| 14 // Placeholder/uninitialized permission. | 15 // Placeholder/uninitialized permission. |
| 15 PERMISSION_NONE = 0, | 16 PERMISSION_NONE = 0, |
| 16 | 17 |
| 17 // Allows access to dev interfaces. These are experimental interfaces not | 18 // Allows access to dev interfaces. These are experimental interfaces not |
| 18 // tied to any particular release channel. | 19 // tied to any particular release channel. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 46 PERMISSION_FLASH | | 47 PERMISSION_FLASH | |
| 47 PERMISSION_DEV_CHANNEL | 48 PERMISSION_DEV_CHANNEL |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 class PPAPI_SHARED_EXPORT PpapiPermissions { | 51 class PPAPI_SHARED_EXPORT PpapiPermissions { |
| 51 public: | 52 public: |
| 52 // Initializes the permissions struct with no permissions. | 53 // Initializes the permissions struct with no permissions. |
| 53 PpapiPermissions(); | 54 PpapiPermissions(); |
| 54 | 55 |
| 55 // Initializes with the given permissions bits set. | 56 // Initializes with the given permissions bits set. |
| 56 explicit PpapiPermissions(uint32 perms); | 57 explicit PpapiPermissions(uint32_t perms); |
| 57 | 58 |
| 58 ~PpapiPermissions(); | 59 ~PpapiPermissions(); |
| 59 | 60 |
| 60 // Returns a permissions class with all features enabled. This is for testing | 61 // Returns a permissions class with all features enabled. This is for testing |
| 61 // and manually registered plugins. | 62 // and manually registered plugins. |
| 62 static PpapiPermissions AllPermissions(); | 63 static PpapiPermissions AllPermissions(); |
| 63 | 64 |
| 64 // Returns the effective permissions given the "base" permissions granted | 65 // Returns the effective permissions given the "base" permissions granted |
| 65 // to the given plugin and the current command line flags, which may enable | 66 // to the given plugin and the current command line flags, which may enable |
| 66 // more features. | 67 // more features. |
| 67 static PpapiPermissions GetForCommandLine(uint32 base_perms); | 68 static PpapiPermissions GetForCommandLine(uint32_t base_perms); |
| 68 | 69 |
| 69 bool HasPermission(Permission perm) const; | 70 bool HasPermission(Permission perm) const; |
| 70 | 71 |
| 71 // Returns the internal permission bits. Use for serialization only. | 72 // Returns the internal permission bits. Use for serialization only. |
| 72 uint32 GetBits() const { return permissions_; } | 73 uint32_t GetBits() const { return permissions_; } |
| 73 | 74 |
| 74 private: | 75 private: |
| 75 uint32 permissions_; | 76 uint32_t permissions_; |
| 76 | 77 |
| 77 // Note: Copy & assign supported. | 78 // Note: Copy & assign supported. |
| 78 }; | 79 }; |
| 79 | 80 |
| 80 } // namespace ppapi | 81 } // namespace ppapi |
| 81 | 82 |
| 82 #endif // PPAPI_SHARED_IMPL_PPAPI_PERMISSIONS_H_ | 83 #endif // PPAPI_SHARED_IMPL_PPAPI_PERMISSIONS_H_ |
| OLD | NEW |