Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: ppapi/shared_impl/ppapi_permissions.h

Issue 10984094: Hook up PpapiPermissions in more places. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/basictypes.h"
9 #include "ppapi/shared_impl/ppapi_shared_export.h" 9 #include "ppapi/shared_impl/ppapi_shared_export.h"
10 10
11 namespace ppapi { 11 namespace ppapi {
12 12
13 enum Permission { 13 enum Permission {
14 // Placeholder/uninitialized permission.
15 PERMISSION_NONE = 0,
16
14 // Allows access to dev interfaces. 17 // Allows access to dev interfaces.
15 PERMISSION_DEV = 1 << 0, 18 PERMISSION_DEV = 1 << 0,
16 19
17 // Allows access to Browser-internal interfaces. 20 // Allows access to Browser-internal interfaces.
18 PERMISSION_PRIVATE = 1 << 2, 21 PERMISSION_PRIVATE = 1 << 1,
19 22
20 // Allows ability to bypass user-gesture checks for showing things like 23 // Allows ability to bypass user-gesture checks for showing things like
21 // file select dialogs. 24 // file select dialogs.
22 PERMISSION_BYPASS_USER_GESTURE = 1 << 3, 25 PERMISSION_BYPASS_USER_GESTURE = 1 << 2,
23 26
24 // NOTE: If you add stuff be sure to update AllPermissions(). 27 // Testing-only interfaces.
28 PERMISSION_TESTING = 1 << 3,
29
30 // Flash-related interfaces.
31 PERMISSION_FLASH = 1 << 4,
32
33 // NOTE: If you add stuff be sure to update PERMISSION_ALL_BITS.
34
35 // Meta permission for initializing plugins registered on the command line
36 // that get all permissions.
37 PERMISSION_ALL_BITS = PERMISSION_DEV |
38 PERMISSION_PRIVATE |
39 PERMISSION_BYPASS_USER_GESTURE |
40 PERMISSION_TESTING |
41 PERMISSION_FLASH
25 }; 42 };
26 43
27 class PPAPI_SHARED_EXPORT PpapiPermissions { 44 class PPAPI_SHARED_EXPORT PpapiPermissions {
28 public: 45 public:
29 // Initializes the permissions struct with no permissions. 46 // Initializes the permissions struct with no permissions.
30 PpapiPermissions(); 47 PpapiPermissions();
31 48
32 // Initializes with the given permissions bits set. 49 // Initializes with the given permissions bits set.
33 explicit PpapiPermissions(uint32 perms); 50 explicit PpapiPermissions(uint32 perms);
34 51
35 ~PpapiPermissions(); 52 ~PpapiPermissions();
36 53
37 // Returns a permissions class with all features enabled. This is for testing 54 // Returns a permissions class with all features enabled. This is for testing
38 // and manually registered plugins. 55 // and manually registered plugins.
39 static PpapiPermissions AllPermissions(); 56 static PpapiPermissions AllPermissions();
40 57
41 bool HasPermission(Permission perm) const; 58 bool HasPermission(Permission perm) const;
42 59
43 // TODO(brettw) bug 147507: Remove this when we fix the permissions bug 60 // Returns the internal permission bits. Use for serialization only.
44 // (this was added for logging).
45 uint32 GetBits() const { return permissions_; } 61 uint32 GetBits() const { return permissions_; }
46 62
47 private: 63 private:
48 uint32 permissions_; 64 uint32 permissions_;
49 65
50 // Note: Copy & assign supported. 66 // Note: Copy & assign supported.
51 }; 67 };
52 68
53 } // namespace ppapi 69 } // namespace ppapi
54 70
55 #endif // PPAPI_SHARED_IMPL_PPAPI_PERMISSIONS_H_ 71 #endif // PPAPI_SHARED_IMPL_PPAPI_PERMISSIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698