Chromium Code Reviews| Index: content/public/common/pepper_permissions_config.cc |
| diff --git a/content/public/common/pepper_permissions_config.cc b/content/public/common/pepper_permissions_config.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..33f58d26732f419a26e4aec800ba939137448ddc |
| --- /dev/null |
| +++ b/content/public/common/pepper_permissions_config.cc |
| @@ -0,0 +1,33 @@ |
| +// 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 "content/public/common/pepper_permissions_config.h" |
| + |
| +#include "base/command_line.h" |
| +#include "content/public/common/pepper_plugin_info.h" |
| +#include "webkit/plugins/plugin_switches.h" |
| + |
| +namespace content { |
| + |
| +ppapi::PpapiPermissions AddPepperPermissionsFromCommandLine( |
| + const ppapi::PpapiPermissions& original_perms) { |
| + uint32 additional_permissions = 0; |
| + |
| + // Testing permissions. The testing flag implies all permissions since the |
| + // test plugin needs to test all interfaces. |
| + if (CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kEnablePepperTesting)) |
| + additional_permissions |= ppapi::PERMISSION_ALL_BITS; |
| + |
| + return ppapi::PpapiPermissions( |
| + original_perms.GetBits() | additional_permissions); |
|
jam
2012/09/28 23:15:16
i'm not sure I follow, why is this file needed? th
|
| +} |
| + |
| +ppapi::PpapiPermissions CreatePepperPermissionsForPlugin( |
| + const PepperPluginInfo& info) { |
| + return AddPepperPermissionsFromCommandLine( |
| + ppapi::PpapiPermissions(info.permissions)); |
| +} |
| + |
| +} // namespace content |