Added documentation to web_view.js/web_view_experimental.js regarding the webview...
[chromium-blink-merge.git] / ppapi / shared_impl / ppapi_permissions.h
blob3002df63d11ba3924c740b062a27ef0f42570b9e
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 |
44 PERMISSION_PRIVATE |
45 PERMISSION_BYPASS_USER_GESTURE |
46 PERMISSION_TESTING |
47 PERMISSION_FLASH |
48 PERMISSION_DEV_CHANNEL
51 class PPAPI_SHARED_EXPORT PpapiPermissions {
52 public:
53 // Initializes the permissions struct with no permissions.
54 PpapiPermissions();
56 // Initializes with the given permissions bits set.
57 explicit PpapiPermissions(uint32 perms);
59 ~PpapiPermissions();
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
67 // more features.
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_; }
75 private:
76 uint32 permissions_;
78 // Note: Copy & assign supported.
81 } // namespace ppapi
83 #endif // PPAPI_SHARED_IMPL_PPAPI_PERMISSIONS_H_