Commit 51827b32 authored by brettw@chromium.org's avatar brettw@chromium.org

Add pepper permissions to WebPluginInfo

This allows us to round-trip from PepperPluginInfo to WebPluginInfo and back. This happens in the component updater when it registers Flash.

BUG=138902


Review URL: https://chromiumcodereview.appspot.com/10831224

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150922 0039d316-1c4b-4281-b951-d872f2087c98
parent 1ee14a25
......@@ -22,10 +22,11 @@
#include "base/version.h"
#include "build/build_config.h"
#include "chrome/browser/component_updater/component_updater_service.h"
#include "chrome/common/pepper_flash.h"
#include "chrome/browser/plugin_prefs.h"
#include "chrome/common/pepper_flash.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/pepper_flash.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/plugin_service.h"
#include "content/public/common/pepper_plugin_info.h"
......@@ -145,9 +146,7 @@ bool MakePepperFlashPluginInfo(const FilePath& flash_path,
plugin_info->is_out_of_process = out_of_process;
plugin_info->path = flash_path;
plugin_info->name = kFlashPluginName;
plugin_info->permissions = ppapi::PERMISSION_DEV |
ppapi::PERMISSION_PRIVATE |
ppapi::PERMISSION_BYPASS_USER_GESTURE;
plugin_info->permissions = kPepperFlashPermissions;
// The description is like "Shockwave Flash 10.2 r154".
plugin_info->description = StringPrintf("%s %d.%d r%d",
......
......@@ -221,9 +221,7 @@ content::PepperPluginInfo CreatePepperFlashInfo(const FilePath& path,
switches::kPpapiFlashInProcess);
plugin.name = kFlashPluginName;
plugin.path = path;
plugin.permissions = ppapi::PERMISSION_DEV |
ppapi::PERMISSION_PRIVATE |
ppapi::PERMISSION_BYPASS_USER_GESTURE;
plugin.permissions = kPepperFlashPermissions;
std::vector<std::string> flash_version_numbers;
base::SplitString(version, '.', &flash_version_numbers);
......
......@@ -10,6 +10,7 @@
#include "base/metrics/field_trial.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
#include "ppapi/shared_impl/ppapi_permissions.h"
#if defined(OS_WIN)
#include "base/win/metro.h"
......@@ -107,3 +108,9 @@ bool IsPepperFlashEnabledByDefault() {
return false;
#endif
}
int32 kPepperFlashPermissions = ppapi::PERMISSION_DEV |
ppapi::PERMISSION_PRIVATE |
ppapi::PERMISSION_BYPASS_USER_GESTURE;
......@@ -5,10 +5,15 @@
#ifndef CHROME_COMMON_PEPPER_FLASH_H_
#define CHROME_COMMON_PEPPER_FLASH_H_
#include "base/basictypes.h"
// Whether a field trial for Pepper Flash is going on.
bool ConductingPepperFlashFieldTrial();
// True if Pepper Flash should be enabled by default.
bool IsPepperFlashEnabledByDefault();
// Permission bits for Pepper Flash.
extern int32 kPepperFlashPermissions;
#endif // CHROME_COMMON_PEPPER_FLASH_H_
......@@ -96,6 +96,7 @@ webkit::WebPluginInfo content::PepperPluginInfo::ToWebPluginInfo() const {
info.version = ASCIIToUTF16(version);
info.desc = ASCIIToUTF16(description);
info.mime_types = mime_types;
info.pepper_permissions = permissions;
return info;
}
......@@ -114,6 +115,8 @@ bool MakePepperPluginInfo(const webkit::WebPluginInfo& webplugin_info,
pepper_info->description = UTF16ToASCII(webplugin_info.desc);
pepper_info->version = UTF16ToASCII(webplugin_info.version);
pepper_info->mime_types = webplugin_info.mime_types;
pepper_info->permissions = webplugin_info.pepper_permissions;
return true;
}
......
......@@ -22,7 +22,9 @@ WebPluginMimeType::WebPluginMimeType(const std::string& m,
WebPluginMimeType::~WebPluginMimeType() {}
WebPluginInfo::WebPluginInfo() : type(PLUGIN_TYPE_NPAPI) {
WebPluginInfo::WebPluginInfo()
: type(PLUGIN_TYPE_NPAPI),
pepper_permissions(0) {
}
WebPluginInfo::WebPluginInfo(const WebPluginInfo& rhs)
......@@ -31,7 +33,8 @@ WebPluginInfo::WebPluginInfo(const WebPluginInfo& rhs)
version(rhs.version),
desc(rhs.desc),
mime_types(rhs.mime_types),
type(rhs.type) {
type(rhs.type),
pepper_permissions(rhs.pepper_permissions) {
}
WebPluginInfo::~WebPluginInfo() {}
......@@ -43,6 +46,7 @@ WebPluginInfo& WebPluginInfo::operator=(const WebPluginInfo& rhs) {
desc = rhs.desc;
mime_types = rhs.mime_types;
type = rhs.type;
pepper_permissions = rhs.pepper_permissions;
return *this;
}
......@@ -55,7 +59,8 @@ WebPluginInfo::WebPluginInfo(const string16& fake_name,
version(fake_version),
desc(fake_desc),
mime_types(),
type(PLUGIN_TYPE_NPAPI) {
type(PLUGIN_TYPE_NPAPI),
pepper_permissions(0) {
}
bool IsPepperPlugin(const WebPluginInfo& plugin) {
......
......@@ -74,6 +74,9 @@ struct WEBKIT_PLUGINS_EXPORT WebPluginInfo {
// Plugin type. See the PluginType enum.
int type;
// When type is PLUGIN_TYPE_PEPPER_* this indicates the permission bits.
int32 pepper_permissions;
};
// Checks whether a plugin is a Pepper plugin, enabled or disabled.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment