diff options
author | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-27 07:18:46 +0000 |
---|---|---|
committer | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-27 07:18:46 +0000 |
commit | 1a559448088694cd4dc077c7a14436942fda5061 (patch) | |
tree | c539c7259f878cf6c43bbbbc2515eaa46b0f4f45 /content/ppapi_plugin | |
parent | 3f84377fbfae99a755a20f8a9a5390526cec9ce1 (diff) | |
download | chromium_src-1a559448088694cd4dc077c7a14436942fda5061.zip chromium_src-1a559448088694cd4dc077c7a14436942fda5061.tar.gz chromium_src-1a559448088694cd4dc077c7a14436942fda5061.tar.bz2 |
Pepper Flash settings integration: implement "deauthorize content licenses".
A few notes about PepperFlashSettingsManager:
- It doesn't re-establish a channel for each request. It might seem unnecessary at this point. But that is needed for implementing content settings (camera/mic and peer networking), which requires more interactions with the broker process.
- Similarly, the support of multiple in-flight requests isn't very useful for deauthorizing content licenses, but that is useful for content settings, e.g., sending multiple GetPermissionSettings requests for different setting types.
BUG=112190
TEST=None
Review URL: https://chromiumcodereview.appspot.com/10391173
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139210 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/ppapi_plugin')
-rw-r--r-- | content/ppapi_plugin/broker_process_dispatcher.cc | 42 | ||||
-rw-r--r-- | content/ppapi_plugin/broker_process_dispatcher.h | 4 |
2 files changed, 39 insertions, 7 deletions
diff --git a/content/ppapi_plugin/broker_process_dispatcher.cc b/content/ppapi_plugin/broker_process_dispatcher.cc index 6d5ffa8..7844639 100644 --- a/content/ppapi_plugin/broker_process_dispatcher.cc +++ b/content/ppapi_plugin/broker_process_dispatcher.cc @@ -8,6 +8,7 @@ #include "base/bind_helpers.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" @@ -16,6 +17,15 @@ namespace { // How long we wait before releasing the broker process. const int kBrokerReleaseTimeSeconds = 30; +std::string ConvertPluginDataPath(const FilePath& plugin_data_path) { + // The string is always 8-bit, convert on Windows. +#if defined(OS_WIN) + return WideToUTF8(plugin_data_path.value()); +#else + return plugin_data_path.value(); +#endif +} + } // namespace BrokerProcessDispatcher::BrokerProcessDispatcher( @@ -43,6 +53,8 @@ BrokerProcessDispatcher::~BrokerProcessDispatcher() { bool BrokerProcessDispatcher::OnMessageReceived(const IPC::Message& msg) { IPC_BEGIN_MESSAGE_MAP(BrokerProcessDispatcher, msg) IPC_MESSAGE_HANDLER(PpapiMsg_ClearSiteData, OnMsgClearSiteData) + IPC_MESSAGE_HANDLER(PpapiMsg_DeauthorizeContentLicenses, + OnMsgDeauthorizeContentLicenses) IPC_MESSAGE_UNHANDLED(return BrokerSideDispatcher::OnMessageReceived(msg)) IPC_END_MESSAGE_MAP() return true; @@ -57,6 +69,13 @@ void BrokerProcessDispatcher::OnMsgClearSiteData( ClearSiteData(plugin_data_path, site, flags, max_age))); } +void BrokerProcessDispatcher::OnMsgDeauthorizeContentLicenses( + uint32 request_id, + const FilePath& plugin_data_path) { + Send(new PpapiHostMsg_DeauthorizeContentLicensesResult( + request_id, DeauthorizeContentLicenses(plugin_data_path))); +} + bool BrokerProcessDispatcher::ClearSiteData(const FilePath& plugin_data_path, const std::string& site, uint64 flags, @@ -69,16 +88,25 @@ bool BrokerProcessDispatcher::ClearSiteData(const FilePath& plugin_data_path, if (!browser_interface) return false; - // The string is always 8-bit, convert on Windows. -#if defined(OS_WIN) - std::string data_str = WideToUTF8(plugin_data_path.value()); -#else - std::string data_str = plugin_data_path.value(); -#endif - + std::string data_str = ConvertPluginDataPath(plugin_data_path); browser_interface->ClearSiteData(data_str.c_str(), site.empty() ? NULL : site.c_str(), flags, max_age); return true; } +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) + return false; + + std::string data_str = ConvertPluginDataPath(plugin_data_path); + return PP_ToBool(browser_interface->DeauthorizeContentLicenses( + data_str.c_str())); +} + diff --git a/content/ppapi_plugin/broker_process_dispatcher.h b/content/ppapi_plugin/broker_process_dispatcher.h index abf1124..b33a4e8 100644 --- a/content/ppapi_plugin/broker_process_dispatcher.h +++ b/content/ppapi_plugin/broker_process_dispatcher.h @@ -27,11 +27,15 @@ class BrokerProcessDispatcher : public ppapi::proxy::BrokerSideDispatcher { uint64 flags, uint64 max_age); + void OnMsgDeauthorizeContentLicenses(uint32 request_id, + const FilePath& plugin_data_path); + // Requests that the plugin clear data, returning true on success. bool ClearSiteData(const FilePath& plugin_data_path, const std::string& site, uint64 flags, uint64 max_age); + bool DeauthorizeContentLicenses(const FilePath& plugin_data_path); PP_GetInterface_Func get_plugin_interface_; |