Commit ee4dd68f authored by yzshen@chromium.org's avatar yzshen@chromium.org

Reland: Pepper Flash settings integration - camera and microphone.

The original code review: http://codereview.chromium.org/10479015/

TBR=csilv@chromium.org, brettw@chromium.org
BUG=112190
TEST=None

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141665 0039d316-1c4b-4281-b951-d872f2087c98
parent feca7602
......@@ -6959,6 +6959,18 @@ The following plug-in is unresponsive: <ph name="PLUGIN_NAME">$1
<message name="IDS_MOUSE_LOCK_BLOCK_RADIO" desc="A radio button in the Content Settings dialog for blocking all sites ability to disable the mouse cursor.">
Do not allow any site to disable the mouse cursor
</message>
<message name="IDS_PEPPER_FLASH_CAMERAMIC_TAB_LABEL" desc="Label for Pepper Flash camera and microphone tab on Content Settings dialog">
Flash camera and microphone
</message>
<message name="IDS_PEPPER_FLASH_CAMERAMIC_HEADER" desc="Label for Pepper Flash camera and microphone exception management page on Content Settings dialog">
Flash camera and microphone exceptions
</message>
<message name="IDS_PEPPER_FLASH_CAMERAMIC_ASK_RADIO" desc="A radio button in the Content Settings dialog for asking before allowing sites to use the camera or microphone.">
Ask me when a site wants to use the camera or microphone (recommended)
</message>
<message name="IDS_PEPPER_FLASH_CAMERAMIC_BLOCK_RADIO" desc="A radio button in the Content Settings dialog for blocking all sites from using the camera and microphone.">
Block all sites from using the camera and microphone
</message>
<if expr="pp_ifdef('chromeos')">
<message name="IDS_PROTECTED_CONTENT_TAB_LABEL" desc="Label for the Protected Content tab on the Content Settings dialog.">
Protected Content
......
......@@ -16,6 +16,8 @@ include_rules = [
"+ppapi/c", # For various types.
"+ppapi/proxy",
"+ppapi/shared_impl/api_id.h",
# Defines some types that are marshalled over IPC.
"+ppapi/shared_impl/ppp_flash_browser_operations_shared.h",
"+rlz",
"+sandbox/linux",
"+sandbox/src", # The path doesn't say it, but this is the Windows sandbox.
......
......@@ -8,6 +8,8 @@
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "ppapi/c/private/ppp_flash_browser_operations.h"
#include "ppapi/shared_impl/ppp_flash_browser_operations_shared.h"
class PluginPrefs;
class PrefService;
......@@ -29,7 +31,18 @@ class PepperFlashSettingsManager {
virtual ~Client() {}
virtual void OnDeauthorizeContentLicensesCompleted(uint32 request_id,
bool success) = 0;
bool success) {}
virtual void OnGetPermissionSettingsCompleted(
uint32 request_id,
bool success,
PP_Flash_BrowserOperations_Permission default_permission,
const ppapi::FlashSiteSettings& sites) {}
virtual void OnSetDefaultPermissionCompleted(uint32 request_id,
bool success) {}
virtual void OnSetSitePermissionCompleted(uint32 request_id,
bool success) {}
};
// |client| must outlive this object. It is guaranteed that |client| won't
......@@ -52,6 +65,26 @@ class PepperFlashSettingsManager {
// Client::OnDeauthorizeContentLicensesCompleted().
uint32 DeauthorizeContentLicenses();
// Gets permission settings.
// Client::OnGetPermissionSettingsCompleted() will be called when the
// operation is completed.
uint32 GetPermissionSettings(
PP_Flash_BrowserOperations_SettingType setting_type);
// Sets default permission.
// Client::OnSetDefaultPermissionCompleted() will be called when the
// operation is completed.
uint32 SetDefaultPermission(
PP_Flash_BrowserOperations_SettingType setting_type,
PP_Flash_BrowserOperations_Permission permission,
bool clear_site_specific);
// Sets site-specific permission.
// Client::OnSetSitePermissionCompleted() will be called when the operation
// is completed.
uint32 SetSitePermission(PP_Flash_BrowserOperations_SettingType setting_type,
const ppapi::FlashSiteSettings& sites);
private:
// Core does most of the work. It is ref-counted so that its lifespan can be
// independent of the containing object's:
......
......@@ -257,6 +257,27 @@
</label>
</div>
</section>
<!-- Pepper Flash camera and microphone filter -->
<section id="pepper-flash-cameramic-section" class="pepper-flash-settings">
<h3 i18n-content="pepperFlashCameramicTabLabel"></h3>
<div>
<div class="radio">
<label>
<input type="radio" name="pepper-flash-cameramic" value="ask">
<span i18n-content="pepperFlashCameramicAsk"></span>
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="pepper-flash-cameramic" value="block">
<span i18n-content="pepperFlashCameramicBlock"></span>
</label>
</div>
<button class="exceptions-list-button"
contentType="pepper-flash-cameramic"
i18n-content="manage_exceptions"></button>
</div>
</section>
<if expr="pp_ifdef('chromeos')">
<!-- Protected Content filter -->
<section guest-visibility="disabled">
......
......@@ -86,8 +86,6 @@ cr.define('options', function() {
OptionsPage.navigateToPage('cookies');
};
// Remove from DOM instead of hiding so :last-of-type applies the style
// correctly.
var intentsSection = $('intents-section');
if (!loadTimeData.getBoolean('enable_web_intents') && intentsSection)
intentsSection.parentNode.removeChild(intentsSection);
......@@ -99,6 +97,9 @@ cr.define('options', function() {
$('content-settings-overlay-confirm').onclick =
OptionsPage.closeOverlay.bind(OptionsPage);
$('pepper-flash-cameramic-section').style.display = 'none';
$('pepper-flash-cameramic-exceptions-div').style.display = 'none';
},
/**
......@@ -227,6 +228,16 @@ cr.define('options', function() {
exceptionsList.patternValidityCheckComplete(pattern, valid);
};
/**
* Enables the Pepper Flash camera and microphone settings.
* Please note that whether the settings are actually showed or not is also
* affected by the style class pepper-flash-settings.
*/
ContentSettings.enablePepperFlashCameraMicSettings = function() {
$('pepper-flash-cameramic-section').style.display = '';
$('pepper-flash-cameramic-exceptions-div').style.display = '';
}
// Export
return {
ContentSettings: ContentSettings
......
......@@ -76,6 +76,10 @@
<list mode="otr"></list>
</div>
</div>
<div id="pepper-flash-cameramic-exceptions-div"
contentType="pepper-flash-cameramic" class="pepper-flash-settings">
<list mode="normal"></list>
</div>
</div>
<div class="action-area">
<div class="button-strip">
......
......@@ -375,7 +375,8 @@ cr.define('options.contentSettings', function() {
var exceptionList = this;
// Whether the exceptions in this list allow an 'Ask every time' option.
this.enableAskOption = this.contentType == 'plugins';
this.enableAskOption = this.contentType == 'plugins' ||
this.contentType == 'pepper-flash-cameramic';
this.autoExpands = true;
this.reset();
......
......@@ -6,7 +6,11 @@
#define CHROME_BROWSER_UI_WEBUI_OPTIONS2_CONTENT_SETTINGS_HANDLER2_H_
#pragma once
#include "chrome/browser/plugin_data_remover_helper.h"
#include <map>
#include <string>
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/pepper_flash_settings_manager.h"
#include "chrome/browser/prefs/pref_change_registrar.h"
#include "chrome/browser/ui/webui/options2/options_ui2.h"
#include "chrome/common/content_settings_types.h"
......@@ -19,7 +23,8 @@ class ProtocolHandlerRegistry;
namespace options2 {
class ContentSettingsHandler : public OptionsPageUIHandler {
class ContentSettingsHandler : public OptionsPageUIHandler,
public PepperFlashSettingsManager::Client {
public:
ContentSettingsHandler();
virtual ~ContentSettingsHandler();
......@@ -35,20 +40,46 @@ class ContentSettingsHandler : public OptionsPageUIHandler {
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
// PepperFlashSettingsManager::Client implementation.
virtual void OnGetPermissionSettingsCompleted(
uint32 request_id,
bool success,
PP_Flash_BrowserOperations_Permission default_permission,
const ppapi::FlashSiteSettings& sites) OVERRIDE;
// Gets a string identifier for the group name, for use in HTML.
static std::string ContentSettingsTypeToGroupName(ContentSettingsType type);
private:
// Extends ContentSettingsType with some other types that will be also
// displayed in the content settings UI.
class ExContentSettingsType;
struct ExContentSettingsTypeNameEntry;
struct CachedPepperFlashSettings {
CachedPepperFlashSettings();
~CachedPepperFlashSettings();
PP_Flash_BrowserOperations_Permission default_permission;
typedef std::map<std::string, PP_Flash_BrowserOperations_Permission>
SiteMap;
SiteMap sites;
bool initialized;
};
// Functions that call into the page -----------------------------------------
// Updates the page with the default settings (allow, ask, block, etc.)
void UpdateSettingDefaultFromModel(ContentSettingsType type);
void UpdateSettingDefaultFromModel(const ExContentSettingsType& type);
// Clobbers and rebuilds the specific content setting type exceptions table.
void UpdateExceptionsViewFromModel(ContentSettingsType type);
void UpdateExceptionsViewFromModel(const ExContentSettingsType& type);
// Clobbers and rebuilds the specific content setting type exceptions
// OTR table.
void UpdateOTRExceptionsViewFromModel(ContentSettingsType type);
void UpdateOTRExceptionsViewFromModel(
const ExContentSettingsType& type);
// Clobbers and rebuilds all the exceptions tables in the page (both normal
// and OTR tables).
void UpdateAllExceptionsViewsFromModel();
......@@ -58,6 +89,9 @@ class ContentSettingsHandler : public OptionsPageUIHandler {
void UpdateGeolocationExceptionsView();
// Clobbers and rebuilds just the desktop notification exception table.
void UpdateNotificationExceptionsView();
// Clobbers and rebuilds just the Pepper Flash camera and microphone exception
// table.
void UpdateFlashCameraMicExceptionsView();
// Clobbers and rebuilds an exception table that's managed by the host content
// settings map.
void UpdateExceptionsViewFromHostContentSettingsMap(ContentSettingsType type);
......@@ -102,16 +136,26 @@ class ContentSettingsHandler : public OptionsPageUIHandler {
// Gets the default setting in string form. If |provider_id| is not NULL, the
// id of the provider which provided the default setting is assigned to it.
std::string GetSettingDefaultFromModel(ContentSettingsType type,
std::string GetSettingDefaultFromModel(const ExContentSettingsType& type,
std::string* provider_id);
// Gets the ProtocolHandlerRegistry for the normal profile.
ProtocolHandlerRegistry* GetProtocolHandlerRegistry();
static ExContentSettingsType ExContentSettingsTypeFromGroupName(
const std::string& name);
static std::string ExContentSettingsTypeToGroupName(
const ExContentSettingsType& type);
// Member variables ---------------------------------------------------------
content::NotificationRegistrar notification_registrar_;
PrefChangeRegistrar pref_change_registrar_;
scoped_ptr<PepperFlashSettingsManager> flash_settings_manager_;
CachedPepperFlashSettings flash_cameramic_settings_;
static const ExContentSettingsTypeNameEntry
kExContentSettingsTypeGroupNames[];
DISALLOW_COPY_AND_ASSIGN(ContentSettingsHandler);
};
......
......@@ -118,6 +118,7 @@
0x3c463d9eb1c92f64 BadMessageTerminate_DSMF_1
0x8b956c45b0f38be9 BadMessageTerminate_DSMF_2
0x6ebaa5e3651107fa BadMessageTerminate_EFD
0xff06108fb2aa73fa BadMessageTerminate_FAMF
0xbecb3852be04c506 BadMessageTerminate_IDBMF
0xd7e4d61883121c76 BadMessageTerminate_NC
0x448f44d226b839b7 BadMessageTerminate_NC17
......@@ -934,6 +935,7 @@
0xe2fd858f8395432f Options_CustomFrame_Disable
0x531823c36ca21da2 Options_CustomFrame_Enable
0x33e7b018e003c5b1 Options_DefaultCookieSettingChanged
0xd5a152f698cfa270 Options_DefaultFlashCameraMicSettingChanged
0x3864ed1197ddceb8 Options_DefaultGeolocationSettingChanged
0x3f92cd6678d2f595 Options_DefaultHandlersSettingChanged
0x5dfe307474e6b526 Options_DefaultImagesSettingChanged
......@@ -977,6 +979,8 @@
0x4aa2c70a745dbb49 Options_MetricsReportingCheckbox_Enable
0x224b0bf60dccdeda Options_MousePrimaryRight_Disable
0xb23cd3cde814d929 Options_MousePrimaryRight_Enable
0x820f29cc9c44d0d5 Options_PasswordGenerationCheckbox_Disable
0x4df19d1fb4741c2a Options_PasswordGenerationCheckbox_Enable
0xc5fbe9d9b3a165dd Options_PasswordManager_Disable
0x59b4f208d9d9f648 Options_PasswordManager_Enable
0x6149925370ef4f47 Options_PluginsCheckbox_Disable
......
......@@ -6,11 +6,15 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/memory/scoped_ptr.h"
#include "base/utf_string_conversions.h"
#include "content/common/child_process.h"
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/private/ppp_flash_browser_operations.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/shared_impl/ppapi_globals.h"
#include "ppapi/shared_impl/var.h"
#include "ppapi/shared_impl/var_tracker.h"
namespace {
......@@ -26,14 +30,70 @@ std::string ConvertPluginDataPath(const FilePath& plugin_data_path) {
#endif
}
struct GetPermissionSettingsContext {
GetPermissionSettingsContext(
const base::WeakPtr<BrokerProcessDispatcher> in_dispatcher,
uint32 in_request_id)
: dispatcher(in_dispatcher),
request_id(in_request_id) {
}
base::WeakPtr<BrokerProcessDispatcher> dispatcher;
uint32 request_id;
};
void GetPermissionSettingsCallback(
void* user_data,
PP_Bool success,
PP_Flash_BrowserOperations_Permission default_permission,
uint32_t site_count,
const PP_Flash_BrowserOperations_SiteSetting sites[]) {
scoped_ptr<GetPermissionSettingsContext> context(
reinterpret_cast<GetPermissionSettingsContext*>(user_data));
if (!context->dispatcher)
return;
ppapi::FlashSiteSettings site_vector;
if (success) {
site_vector.reserve(site_count);
for (uint32_t i = 0; i < site_count; ++i) {
ppapi::StringVar* string_var = ppapi::StringVar::FromPPVar(sites[i].site);
if (!string_var) {
success = PP_FALSE;
break;
}
site_vector.push_back(
ppapi::FlashSiteSetting(string_var->value(), sites[i].permission));
}
if (!success)
site_vector.clear();
}
context->dispatcher->OnGetPermissionSettingsCompleted(
context->request_id, PP_ToBool(success), default_permission, site_vector);
}
} // namespace
BrokerProcessDispatcher::BrokerProcessDispatcher(
PP_GetInterface_Func get_plugin_interface,
PP_ConnectInstance_Func connect_instance)
: ppapi::proxy::BrokerSideDispatcher(connect_instance),
get_plugin_interface_(get_plugin_interface) {
get_plugin_interface_(get_plugin_interface),
flash_browser_operations_1_1_(NULL),
flash_browser_operations_1_0_(NULL) {
ChildProcess::current()->AddRefProcess();
if (get_plugin_interface) {
flash_browser_operations_1_0_ =
static_cast<const PPP_Flash_BrowserOperations_1_0*>(
get_plugin_interface_(PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_0));
flash_browser_operations_1_1_ =
static_cast<const PPP_Flash_BrowserOperations_1_1*>(
get_plugin_interface_(PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_1));
}
}
BrokerProcessDispatcher::~BrokerProcessDispatcher() {
......@@ -55,11 +115,25 @@ bool BrokerProcessDispatcher::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(PpapiMsg_ClearSiteData, OnMsgClearSiteData)
IPC_MESSAGE_HANDLER(PpapiMsg_DeauthorizeContentLicenses,
OnMsgDeauthorizeContentLicenses)
IPC_MESSAGE_HANDLER(PpapiMsg_GetPermissionSettings,
OnMsgGetPermissionSettings)
IPC_MESSAGE_HANDLER(PpapiMsg_SetDefaultPermission,
OnMsgSetDefaultPermission)
IPC_MESSAGE_HANDLER(PpapiMsg_SetSitePermission, OnMsgSetSitePermission)
IPC_MESSAGE_UNHANDLED(return BrokerSideDispatcher::OnMessageReceived(msg))
IPC_END_MESSAGE_MAP()
return true;
}
void BrokerProcessDispatcher::OnGetPermissionSettingsCompleted(
uint32 request_id,
bool success,
PP_Flash_BrowserOperations_Permission default_permission,
const ppapi::FlashSiteSettings& sites) {
Send(new PpapiHostMsg_GetPermissionSettingsResult(
request_id, success, default_permission, sites));
}
void BrokerProcessDispatcher::OnMsgClearSiteData(
const FilePath& plugin_data_path,
const std::string& site,
......@@ -76,34 +150,62 @@ void BrokerProcessDispatcher::OnMsgDeauthorizeContentLicenses(
request_id, DeauthorizeContentLicenses(plugin_data_path)));
}
void BrokerProcessDispatcher::OnMsgGetPermissionSettings(
uint32 request_id,
const FilePath& plugin_data_path,
PP_Flash_BrowserOperations_SettingType setting_type) {
if (!flash_browser_operations_1_1_) {
OnGetPermissionSettingsCompleted(
request_id, false, PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT,
ppapi::FlashSiteSettings());
return;
}
std::string data_str = ConvertPluginDataPath(plugin_data_path);
// The GetPermissionSettingsContext object will be deleted in
// GetPermissionSettingsCallback().
flash_browser_operations_1_1_->GetPermissionSettings(
data_str.c_str(), setting_type, &GetPermissionSettingsCallback,
new GetPermissionSettingsContext(AsWeakPtr(), request_id));
}
void BrokerProcessDispatcher::OnMsgSetDefaultPermission(
uint32 request_id,
const FilePath& plugin_data_path,
PP_Flash_BrowserOperations_SettingType setting_type,
PP_Flash_BrowserOperations_Permission permission,
bool clear_site_specific) {
Send(new PpapiHostMsg_SetDefaultPermissionResult(
request_id,
SetDefaultPermission(plugin_data_path, setting_type, permission,
clear_site_specific)));
}
void BrokerProcessDispatcher::OnMsgSetSitePermission(
uint32 request_id,
const FilePath& plugin_data_path,
PP_Flash_BrowserOperations_SettingType setting_type,
const ppapi::FlashSiteSettings& sites) {
Send(new PpapiHostMsg_SetSitePermissionResult(
request_id, SetSitePermission(plugin_data_path, setting_type, sites)));
}
bool BrokerProcessDispatcher::ClearSiteData(const FilePath& plugin_data_path,
const std::string& site,
uint64 flags,
uint64 max_age) {
if (!get_plugin_interface_)
return false;
const PPP_Flash_BrowserOperations_1_1* browser_interface =
static_cast<const PPP_Flash_BrowserOperations_1_1*>(
get_plugin_interface_(PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_1));
if (browser_interface) {
std::string data_str = ConvertPluginDataPath(plugin_data_path);
browser_interface->ClearSiteData(data_str.c_str(),
site.empty() ? NULL : site.c_str(),
flags, max_age);
std::string data_str = ConvertPluginDataPath(plugin_data_path);
if (flash_browser_operations_1_1_) {
flash_browser_operations_1_1_->ClearSiteData(
data_str.c_str(), site.empty() ? NULL : site.c_str(), flags, max_age);
return true;
}
// TODO(viettrungluu): Remove this (and the 1.0 interface) sometime after M21
// goes to Stable.
const PPP_Flash_BrowserOperations_1_0* browser_interface_1_0 =
static_cast<const PPP_Flash_BrowserOperations_1_0*>(
get_plugin_interface_(PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_0));
if (browser_interface_1_0) {
std::string data_str = ConvertPluginDataPath(plugin_data_path);
browser_interface_1_0->ClearSiteData(data_str.c_str(),
site.empty() ? NULL : site.c_str(),
flags, max_age);
if (flash_browser_operations_1_0_) {
flash_browser_operations_1_0_->ClearSiteData(
data_str.c_str(), site.empty() ? NULL : site.c_str(), flags, max_age);
return true;
}
......@@ -112,16 +214,52 @@ bool BrokerProcessDispatcher::ClearSiteData(const FilePath& plugin_data_path,
bool BrokerProcessDispatcher::DeauthorizeContentLicenses(
const FilePath& plugin_data_path) {
if (!get_plugin_interface_)
return false;
const PPP_Flash_BrowserOperations_1_1* browser_interface =
static_cast<const PPP_Flash_BrowserOperations_1_1*>(
get_plugin_interface_(PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_1));
if (!browser_interface)
if (!flash_browser_operations_1_1_)
return false;
std::string data_str = ConvertPluginDataPath(plugin_data_path);
return PP_ToBool(browser_interface->DeauthorizeContentLicenses(
return PP_ToBool(flash_browser_operations_1_1_->DeauthorizeContentLicenses(
data_str.c_str()));
}
bool BrokerProcessDispatcher::SetDefaultPermission(
const FilePath& plugin_data_path,
PP_Flash_BrowserOperations_SettingType setting_type,
PP_Flash_BrowserOperations_Permission permission,
bool clear_site_specific) {
if (!flash_browser_operations_1_1_)
return false;
std::string data_str = ConvertPluginDataPath(plugin_data_path);
return PP_ToBool(flash_browser_operations_1_1_->SetDefaultPermission(
data_str.c_str(), setting_type, permission,
PP_FromBool(clear_site_specific)));
}
bool BrokerProcessDispatcher::SetSitePermission(
const FilePath& plugin_data_path,
PP_Flash_BrowserOperations_SettingType setting_type,
const ppapi::FlashSiteSettings& sites) {
if (!flash_browser_operations_1_1_)
return false;
if (sites.empty())
return true;
std::string data_str = ConvertPluginDataPath(plugin_data_path);
scoped_array<PP_Flash_BrowserOperations_SiteSetting> site_array(
new PP_Flash_BrowserOperations_SiteSetting[sites.size()]);
for (size_t i = 0; i < sites.size(); ++i) {
site_array[i].site = ppapi::StringVar::StringToPPVar(sites[i].site);
site_array[i].permission = sites[i].permission;
}
PP_Bool result = flash_browser_operations_1_1_->SetSitePermission(
data_str.c_str(), setting_type, sites.size(), site_array.get());
for (size_t i = 0; i < sites.size(); ++i)
ppapi::PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(site_array[i].site);
return PP_ToBool(result);
}
......@@ -6,13 +6,17 @@
#define CONTENT_PPAPI_PLUGIN_BROKER_PROCESS_DISPATCHER_H_
#include "base/basictypes.h"
#include "base/memory/weak_ptr.h"
#include "ppapi/c/ppp.h"
#include "ppapi/proxy/broker_dispatcher.h"
#include "ppapi/shared_impl/ppp_flash_browser_operations_shared.h"
// Wrapper around a BrokerDispatcher that provides the necessary integration
// for plugin process management. This class is to avoid direct dependencies
// from the PPAPI proxy on the Chrome multiprocess infrastructure.
class BrokerProcessDispatcher : public ppapi::proxy::BrokerSideDispatcher {
class BrokerProcessDispatcher
: public ppapi::proxy::BrokerSideDispatcher,
public base::SupportsWeakPtr<BrokerProcessDispatcher> {
public:
BrokerProcessDispatcher(PP_GetInterface_Func get_plugin_interface,
PP_ConnectInstance_Func connect_instance);
......@@ -21,14 +25,34 @@ class BrokerProcessDispatcher : public ppapi::proxy::BrokerSideDispatcher {
// IPC::Channel::Listener overrides.
virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
void OnGetPermissionSettingsCompleted(
uint32 request_id,
bool success,
PP_Flash_BrowserOperations_Permission default_permission,
const ppapi::FlashSiteSettings& sites);
private:
void OnMsgClearSiteData(const FilePath& plugin_data_path,
const std::string& site,
uint64 flags,
uint64 max_age);
void OnMsgDeauthorizeContentLicenses(uint32 request_id,
const FilePath& plugin_data_path);
void OnMsgGetPermissionSettings(
uint32 request_id,
const FilePath& plugin_data_path,
PP_Flash_BrowserOperations_SettingType setting_type);
void OnMsgSetDefaultPermission(
uint32 request_id,
const FilePath& plugin_data_path,
PP_Flash_BrowserOperations_SettingType setting_type,
PP_Flash_BrowserOperations_Permission permission,
bool clear_site_specific);
void OnMsgSetSitePermission(
uint32 request_id,
const FilePath& plugin_data_path,
PP_Flash_BrowserOperations_SettingType setting_type,
const ppapi::FlashSiteSettings& sites);
// Requests that the plugin clear data, returning true on success.
bool ClearSiteData(const FilePath& plugin_data_path,
......@@ -36,9 +60,19 @@ class BrokerProcessDispatcher : public ppapi::proxy::BrokerSideDispatcher {
uint64 flags,
uint64 max_age);
bool DeauthorizeContentLicenses(const FilePath& plugin_data_path);
bool SetDefaultPermission(const FilePath& plugin_data_path,
PP_Flash_BrowserOperations_SettingType setting_type,
PP_Flash_BrowserOperations_Permission permission,
bool clear_site_specific);
bool SetSitePermission(const FilePath& plugin_data_path,
PP_Flash_BrowserOperations_SettingType setting_type,
const ppapi::FlashSiteSettings& sites);
PP_GetInterface_Func get_plugin_interface_;
const PPP_Flash_BrowserOperations_1_1* flash_browser_operations_1_1_;
const PPP_Flash_BrowserOperations_1_0* flash_browser_operations_1_0_;
DISALLOW_COPY_AND_ASSIGN(BrokerProcessDispatcher);
};
......
......@@ -112,6 +112,7 @@
'shared_impl/ppb_video_capture_shared.h',
'shared_impl/ppb_view_shared.cc',
'shared_impl/ppb_view_shared.h',
'shared_impl/ppp_flash_browser_operations_shared.h',
'shared_impl/ppp_instance_combined.cc',
'shared_impl/ppp_instance_combined.h',
'shared_impl/proxy_lock.cc',
......
......@@ -45,6 +45,7 @@
#include "ppapi/shared_impl/ppb_network_list_private_shared.h"
#include "ppapi/shared_impl/ppb_url_request_info_shared.h"
#include "ppapi/shared_impl/ppb_view_shared.h"
#include "ppapi/shared_impl/ppp_flash_browser_operations_shared.h"
#include "ppapi/shared_impl/private/ppb_host_resolver_shared.h"
#include "ppapi/shared_impl/private/ppb_x509_certificate_private_shared.h"
......@@ -118,6 +119,11 @@ IPC_STRUCT_TRAITS_BEGIN(ppapi::DeviceRefData)
IPC_STRUCT_TRAITS_MEMBER(id)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(ppapi::FlashSiteSetting)
IPC_STRUCT_TRAITS_MEMBER(site)
IPC_STRUCT_TRAITS_MEMBER(permission)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(ppapi::ViewData)
IPC_STRUCT_TRAITS_MEMBER(rect)
IPC_STRUCT_TRAITS_MEMBER(is_fullscreen)
......@@ -270,6 +276,36 @@ IPC_MESSAGE_CONTROL2(PpapiHostMsg_DeauthorizeContentLicensesResult,
uint32 /* request_id */,
bool /* success */)
IPC_MESSAGE_CONTROL3(PpapiMsg_GetPermissionSettings,
uint32 /* request_id */,
FilePath /* plugin_data_path */,
PP_Flash_BrowserOperations_SettingType /* setting_type */)
IPC_MESSAGE_CONTROL4(
PpapiHostMsg_GetPermissionSettingsResult,
uint32 /* request_id */,
bool /* success */,
PP_Flash_BrowserOperations_Permission /* default_permission */,
ppapi::FlashSiteSettings /* sites */)
IPC_MESSAGE_CONTROL5(PpapiMsg_SetDefaultPermission,
uint32 /* request_id */,
FilePath /* plugin_data_path */,
PP_Flash_BrowserOperations_SettingType /* setting_type */,
PP_Flash_BrowserOperations_Permission /* permission */,
bool /* clear_site_specific */)
IPC_MESSAGE_CONTROL2(PpapiHostMsg_SetDefaultPermissionResult,
uint32 /* request_id */,
bool /* success */)
IPC_MESSAGE_CONTROL4(PpapiMsg_SetSitePermission,
uint32 /* request_id */,
FilePath /* plugin_data_path */,
PP_Flash_BrowserOperations_SettingType /* setting_type */,
ppapi::FlashSiteSettings /* sites */)
IPC_MESSAGE_CONTROL2(PpapiHostMsg_SetSitePermissionResult,
uint32 /* request_id */,
bool /* success */)
// Broker Process.
IPC_SYNC_MESSAGE_CONTROL2_1(PpapiMsg_ConnectToPlugin,
PP_Instance /* instance */,
......
// 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.
#ifndef PPAPI_SHARED_IMPL_PPP_FLASH_BROWSER_OPERATIONS_SHARED_H_
#define PPAPI_SHARED_IMPL_PPP_FLASH_BROWSER_OPERATIONS_SHARED_H_
#include <string>
#include <vector>
#include "ppapi/c/private/ppp_flash_browser_operations.h"
namespace ppapi {
struct FlashSiteSetting {
FlashSiteSetting()
: permission(PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT) {
}
FlashSiteSetting(const std::string& in_site,
PP_Flash_BrowserOperations_Permission in_permission)
: site(in_site),
permission(in_permission) {
}
std::string site;
PP_Flash_BrowserOperations_Permission permission;
};
typedef std::vector<FlashSiteSetting> FlashSiteSettings;
} // namespace ppapi
#endif // PPAPI_SHARED_IMPL_PPP_FLASH_BROWSER_OPERATIONS_SHARED_H_
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