Hook the WebThreadImplForMessageLoop up to post taks through the blink
[chromium-blink-merge.git] / ppapi / shared_impl / ppapi_permissions.h
blob8a12206b9d412ed179fa2a21929380555630369d
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"
11 namespace ppapi {
13 enum Permission {
14 // Placeholder/uninitialized permission.
15 PERMISSION_NONE = 0,
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
36 // Chrome.
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 | PERMISSION_PRIVATE |
44 PERMISSION_BYPASS_USER_GESTURE |
45 PERMISSION_TESTING |
46 PERMISSION_FLASH |
47 PERMISSION_DEV_CHANNEL
50 class PPAPI_SHARED_EXPORT PpapiPermissions {
51 public:
52 // Initializes the permissions struct with no permissions.
53 PpapiPermissions();
55 // Initializes with the given permissions bits set.
56 explicit PpapiPermissions(uint32 perms);
58 ~PpapiPermissions();
60 // Returns a permissions class with all features enabled. This is for testing
61 // and manually registered plugins.
62 static PpapiPermissions AllPermissions();
64 // Returns the effective permissions given the "base" permissions granted
65 // to the given plugin and the current command line flags, which may enable
66 // more features.
67 static PpapiPermissions GetForCommandLine(uint32 base_perms);
69 bool HasPermission(Permission perm) const;
71 // Returns the internal permission bits. Use for serialization only.
72 uint32 GetBits() const { return permissions_; }
74 private:
75 uint32 permissions_;
77 // Note: Copy & assign supported.
80 } // namespace ppapi
82 #endif // PPAPI_SHARED_IMPL_PPAPI_PERMISSIONS_H_