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
3 // found in the LICENSE file.
5 #ifndef PPAPI_SHARED_IMPL_PPAPI_PERMISSIONS_H_
6 #define PPAPI_SHARED_IMPL_PPAPI_PERMISSIONS_H_
8 #include "base/basictypes.h"
9 #include "ppapi/shared_impl/ppapi_shared_export.h"
14 // Placeholder/uninitialized permission.
17 // Allows access to dev interfaces.
18 PERMISSION_DEV
= 1 << 0,
20 // Allows access to Browser-internal interfaces.
21 PERMISSION_PRIVATE
= 1 << 1,
23 // Allows ability to bypass user-gesture checks for showing things like
24 // file select dialogs.
25 PERMISSION_BYPASS_USER_GESTURE
= 1 << 2,
27 // Testing-only interfaces.
28 PERMISSION_TESTING
= 1 << 3,
30 // Flash-related interfaces.
31 PERMISSION_FLASH
= 1 << 4,
33 // NOTE: If you add stuff be sure to update PERMISSION_ALL_BITS.
35 // Meta permission for initializing plugins registered on the command line
36 // that get all permissions.
37 PERMISSION_ALL_BITS
= PERMISSION_DEV
|
39 PERMISSION_BYPASS_USER_GESTURE
|
44 class PPAPI_SHARED_EXPORT PpapiPermissions
{
46 // Initializes the permissions struct with no permissions.
49 // Initializes with the given permissions bits set.
50 explicit PpapiPermissions(uint32 perms
);
54 // Returns a permissions class with all features enabled. This is for testing
55 // and manually registered plugins.
56 static PpapiPermissions
AllPermissions();
58 // Returns the effective permissions given the "base" permissions granted
59 // to the given plugin and the current command line flags, which may enable
61 static PpapiPermissions
GetForCommandLine(uint32 base_perms
);
63 bool HasPermission(Permission perm
) const;
65 // Returns the internal permission bits. Use for serialization only.
66 uint32
GetBits() const { return permissions_
; }
71 // Note: Copy & assign supported.
76 #endif // PPAPI_SHARED_IMPL_PPAPI_PERMISSIONS_H_