summaryrefslogtreecommitdiffstats
path: root/ppapi/shared_impl/ppapi_permissions.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-13 04:28:40 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-13 04:28:40 +0000
commit24cddd42154b07c6559846b2159a88a3feabb5d5 (patch)
tree96b150cab1ff6de13845f0e36c51735fed34be9e /ppapi/shared_impl/ppapi_permissions.cc
parent56a4bf839077e7dfd8cb178b8d8ad09f5215dead (diff)
downloadchromium_src-24cddd42154b07c6559846b2159a88a3feabb5d5.zip
chromium_src-24cddd42154b07c6559846b2159a88a3feabb5d5.tar.gz
chromium_src-24cddd42154b07c6559846b2159a88a3feabb5d5.tar.bz2
Add permissions buts for Pepper plugins.
This patch doesn't actually hook anything up, but it plumbs them in for the laces we'll need it. Review URL: https://chromiumcodereview.appspot.com/10735011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146519 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/shared_impl/ppapi_permissions.cc')
-rw-r--r--ppapi/shared_impl/ppapi_permissions.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/ppapi/shared_impl/ppapi_permissions.cc b/ppapi/shared_impl/ppapi_permissions.cc
new file mode 100644
index 0000000..bcfdd96
--- /dev/null
+++ b/ppapi/shared_impl/ppapi_permissions.cc
@@ -0,0 +1,30 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/shared_impl/ppapi_permissions.h"
+
+#include "base/logging.h"
+
+namespace ppapi {
+
+PpapiPermissions::PpapiPermissions() : permissions_(0) {
+}
+
+PpapiPermissions::PpapiPermissions(uint32 perms) : permissions_(perms) {
+}
+
+PpapiPermissions::~PpapiPermissions() {
+}
+
+bool PpapiPermissions::HasPermission(Permission perm) const {
+ // Check that "perm" is a power of two to make sure the caller didn't set
+ // more than one permission bit. We may want to change how permissions are
+ // represented in the future so don't want callers making assumptions about
+ // bits.
+ uint32 perm_int = static_cast<uint32>(perm);
+ DCHECK((perm_int & (perm_int - 1)) == 0);
+ return !!(permissions_ & perm_int);
+}
+
+} // namespace ppapi