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. These are experimental interfaces not
18 // tied to any particular release channel.
19 PERMISSION_DEV
= 1 << 0,
21 // Allows access to Browser-internal interfaces.
22 PERMISSION_PRIVATE
= 1 << 1,
24 // Allows ability to bypass user-gesture checks for showing things like
25 // file select dialogs.
26 PERMISSION_BYPASS_USER_GESTURE
= 1 << 2,
28 // Testing-only interfaces.
29 PERMISSION_TESTING
= 1 << 3,
31 // Flash-related interfaces.
32 PERMISSION_FLASH
= 1 << 4,
34 // "Dev channel" interfaces. This is different than PERMISSION_DEV above;
35 // these interfaces may only be used on Dev or Canary channel releases of
37 PERMISSION_DEV_CHANNEL
= 1 << 5,
39 // NOTE: If you add stuff be sure to update PERMISSION_ALL_BITS.
41 // Meta permission for initializing plugins registered on the command line
42 // that get all permissions.
43 PERMISSION_ALL_BITS
= PERMISSION_DEV
|
45 PERMISSION_BYPASS_USER_GESTURE
|
48 PERMISSION_DEV_CHANNEL
51 class PPAPI_SHARED_EXPORT PpapiPermissions
{
53 // Initializes the permissions struct with no permissions.
56 // Initializes with the given permissions bits set.
57 explicit PpapiPermissions(uint32 perms
);
61 // Returns a permissions class with all features enabled. This is for testing
62 // and manually registered plugins.
63 static PpapiPermissions
AllPermissions();
65 // Returns the effective permissions given the "base" permissions granted
66 // to the given plugin and the current command line flags, which may enable
68 static PpapiPermissions
GetForCommandLine(uint32 base_perms
);
70 bool HasPermission(Permission perm
) const;
72 // Returns the internal permission bits. Use for serialization only.
73 uint32
GetBits() const { return permissions_
; }
78 // Note: Copy & assign supported.
83 #endif // PPAPI_SHARED_IMPL_PPAPI_PERMISSIONS_H_