summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-27 07:18:46 +0000
committeryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-27 07:18:46 +0000
commit1a559448088694cd4dc077c7a14436942fda5061 (patch)
treec539c7259f878cf6c43bbbbc2515eaa46b0f4f45
parent3f84377fbfae99a755a20f8a9a5390526cec9ce1 (diff)
downloadchromium_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
-rw-r--r--chrome/browser/browsing_data_remover.cc22
-rw-r--r--chrome/browser/browsing_data_remover.h16
-rw-r--r--chrome/browser/pepper_flash_settings_manager.cc350
-rw-r--r--chrome/browser/pepper_flash_settings_manager.h53
-rw-r--r--content/browser/pepper_flash_settings_helper_impl.cc71
-rw-r--r--content/browser/pepper_flash_settings_helper_impl.h44
-rw-r--r--content/browser/renderer_host/pepper_file_message_filter.cc3
-rw-r--r--content/content_browser.gypi3
-rw-r--r--content/ppapi_plugin/broker_process_dispatcher.cc42
-rw-r--r--content/ppapi_plugin/broker_process_dispatcher.h4
-rw-r--r--content/public/browser/pepper_flash_settings_helper.h43
-rw-r--r--content/public/common/content_constants.cc2
-rw-r--r--content/public/common/content_constants.h3
-rw-r--r--ppapi/api/private/ppp_flash_browser_operations.idl106
-rw-r--r--ppapi/c/private/ppp_flash_browser_operations.h133
-rw-r--r--ppapi/proxy/ppapi_messages.h10
16 files changed, 887 insertions, 18 deletions
diff --git a/chrome/browser/browsing_data_remover.cc b/chrome/browser/browsing_data_remover.cc
index afb7363..592cc80 100644
--- a/chrome/browser/browsing_data_remover.cc
+++ b/chrome/browser/browsing_data_remover.cc
@@ -102,6 +102,7 @@ BrowsingDataRemover::BrowsingDataRemover(Profile* profile,
cache_(NULL),
main_context_getter_(profile->GetRequestContext()),
media_context_getter_(profile->GetRequestContextForMedia()),
+ deauthorize_content_licenses_request_id_(0),
waiting_for_clear_cache_(false),
waiting_for_clear_cookies_count_(0),
waiting_for_clear_history_(false),
@@ -109,6 +110,7 @@ BrowsingDataRemover::BrowsingDataRemover(Profile* profile,
waiting_for_clear_server_bound_certs_(false),
waiting_for_clear_plugin_data_(false),
waiting_for_clear_quota_managed_data_(false),
+ waiting_for_clear_content_licenses_(false),
remove_mask_(0),
remove_origin_(GURL()),
remove_protected_(false) {
@@ -127,6 +129,7 @@ BrowsingDataRemover::BrowsingDataRemover(Profile* profile,
cache_(NULL),
main_context_getter_(profile->GetRequestContext()),
media_context_getter_(profile->GetRequestContextForMedia()),
+ deauthorize_content_licenses_request_id_(0),
waiting_for_clear_cache_(false),
waiting_for_clear_cookies_count_(0),
waiting_for_clear_history_(false),
@@ -134,6 +137,7 @@ BrowsingDataRemover::BrowsingDataRemover(Profile* profile,
waiting_for_clear_server_bound_certs_(false),
waiting_for_clear_plugin_data_(false),
waiting_for_clear_quota_managed_data_(false),
+ waiting_for_clear_content_licenses_(false),
remove_mask_(0),
remove_origin_(GURL()),
remove_protected_(false) {
@@ -388,7 +392,13 @@ void BrowsingDataRemover::RemoveImpl(int remove_mask,
content::RecordAction(
UserMetricsAction("ClearBrowsingData_ContentLicenses"));
- // TODO(yzshen): Implement it.
+ waiting_for_clear_content_licenses_ = true;
+ if (!pepper_flash_settings_manager_.get()) {
+ pepper_flash_settings_manager_.reset(
+ new PepperFlashSettingsManager(this, profile_));
+ }
+ deauthorize_content_licenses_request_id_ =
+ pepper_flash_settings_manager_->DeauthorizeContentLicenses();
}
// Also delete cached network related data (like TransportSecurityState,
@@ -679,6 +689,16 @@ void BrowsingDataRemover::OnWaitableEventSignaled(
NotifyAndDeleteIfDone();
}
+void BrowsingDataRemover::OnDeauthorizeContentLicensesCompleted(
+ uint32 request_id,
+ bool /* success */) {
+ DCHECK(waiting_for_clear_content_licenses_);
+ DCHECK_EQ(request_id, deauthorize_content_licenses_request_id_);
+
+ waiting_for_clear_content_licenses_ = false;
+ NotifyAndDeleteIfDone();
+}
+
void BrowsingDataRemover::OnClearedCookies(int num_deleted) {
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
BrowserThread::PostTask(
diff --git a/chrome/browser/browsing_data_remover.h b/chrome/browser/browsing_data_remover.h
index f819110..446a7dd 100644
--- a/chrome/browser/browsing_data_remover.h
+++ b/chrome/browser/browsing_data_remover.h
@@ -15,6 +15,7 @@
#include "base/synchronization/waitable_event_watcher.h"
#include "base/time.h"
#include "chrome/browser/cancelable_request.h"
+#include "chrome/browser/pepper_flash_settings_manager.h"
#include "chrome/browser/prefs/pref_member.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -46,7 +47,8 @@ class QuotaManager;
// visits in url database, downloads, cookies ...
class BrowsingDataRemover : public content::NotificationObserver,
- public base::WaitableEventWatcher::Delegate {
+ public base::WaitableEventWatcher::Delegate,
+ public PepperFlashSettingsManager::Client {
public:
// Time period ranges available when doing browsing data removals.
enum TimePeriod {
@@ -179,6 +181,10 @@ class BrowsingDataRemover : public content::NotificationObserver,
virtual void OnWaitableEventSignaled(
base::WaitableEvent* waitable_event) OVERRIDE;
+ // PepperFlashSettingsManager::Client implementation.
+ virtual void OnDeauthorizeContentLicensesCompleted(uint32 request_id,
+ bool success) OVERRIDE;
+
// Removes the specified items related to browsing for a specific host. If the
// provided |origin| is empty, data is removed for all origins. If
// |remove_protected_origins| is true, then data is removed even if the origin
@@ -255,7 +261,8 @@ class BrowsingDataRemover : public content::NotificationObserver,
!waiting_for_clear_networking_history_ &&
!waiting_for_clear_server_bound_certs_ &&
!waiting_for_clear_plugin_data_ &&
- !waiting_for_clear_quota_managed_data_;
+ !waiting_for_clear_quota_managed_data_ &&
+ !waiting_for_clear_content_licenses_;
}
// Setter for removing_; DCHECKs that we can only start removing if we're not
@@ -294,6 +301,10 @@ class BrowsingDataRemover : public content::NotificationObserver,
scoped_ptr<content::PluginDataRemover> plugin_data_remover_;
base::WaitableEventWatcher watcher_;
+ // Used to deauthorize content licenses for Pepper Flash.
+ scoped_ptr<PepperFlashSettingsManager> pepper_flash_settings_manager_;
+ uint32 deauthorize_content_licenses_request_id_;
+
// True if we're waiting for various data to be deleted.
// These may only be accessed from UI thread in order to avoid races!
bool waiting_for_clear_cache_;
@@ -304,6 +315,7 @@ class BrowsingDataRemover : public content::NotificationObserver,
bool waiting_for_clear_server_bound_certs_;
bool waiting_for_clear_plugin_data_;
bool waiting_for_clear_quota_managed_data_;
+ bool waiting_for_clear_content_licenses_;
// Tracking how many origins need to be deleted, and whether we're finished
// gathering origins.
diff --git a/chrome/browser/pepper_flash_settings_manager.cc b/chrome/browser/pepper_flash_settings_manager.cc
index 4a15ca9..ba7192d 100644
--- a/chrome/browser/pepper_flash_settings_manager.cc
+++ b/chrome/browser/pepper_flash_settings_manager.cc
@@ -4,16 +4,338 @@
#include "chrome/browser/pepper_flash_settings_manager.h"
+#include <map>
+#include <utility>
#include <vector>
+#include "base/bind.h"
+#include "base/compiler_specific.h"
+#include "base/sequenced_task_runner_helpers.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/plugin_prefs.h"
#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
+#include "content/public/browser/browser_context.h"
+#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/pepper_flash_settings_helper.h"
#include "content/public/browser/plugin_service.h"
+#include "content/public/common/content_constants.h"
#include "googleurl/src/gurl.h"
+#include "ipc/ipc_channel.h"
+#include "ppapi/proxy/ppapi_messages.h"
#include "webkit/plugins/plugin_constants.h"
#include "webkit/plugins/webplugininfo.h"
+using content::BrowserThread;
+
+class PepperFlashSettingsManager::Core
+ : public IPC::Channel::Listener,
+ public base::RefCountedThreadSafe<Core, BrowserThread::DeleteOnIOThread> {
+ public:
+ Core(PepperFlashSettingsManager* manager,
+ content::BrowserContext* browser_context);
+
+ // Stops sending notifications to |manager_| and sets it to NULL.
+ void Detach();
+
+ void DeauthorizeContentLicenses(uint32 request_id);
+
+ // IPC::Channel::Listener implementation.
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+ virtual void OnChannelError() OVERRIDE;
+
+ private:
+ friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>;
+ friend class base::DeleteHelper<Core>;
+
+ enum RequestType {
+ INVALID_REQUEST_TYPE = 0,
+ DEAUTHORIZE_CONTENT_LICENSES
+ };
+
+ struct PendingRequest {
+ PendingRequest() : id(0), type(INVALID_REQUEST_TYPE) {}
+
+ uint32 id;
+ RequestType type;
+ };
+
+ virtual ~Core();
+
+ void Initialize();
+ void ConnectToChannel(bool success, const IPC::ChannelHandle& handle);
+
+ void DeauthorizeContentLicensesOnIOThread(uint32 request_id);
+ void NotifyErrorFromIOThread();
+
+ void NotifyDeauthorizeContentLicensesCompleted(uint32 request_id,
+ bool success);
+ void NotifyError(
+ const std::vector<std::pair<uint32, RequestType> >& notifications);
+
+ // Message handlers.
+ void OnDeauthorizeContentLicensesResult(uint32 request_id, bool success);
+
+ // Used only on the UI thread.
+ PepperFlashSettingsManager* manager_;
+
+ // Used only on the I/O thread.
+ FilePath plugin_data_path_;
+
+ // The channel is NULL until we have opened a connection to the broker
+ // process. Used only on the I/O thread.
+ scoped_ptr<IPC::Channel> channel_;
+
+ // Used only on the I/O thread.
+ bool initialized_;
+
+ // Requests that need to be sent once the channel to the broker process is
+ // established. Used only on the I/O thread.
+ std::vector<PendingRequest> pending_requests_;
+ // Requests that have been sent but haven't got replied. Used only on the
+ // I/O thread.
+ std::map<uint32, RequestType> pending_responses_;
+
+ // Used only on the I/O thread.
+ scoped_refptr<content::PepperFlashSettingsHelper> helper_;
+
+ // Path for the current profile. Must be retrieved on the UI thread from the
+ // browser context when we start so we can use it later on the I/O thread.
+ FilePath browser_context_path_;
+
+ scoped_refptr<PluginPrefs> plugin_prefs_;
+};
+
+PepperFlashSettingsManager::Core::Core(PepperFlashSettingsManager* manager,
+ content::BrowserContext* browser_context)
+ : manager_(manager),
+ initialized_(false),
+ browser_context_path_(browser_context->GetPath()),
+ plugin_prefs_(PluginPrefs::GetForProfile(
+ Profile::FromBrowserContext(browser_context))) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
+ base::Bind(&Core::Initialize, this));
+}
+
+PepperFlashSettingsManager::Core::~Core() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+}
+
+void PepperFlashSettingsManager::Core::Detach() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ manager_ = NULL;
+}
+
+void PepperFlashSettingsManager::Core::DeauthorizeContentLicenses(
+ uint32 request_id) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&Core::DeauthorizeContentLicensesOnIOThread, this,
+ request_id));
+}
+
+bool PepperFlashSettingsManager::Core::OnMessageReceived(
+ const IPC::Message& message) {
+ IPC_BEGIN_MESSAGE_MAP(Core, message)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_DeauthorizeContentLicensesResult,
+ OnDeauthorizeContentLicensesResult)
+ IPC_MESSAGE_UNHANDLED_ERROR()
+ IPC_END_MESSAGE_MAP()
+
+ return true;
+}
+
+void PepperFlashSettingsManager::Core::OnChannelError() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+
+ NotifyErrorFromIOThread();
+}
+
+void PepperFlashSettingsManager::Core::Initialize() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK(!initialized_);
+
+ webkit::WebPluginInfo plugin_info;
+ if (!PepperFlashSettingsManager::IsPepperFlashInUse(plugin_prefs_.get(),
+ &plugin_info)) {
+ NotifyErrorFromIOThread();
+ return;
+ }
+
+ FilePath profile_path =
+ browser_context_path_.Append(content::kPepperDataDirname);
+#if defined(OS_WIN)
+ plugin_data_path_ = profile_path.Append(plugin_info.name);
+#else
+ plugin_data_path_ = profile_path.Append(UTF16ToUTF8(plugin_info.name));
+#endif
+
+ helper_ = content::PepperFlashSettingsHelper::Create();
+ content::PepperFlashSettingsHelper::OpenChannelCallback callback =
+ base::Bind(&Core::ConnectToChannel, this);
+ helper_->OpenChannelToBroker(plugin_info.path, callback);
+}
+
+void PepperFlashSettingsManager::Core::ConnectToChannel(
+ bool success,
+ const IPC::ChannelHandle& handle) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK(!initialized_);
+ DCHECK(!channel_.get());
+
+ if (!success) {
+ LOG(ERROR) << "Couldn't open plugin channel";
+ NotifyErrorFromIOThread();
+ return;
+ }
+
+ channel_.reset(new IPC::Channel(handle, IPC::Channel::MODE_CLIENT, this));
+ if (!channel_->Connect()) {
+ LOG(ERROR) << "Couldn't connect to plugin";
+ NotifyErrorFromIOThread();
+ return;
+ }
+
+ initialized_ = true;
+
+ std::vector<PendingRequest> temp_pending_requests;
+ temp_pending_requests.swap(pending_requests_);
+ for (std::vector<PendingRequest>::iterator iter =
+ temp_pending_requests.begin();
+ iter != temp_pending_requests.end(); ++iter) {
+ switch (iter->type) {
+ case DEAUTHORIZE_CONTENT_LICENSES:
+ DeauthorizeContentLicensesOnIOThread(iter->id);
+ break;
+ default:
+ NOTREACHED();
+ break;
+ }
+ }
+}
+
+void PepperFlashSettingsManager::Core::DeauthorizeContentLicensesOnIOThread(
+ uint32 request_id) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+
+ if (!initialized_) {
+ PendingRequest request;
+ request.id = request_id;
+ request.type = DEAUTHORIZE_CONTENT_LICENSES;
+ pending_requests_.push_back(request);
+ return;
+ }
+
+ pending_responses_.insert(
+ std::make_pair(request_id, DEAUTHORIZE_CONTENT_LICENSES));
+ IPC::Message* msg =
+ new PpapiMsg_DeauthorizeContentLicenses(request_id, plugin_data_path_);
+ if (!channel_->Send(msg)) {
+ LOG(ERROR) << "Couldn't send DeauthorizeContentLicenses message";
+ // A failure notification for the current request will be sent since
+ // |pending_responses_| has been updated.
+ NotifyErrorFromIOThread();
+ }
+}
+
+void PepperFlashSettingsManager::Core::NotifyErrorFromIOThread() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+
+ std::vector<std::pair<uint32, RequestType> > notifications;
+ for (std::vector<PendingRequest>::iterator iter = pending_requests_.begin();
+ iter != pending_requests_.end(); ++iter) {
+ notifications.push_back(std::make_pair(iter->id, iter->type));
+ }
+ pending_requests_.clear();
+ notifications.insert(notifications.end(), pending_responses_.begin(),
+ pending_responses_.end());
+ pending_responses_.clear();
+
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(&Core::NotifyError, this, notifications));
+}
+
+void
+PepperFlashSettingsManager::Core::NotifyDeauthorizeContentLicensesCompleted(
+ uint32 request_id,
+ bool success) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ if (manager_) {
+ manager_->client_->OnDeauthorizeContentLicensesCompleted(
+ request_id, success);
+ }
+}
+
+void PepperFlashSettingsManager::Core::NotifyError(
+ const std::vector<std::pair<uint32, RequestType> >& notifications) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ scoped_refptr<Core> protector(this);
+ for (std::vector<std::pair<uint32, RequestType> >::const_iterator iter =
+ notifications.begin(); iter != notifications.end(); ++iter) {
+ // Check |manager_| for each iteration in case Detach() happens in one of
+ // the callbacks.
+ if (manager_) {
+ switch (iter->second) {
+ case DEAUTHORIZE_CONTENT_LICENSES:
+ manager_->client_->OnDeauthorizeContentLicensesCompleted(iter->first,
+ false);
+ break;
+ default:
+ NOTREACHED();
+ break;
+ }
+ }
+ }
+
+ if (manager_)
+ manager_->OnError();
+}
+
+void PepperFlashSettingsManager::Core::OnDeauthorizeContentLicensesResult(
+ uint32 request_id,
+ bool success) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ LOG_IF(ERROR, !success) << "DeauthorizeContentLicenses returned error";
+
+ std::map<uint32, RequestType>::iterator iter =
+ pending_responses_.find(request_id);
+ if (iter != pending_responses_.end()) {
+ DCHECK_EQ(iter->second, DEAUTHORIZE_CONTENT_LICENSES);
+
+ pending_responses_.erase(iter);
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(&Core::NotifyDeauthorizeContentLicensesCompleted, this,
+ request_id, success));
+ }
+}
+
+PepperFlashSettingsManager::PepperFlashSettingsManager(
+ Client* client,
+ content::BrowserContext* browser_context)
+ : client_(client),
+ browser_context_(browser_context),
+ next_request_id_(1) {
+ DCHECK(client);
+ DCHECK(browser_context);
+}
+
+PepperFlashSettingsManager::~PepperFlashSettingsManager() {
+ if (core_.get()) {
+ core_->Detach();
+ core_ = NULL;
+ }
+}
+
// static
bool PepperFlashSettingsManager::IsPepperFlashInUse(
PluginPrefs* plugin_prefs,
@@ -48,3 +370,31 @@ void PepperFlashSettingsManager::RegisterUserPrefs(PrefService* prefs) {
true,
PrefService::UNSYNCABLE_PREF);
}
+
+uint32 PepperFlashSettingsManager::DeauthorizeContentLicenses() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ EnsureCoreExists();
+ uint32 id = GetNextRequestId();
+ core_->DeauthorizeContentLicenses(id);
+ return id;
+}
+
+uint32 PepperFlashSettingsManager::GetNextRequestId() {
+ return next_request_id_++;
+}
+
+void PepperFlashSettingsManager::EnsureCoreExists() {
+ if (!core_.get())
+ core_ = new Core(this, browser_context_);
+}
+
+void PepperFlashSettingsManager::OnError() {
+ if (core_.get()) {
+ core_->Detach();
+ core_ = NULL;
+ } else {
+ NOTREACHED();
+ }
+}
+
diff --git a/chrome/browser/pepper_flash_settings_manager.h b/chrome/browser/pepper_flash_settings_manager.h
index 88bd1b0..4a20df3 100644
--- a/chrome/browser/pepper_flash_settings_manager.h
+++ b/chrome/browser/pepper_flash_settings_manager.h
@@ -7,10 +7,15 @@
#pragma once
#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
class PluginPrefs;
class PrefService;
+namespace content {
+class BrowserContext;
+}
+
namespace webkit {
struct WebPluginInfo;
}
@@ -19,6 +24,20 @@ struct WebPluginInfo;
// read/write Pepper Flash settings.
class PepperFlashSettingsManager {
public:
+ class Client {
+ public:
+ virtual ~Client() {}
+
+ virtual void OnDeauthorizeContentLicensesCompleted(uint32 request_id,
+ bool success) = 0;
+ };
+
+ // |client| must outlive this object. It is guaranteed that |client| won't
+ // receive any notifications after this object goes away.
+ PepperFlashSettingsManager(Client* client,
+ content::BrowserContext* browser_context);
+ ~PepperFlashSettingsManager();
+
// |plugin_info| will be updated if it is not NULL and the method returns
// true.
static bool IsPepperFlashInUse(PluginPrefs* plugin_prefs,
@@ -26,8 +45,40 @@ class PepperFlashSettingsManager {
static void RegisterUserPrefs(PrefService* prefs);
+ // Requests to deauthorize content licenses.
+ // Client::OnDeauthorizeContentLicensesCompleted() will be called when the
+ // operation is completed.
+ // The return value is the same as the request ID passed into
+ // Client::OnDeauthorizeContentLicensesCompleted().
+ uint32 DeauthorizeContentLicenses();
+
private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(PepperFlashSettingsManager);
+ // Core does most of the work. It is ref-counted so that its lifespan can be
+ // independent of the containing object's:
+ // - The manager can be deleted on the UI thread while the core still being
+ // used on the I/O thread.
+ // - The manager can delete the core when it encounters errors and create
+ // another one to handle new requests.
+ class Core;
+
+ uint32 GetNextRequestId();
+
+ void EnsureCoreExists();
+
+ // Notified by |core_| when an error occurs.
+ void OnError();
+
+ // |client_| is not owned by this object and must outlive it.
+ Client* client_;
+
+ // The browser context for the profile.
+ content::BrowserContext* browser_context_;
+
+ scoped_refptr<Core> core_;
+
+ uint32 next_request_id_;
+
+ DISALLOW_COPY_AND_ASSIGN(PepperFlashSettingsManager);
};
#endif // CHROME_BROWSER_PEPPER_FLASH_SETTINGS_MANAGER_H_
diff --git a/content/browser/pepper_flash_settings_helper_impl.cc b/content/browser/pepper_flash_settings_helper_impl.cc
new file mode 100644
index 0000000..2f9e698
--- /dev/null
+++ b/content/browser/pepper_flash_settings_helper_impl.cc
@@ -0,0 +1,71 @@
+// 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/browser/pepper_flash_settings_helper_impl.h"
+
+#include "base/file_path.h"
+#include "content/browser/plugin_service_impl.h"
+#include "content/public/browser/browser_thread.h"
+#include "ipc/ipc_channel_handle.h"
+
+namespace content {
+
+// static
+scoped_refptr<PepperFlashSettingsHelper> PepperFlashSettingsHelper::Create() {
+ return new PepperFlashSettingsHelperImpl();
+}
+
+PepperFlashSettingsHelperImpl::PepperFlashSettingsHelperImpl() {
+}
+
+PepperFlashSettingsHelperImpl::~PepperFlashSettingsHelperImpl() {
+}
+
+void PepperFlashSettingsHelperImpl::OpenChannelToBroker(
+ const FilePath& path,
+ const OpenChannelCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+
+ if (callback.is_null())
+ return;
+ if (!callback_.is_null())
+ callback.Run(false, IPC::ChannelHandle());
+
+ // Balanced in OnPpapiChannelOpened(). We need to keep this object around
+ // until then.
+ AddRef();
+
+ callback_ = callback;
+ PluginServiceImpl* plugin_service = PluginServiceImpl::GetInstance();
+ plugin_service->OpenChannelToPpapiBroker(path, this);
+}
+
+void PepperFlashSettingsHelperImpl::GetPpapiChannelInfo(
+ base::ProcessHandle* renderer_handle,
+ int* renderer_id) {
+ *renderer_handle = base::kNullProcessHandle;
+ *renderer_id = 0;
+}
+
+void PepperFlashSettingsHelperImpl::OnPpapiChannelOpened(
+ const IPC::ChannelHandle& channel_handle,
+ int /* plugin_child_id */) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK(!callback_.is_null());
+
+ if (!channel_handle.name.empty())
+ callback_.Run(true, channel_handle);
+ else
+ callback_.Run(false, IPC::ChannelHandle());
+
+ callback_.Reset();
+ // Balance the AddRef() call in Initialize().
+ Release();
+}
+
+bool PepperFlashSettingsHelperImpl::OffTheRecord() {
+ return false;
+}
+
+} // namespace content
diff --git a/content/browser/pepper_flash_settings_helper_impl.h b/content/browser/pepper_flash_settings_helper_impl.h
new file mode 100644
index 0000000..bfecc00
--- /dev/null
+++ b/content/browser/pepper_flash_settings_helper_impl.h
@@ -0,0 +1,44 @@
+// 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 CONTENT_BROWSER_PEPPER_FLASH_SETTINGS_HELPER_IMPL_H_
+#define CONTENT_BROWSER_PEPPER_FLASH_SETTINGS_HELPER_IMPL_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "content/browser/ppapi_plugin_process_host.h"
+#include "content/public/browser/pepper_flash_settings_helper.h"
+
+namespace content {
+
+class CONTENT_EXPORT PepperFlashSettingsHelperImpl
+ : public PepperFlashSettingsHelper,
+ public PpapiPluginProcessHost::BrokerClient {
+ public:
+ PepperFlashSettingsHelperImpl();
+
+ // PepperFlashSettingsHelper implementation.
+ virtual void OpenChannelToBroker(
+ const FilePath& path,
+ const OpenChannelCallback& callback) OVERRIDE;
+
+ // PpapiPluginProcessHost::BrokerClient implementation.
+ virtual void GetPpapiChannelInfo(base::ProcessHandle* renderer_handle,
+ int* renderer_id) OVERRIDE;
+ virtual void OnPpapiChannelOpened(const IPC::ChannelHandle& channel_handle,
+ int plugin_child_id) OVERRIDE;
+ virtual bool OffTheRecord() OVERRIDE;
+
+ protected:
+ virtual ~PepperFlashSettingsHelperImpl();
+
+ private:
+ OpenChannelCallback callback_;
+ DISALLOW_COPY_AND_ASSIGN(PepperFlashSettingsHelperImpl);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_PEPPER_FLASH_SETTINGS_HELPER_IMPL_H_
diff --git a/content/browser/renderer_host/pepper_file_message_filter.cc b/content/browser/renderer_host/pepper_file_message_filter.cc
index 10b3430..e8b3a92 100644
--- a/content/browser/renderer_host/pepper_file_message_filter.cc
+++ b/content/browser/renderer_host/pepper_file_message_filter.cc
@@ -14,6 +14,7 @@
#include "content/common/pepper_file_messages.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/common/content_constants.h"
#include "ipc/ipc_platform_file.h"
#include "webkit/plugins/ppapi/file_path.h"
@@ -72,7 +73,7 @@ void PepperFileMessageFilter::OnDestruct() const {
// static
FilePath PepperFileMessageFilter::GetDataDirName(const FilePath& profile_path) {
- return profile_path.Append(FILE_PATH_LITERAL("Pepper Data"));
+ return profile_path.Append(content::kPepperDataDirname);
}
PepperFileMessageFilter::~PepperFileMessageFilter() {
diff --git a/content/content_browser.gypi b/content/content_browser.gypi
index d64bd05..02bdcf7 100644
--- a/content/content_browser.gypi
+++ b/content/content_browser.gypi
@@ -105,6 +105,7 @@
'public/browser/notification_types.h',
'public/browser/page_navigator.cc',
'public/browser/page_navigator.h',
+ 'public/browser/pepper_flash_settings_helper.h',
'public/browser/plugin_data_remover.h',
'public/browser/plugin_service_filter.h',
'public/browser/plugin_service.h',
@@ -429,6 +430,8 @@
'browser/net/view_http_cache_job_factory.h',
'browser/notification_service_impl.cc',
'browser/notification_service_impl.h',
+ 'browser/pepper_flash_settings_helper_impl.cc',
+ 'browser/pepper_flash_settings_helper_impl.h',
'browser/plugin_data_remover_impl.cc',
'browser/plugin_data_remover_impl.h',
'browser/plugin_loader_posix.cc',
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_;
diff --git a/content/public/browser/pepper_flash_settings_helper.h b/content/public/browser/pepper_flash_settings_helper.h
new file mode 100644
index 0000000..e01002b7
--- /dev/null
+++ b/content/public/browser/pepper_flash_settings_helper.h
@@ -0,0 +1,43 @@
+// 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 CONTENT_PUBLIC_BROWSER_PEPPER_FLASH_SETTINGS_HELPER_H_
+#define CONTENT_PUBLIC_BROWSER_PEPPER_FLASH_SETTINGS_HELPER_H_
+#pragma once
+
+#include "base/callback.h"
+#include "base/memory/ref_counted.h"
+#include "content/common/content_export.h"
+
+class FilePath;
+
+namespace IPC {
+struct ChannelHandle;
+}
+
+namespace content {
+
+// This class should only be used on the IO thread.
+class CONTENT_EXPORT PepperFlashSettingsHelper
+ : public base::RefCounted<PepperFlashSettingsHelper> {
+ public:
+ static scoped_refptr<PepperFlashSettingsHelper> Create();
+
+ // Called when OpenChannelToBroker() is completed.
+ // |success| indicates whether the channel is successfully opened to the
+ // broker. On error, |channel_handle| is set to IPC::ChannelHandle().
+ typedef base::Callback<void(bool /* success */,
+ const IPC::ChannelHandle& /* channel_handle */)>
+ OpenChannelCallback;
+ virtual void OpenChannelToBroker(const FilePath& path,
+ const OpenChannelCallback& callback) = 0;
+
+ protected:
+ friend class base::RefCounted<PepperFlashSettingsHelper>;
+ virtual ~PepperFlashSettingsHelper() {}
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_BROWSER_PEPPER_FLASH_SETTINGS_HELPER_H_
diff --git a/content/public/common/content_constants.cc b/content/public/common/content_constants.cc
index b0e3b58..94536cc 100644
--- a/content/public/common/content_constants.cc
+++ b/content/public/common/content_constants.cc
@@ -7,6 +7,8 @@ namespace content {
const FilePath::CharType kAppCacheDirname[] =
FILE_PATH_LITERAL("Application Cache");
+const FilePath::CharType kPepperDataDirname[] =
+ FILE_PATH_LITERAL("Pepper Data");
// This number used to be limited to 32 in the past (see b/535234).
const size_t kMaxRendererProcessCount = 82;
diff --git a/content/public/common/content_constants.h b/content/public/common/content_constants.h
index 0df8b8b..e6a1124 100644
--- a/content/public/common/content_constants.h
+++ b/content/public/common/content_constants.h
@@ -18,6 +18,9 @@ namespace content {
// The name of the directory under BrowserContext::GetPath where the AppCache is
// put.
CONTENT_EXPORT extern const FilePath::CharType kAppCacheDirname[];
+// The name of the directory under BrowserContext::GetPath where Pepper plugin
+// data is put.
+CONTENT_EXPORT extern const FilePath::CharType kPepperDataDirname[];
CONTENT_EXPORT extern const size_t kMaxRendererProcessCount;
diff --git a/ppapi/api/private/ppp_flash_browser_operations.idl b/ppapi/api/private/ppp_flash_browser_operations.idl
index f7dcd8c..f4b4e65 100644
--- a/ppapi/api/private/ppp_flash_browser_operations.idl
+++ b/ppapi/api/private/ppp_flash_browser_operations.idl
@@ -8,9 +8,40 @@
*/
label Chrome {
- M20 = 1.0
+ M20 = 1.0,
+ M21 = 1.1
};
+[assert_size(4)]
+enum PP_Flash_BrowserOperations_SettingType {
+ PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_CAMERAMIC = 0,
+ PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_PEERNETWORKING = 1
+};
+
+[assert_size(4)]
+enum PP_Flash_BrowserOperations_Permission {
+ // This value is only used with <code>SetSitePermission()</code>.
+ PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT = 0,
+ PP_FLASH_BROWSEROPERATIONS_PERMISSION_ALLOW = 1,
+ PP_FLASH_BROWSEROPERATIONS_PERMISSION_BLOCK = 2,
+ PP_FLASH_BROWSEROPERATIONS_PERMISSION_ASK = 3
+};
+
+[assert_size(24)]
+struct PP_Flash_BrowserOperations_SiteSetting {
+ PP_Var site;
+ PP_Flash_BrowserOperations_Permission permission;
+ // Makes the size consistent across compilers.
+ int32_t padding;
+};
+
+typedef void PPB_Flash_BrowserOperations_GetSettingsCallback(
+ [inout] mem_t user_data,
+ [in] PP_Bool success,
+ [in] PP_Flash_BrowserOperations_Permission default_permission,
+ [in] uint32_t site_count,
+ [in, size_is(site_count)] PP_Flash_BrowserOperations_SiteSetting[] sites);
+
/**
* This interface allows the browser to request the plugin do things.
*/
@@ -41,5 +72,76 @@ interface PPP_Flash_BrowserOperations {
str_t site,
uint64_t flags,
uint64_t max_age);
-};
+ /**
+ * Requests the plugin to deauthorize content licenses. It prevents Flash from
+ * playing protected content, such as movies and music the user may have
+ * rented or purchased.
+ *
+ * @param[in] plugin_data_path String containing the directory where the
+ * plugin settings are stored.
+ *
+ * @return <code>PP_TRUE</code> on success, <code>PP_FALSE</code> on failure.
+ */
+ [version=1.1]
+ PP_Bool DeauthorizeContentLicenses([in] str_t plugin_data_path);
+
+ /**
+ * Gets permission settings. <code>callback</code> will be called exactly once
+ * to return the settings.
+ *
+ * @param[in] plugin_data_path String containing the directory where the
+ * plugin settings are stored.
+ * @param[in] setting_type What type of setting to retrieve.
+ * @param[in] callback The callback to return retrieved data.
+ * @param[inout] user_data An opaque pointer that will be passed to
+ * <code>callback</code>.
+ */
+ [version=1.1]
+ void GetPermissionSettings(
+ [in] str_t plugin_data_path,
+ [in] PP_Flash_BrowserOperations_SettingType setting_type,
+ [in] PPB_Flash_BrowserOperations_GetSettingsCallback callback,
+ [inout] mem_t user_data);
+
+ /**
+ * Sets default permission. It applies to all sites except those with
+ * site-specific settings.
+ *
+ * @param[in] plugin_data_path String containing the directory where the
+ * plugin settings are stored.
+ * @param[in] setting_type What type of setting to set.
+ * @param[in] permission The default permission.
+ * @param[in] clear_site_specific Whether to remove all site-specific
+ * settings.
+ *
+ * @return <code>PP_TRUE</code> on success, <code>PP_FALSE</code> on failure.
+ */
+ [version=1.1]
+ PP_Bool SetDefaultPermission(
+ [in] str_t plugin_data_path,
+ [in] PP_Flash_BrowserOperations_SettingType setting_type,
+ [in] PP_Flash_BrowserOperations_Permission permission,
+ [in] PP_Bool clear_site_speicifc);
+
+ /**
+ * Sets site-specific permission. If a site has already got site-specific
+ * permission and it is not in <code>sites</code>, it won't be affected.
+ *
+ * @param[in] plugin_data_path String containing the directory where the
+ * plugin settings are stored.
+ * @param[in] setting_type What type of setting to set.
+ * @param[in] site_count How many items are there in <code>sites</code>.
+ * @param[in] sites The site-specific settings. If a site is specified with
+ * <code>PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT</code> permission, it
+ * will be removed from the site-specific list.
+ *
+ * @return <code>PP_TRUE</code> on success, <code>PP_FALSE</code> on failure.
+ */
+ [version=1.1]
+ PP_Bool SetSitePermission(
+ [in] str_t plugin_data_path,
+ [in] PP_Flash_BrowserOperations_SettingType setting_type,
+ [in] uint32_t site_count,
+ [in, size_is(site_count)] PP_Flash_BrowserOperations_SiteSetting[] sites);
+};
diff --git a/ppapi/c/private/ppp_flash_browser_operations.h b/ppapi/c/private/ppp_flash_browser_operations.h
index 9cb3ff9..7e602cc 100644
--- a/ppapi/c/private/ppp_flash_browser_operations.h
+++ b/ppapi/c/private/ppp_flash_browser_operations.h
@@ -4,7 +4,7 @@
*/
/* From private/ppp_flash_browser_operations.idl,
- * modified Wed Apr 11 16:26:42 2012.
+ * modified Thu May 24 15:41:01 2012.
*/
#ifndef PPAPI_C_PRIVATE_PPP_FLASH_BROWSER_OPERATIONS_H_
@@ -13,11 +13,14 @@
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_macros.h"
#include "ppapi/c/pp_stdint.h"
+#include "ppapi/c/pp_var.h"
#define PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_0 \
"PPP_Flash_BrowserOperations;1.0"
+#define PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_1 \
+ "PPP_Flash_BrowserOperations;1.1"
#define PPP_FLASH_BROWSEROPERATIONS_INTERFACE \
- PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_0
+ PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_1
/**
* @file
@@ -26,13 +29,64 @@
/**
+ * @addtogroup Enums
+ * @{
+ */
+typedef enum {
+ PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_CAMERAMIC = 0,
+ PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_PEERNETWORKING = 1
+} PP_Flash_BrowserOperations_SettingType;
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Flash_BrowserOperations_SettingType, 4);
+
+typedef enum {
+ /* This value is only used with <code>SetSitePermission()</code>. */
+ PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT = 0,
+ PP_FLASH_BROWSEROPERATIONS_PERMISSION_ALLOW = 1,
+ PP_FLASH_BROWSEROPERATIONS_PERMISSION_BLOCK = 2,
+ PP_FLASH_BROWSEROPERATIONS_PERMISSION_ASK = 3
+} PP_Flash_BrowserOperations_Permission;
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Flash_BrowserOperations_Permission, 4);
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup Structs
+ * @{
+ */
+struct PP_Flash_BrowserOperations_SiteSetting {
+ struct PP_Var site;
+ PP_Flash_BrowserOperations_Permission permission;
+ /* Makes the size consistent across compilers. */
+ int32_t padding;
+};
+PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Flash_BrowserOperations_SiteSetting, 24);
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup Typedefs
+ * @{
+ */
+typedef void (*PPB_Flash_BrowserOperations_GetSettingsCallback)(
+ void* user_data,
+ PP_Bool success,
+ PP_Flash_BrowserOperations_Permission default_permission,
+ uint32_t site_count,
+ const struct PP_Flash_BrowserOperations_SiteSetting sites[]);
+/**
+ * @}
+ */
+
+/**
* @addtogroup Interfaces
* @{
*/
/**
* This interface allows the browser to request the plugin do things.
*/
-struct PPP_Flash_BrowserOperations_1_0 {
+struct PPP_Flash_BrowserOperations_1_1 {
/**
* This function allows the plugin to implement the "Clear site data" feature.
*
@@ -59,9 +113,80 @@ struct PPP_Flash_BrowserOperations_1_0 {
const char* site,
uint64_t flags,
uint64_t max_age);
+ /**
+ * Requests the plugin to deauthorize content licenses. It prevents Flash from
+ * playing protected content, such as movies and music the user may have
+ * rented or purchased.
+ *
+ * @param[in] plugin_data_path String containing the directory where the
+ * plugin settings are stored.
+ *
+ * @return <code>PP_TRUE</code> on success, <code>PP_FALSE</code> on failure.
+ */
+ PP_Bool (*DeauthorizeContentLicenses)(const char* plugin_data_path);
+ /**
+ * Gets permission settings. <code>callback</code> will be called exactly once
+ * to return the settings.
+ *
+ * @param[in] plugin_data_path String containing the directory where the
+ * plugin settings are stored.
+ * @param[in] setting_type What type of setting to retrieve.
+ * @param[in] callback The callback to return retrieved data.
+ * @param[inout] user_data An opaque pointer that will be passed to
+ * <code>callback</code>.
+ */
+ void (*GetPermissionSettings)(
+ const char* plugin_data_path,
+ PP_Flash_BrowserOperations_SettingType setting_type,
+ PPB_Flash_BrowserOperations_GetSettingsCallback callback,
+ void* user_data);
+ /**
+ * Sets default permission. It applies to all sites except those with
+ * site-specific settings.
+ *
+ * @param[in] plugin_data_path String containing the directory where the
+ * plugin settings are stored.
+ * @param[in] setting_type What type of setting to set.
+ * @param[in] permission The default permission.
+ * @param[in] clear_site_specific Whether to remove all site-specific
+ * settings.
+ *
+ * @return <code>PP_TRUE</code> on success, <code>PP_FALSE</code> on failure.
+ */
+ PP_Bool (*SetDefaultPermission)(
+ const char* plugin_data_path,
+ PP_Flash_BrowserOperations_SettingType setting_type,
+ PP_Flash_BrowserOperations_Permission permission,
+ PP_Bool clear_site_speicifc);
+ /**
+ * Sets site-specific permission. If a site has already got site-specific
+ * permission and it is not in <code>sites</code>, it won't be affected.
+ *
+ * @param[in] plugin_data_path String containing the directory where the
+ * plugin settings are stored.
+ * @param[in] setting_type What type of setting to set.
+ * @param[in] site_count How many items are there in <code>sites</code>.
+ * @param[in] sites The site-specific settings. If a site is specified with
+ * <code>PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT</code> permission, it
+ * will be removed from the site-specific list.
+ *
+ * @return <code>PP_TRUE</code> on success, <code>PP_FALSE</code> on failure.
+ */
+ PP_Bool (*SetSitePermission)(
+ const char* plugin_data_path,
+ PP_Flash_BrowserOperations_SettingType setting_type,
+ uint32_t site_count,
+ const struct PP_Flash_BrowserOperations_SiteSetting sites[]);
};
-typedef struct PPP_Flash_BrowserOperations_1_0 PPP_Flash_BrowserOperations;
+typedef struct PPP_Flash_BrowserOperations_1_1 PPP_Flash_BrowserOperations;
+
+struct PPP_Flash_BrowserOperations_1_0 {
+ PP_Bool (*ClearSiteData)(const char* plugin_data_path,
+ const char* site,
+ uint64_t flags,
+ uint64_t max_age);
+};
/**
* @}
*/
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index 536d702..82b9731 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -34,6 +34,7 @@
#include "ppapi/c/private/ppb_host_resolver_private.h"
#include "ppapi/c/private/ppb_net_address_private.h"
#include "ppapi/c/private/ppb_tcp_socket_private.h"
+#include "ppapi/c/private/ppp_flash_browser_operations.h"
#include "ppapi/proxy/ppapi_param_traits.h"
#include "ppapi/proxy/ppapi_proxy_export.h"
#include "ppapi/proxy/serialized_flash_menu.h"
@@ -53,6 +54,8 @@
#define IPC_MESSAGE_START PpapiMsgStart
IPC_ENUM_TRAITS(PP_DeviceType_Dev)
+IPC_ENUM_TRAITS(PP_Flash_BrowserOperations_Permission)
+IPC_ENUM_TRAITS(PP_Flash_BrowserOperations_SettingType)
IPC_ENUM_TRAITS(PP_InputEvent_MouseButton)
IPC_ENUM_TRAITS(PP_InputEvent_Type)
IPC_ENUM_TRAITS(PP_NetAddressFamily_Private)
@@ -258,6 +261,13 @@ IPC_MESSAGE_CONTROL4(PpapiMsg_ClearSiteData,
IPC_MESSAGE_CONTROL1(PpapiHostMsg_ClearSiteDataResult,
bool /* success */)
+IPC_MESSAGE_CONTROL2(PpapiMsg_DeauthorizeContentLicenses,
+ uint32 /* request_id */,
+ FilePath /* plugin_data_path */)
+IPC_MESSAGE_CONTROL2(PpapiHostMsg_DeauthorizeContentLicensesResult,
+ uint32 /* request_id */,
+ bool /* success */)
+
// Broker Process.
IPC_SYNC_MESSAGE_CONTROL2_1(PpapiMsg_ConnectToPlugin,
PP_Instance /* instance */,