| OLD | NEW |
| 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 #include "ppapi/shared_impl/ppapi_permissions.h" | 5 #include "ppapi/shared_impl/ppapi_permissions.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "ppapi/shared_impl/ppapi_switches.h" | 9 #include "ppapi/shared_impl/ppapi_switches.h" |
| 10 | 10 |
| 11 namespace ppapi { | 11 namespace ppapi { |
| 12 | 12 |
| 13 PpapiPermissions::PpapiPermissions() : permissions_(0) { | 13 PpapiPermissions::PpapiPermissions() : permissions_(0) {} |
| 14 } | |
| 15 | 14 |
| 16 PpapiPermissions::PpapiPermissions(uint32 perms) : permissions_(perms) { | 15 PpapiPermissions::PpapiPermissions(uint32 perms) : permissions_(perms) {} |
| 17 } | |
| 18 | 16 |
| 19 PpapiPermissions::~PpapiPermissions() { | 17 PpapiPermissions::~PpapiPermissions() {} |
| 20 } | |
| 21 | 18 |
| 22 // static | 19 // static |
| 23 PpapiPermissions PpapiPermissions::AllPermissions() { | 20 PpapiPermissions PpapiPermissions::AllPermissions() { |
| 24 return PpapiPermissions(PERMISSION_ALL_BITS); | 21 return PpapiPermissions(PERMISSION_ALL_BITS); |
| 25 } | 22 } |
| 26 | 23 |
| 27 // static | 24 // static |
| 28 PpapiPermissions PpapiPermissions::GetForCommandLine(uint32 base_perms) { | 25 PpapiPermissions PpapiPermissions::GetForCommandLine(uint32 base_perms) { |
| 29 uint32 additional_permissions = 0; | 26 uint32 additional_permissions = 0; |
| 30 | 27 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 45 // represented in the future so don't want callers making assumptions about | 42 // represented in the future so don't want callers making assumptions about |
| 46 // bits. | 43 // bits. |
| 47 uint32 perm_int = static_cast<uint32>(perm); | 44 uint32 perm_int = static_cast<uint32>(perm); |
| 48 if (!perm_int) | 45 if (!perm_int) |
| 49 return true; // You always have "no permission". | 46 return true; // You always have "no permission". |
| 50 DCHECK((perm_int & (perm_int - 1)) == 0); | 47 DCHECK((perm_int & (perm_int - 1)) == 0); |
| 51 return !!(permissions_ & perm_int); | 48 return !!(permissions_ & perm_int); |
| 52 } | 49 } |
| 53 | 50 |
| 54 } // namespace ppapi | 51 } // namespace ppapi |
| OLD | NEW |