summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-27 22:46:53 +0000
committerbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-27 22:46:53 +0000
commit951ef0bdf8d1c272afb3bdce4dd3c39ffaab2fee (patch)
tree4efe0b6a635af851e6a647a0870fd7ccc742f658
parent19d32935fa9b8802f518b07c12c81e2d047e23a7 (diff)
downloadchromium_src-951ef0bdf8d1c272afb3bdce4dd3c39ffaab2fee.zip
chromium_src-951ef0bdf8d1c272afb3bdce4dd3c39ffaab2fee.tar.gz
chromium_src-951ef0bdf8d1c272afb3bdce4dd3c39ffaab2fee.tar.bz2
Add GetSitesWithData and FreeSiteList methods to PPP_Flash_BrowserOperations interface and hook them up in PepperFlashSettingsManager.
BUG=132409 TEST=none Review URL: https://chromiumcodereview.appspot.com/10825018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148839 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/pepper_flash_settings_manager.cc332
-rw-r--r--chrome/browser/pepper_flash_settings_manager.h16
-rw-r--r--content/browser/plugin_data_remover_impl.cc13
-rw-r--r--content/ppapi_plugin/broker_process_dispatcher.cc132
-rw-r--r--content/ppapi_plugin/broker_process_dispatcher.h11
-rw-r--r--ppapi/api/private/ppp_flash_browser_operations.idl54
-rw-r--r--ppapi/c/private/ppp_flash_browser_operations.h71
-rw-r--r--ppapi/proxy/ppapi_messages.h16
8 files changed, 516 insertions, 129 deletions
diff --git a/chrome/browser/pepper_flash_settings_manager.cc b/chrome/browser/pepper_flash_settings_manager.cc
index e12cfb5..1f86737 100644
--- a/chrome/browser/pepper_flash_settings_manager.cc
+++ b/chrome/browser/pepper_flash_settings_manager.cc
@@ -52,6 +52,11 @@ class PepperFlashSettingsManager::Core
void SetSitePermission(uint32 request_id,
PP_Flash_BrowserOperations_SettingType setting_type,
const ppapi::FlashSiteSettings& sites);
+ void GetSitesWithData(uint32 request_id);
+ void ClearSiteData(uint32 request_id,
+ const std::string& site,
+ uint64 flags,
+ uint64 max_age);
// IPC::Listener implementation.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
@@ -66,7 +71,9 @@ class PepperFlashSettingsManager::Core
DEAUTHORIZE_CONTENT_LICENSES,
GET_PERMISSION_SETTINGS,
SET_DEFAULT_PERMISSION,
- SET_SITE_PERMISSION
+ SET_SITE_PERMISSION,
+ GET_SITES_WITH_DATA,
+ CLEAR_SITE_DATA,
};
struct PendingRequest {
@@ -91,6 +98,11 @@ class PepperFlashSettingsManager::Core
// Used by SET_SITE_PERMISSION.
ppapi::FlashSiteSettings sites;
+
+ // Used by CLEAR_SITE_DATA
+ std::string site;
+ uint64 flags;
+ uint64 max_age;
};
virtual ~Core();
@@ -111,6 +123,11 @@ class PepperFlashSettingsManager::Core
uint32 request_id,
PP_Flash_BrowserOperations_SettingType setting_type,
const ppapi::FlashSiteSettings& sites);
+ void GetSitesWithDataOnIOThread(uint32 request_id);
+ void ClearSiteDataOnIOThread(uint32 request_id,
+ const std::string& site,
+ uint64 flags,
+ uint64 max_age);
void DetachOnIOThread();
void NotifyErrorFromIOThread();
@@ -124,6 +141,9 @@ class PepperFlashSettingsManager::Core
const ppapi::FlashSiteSettings& sites);
void NotifySetDefaultPermissionCompleted(uint32 request_id, bool success);
void NotifySetSitePermissionCompleted(uint32 request_id, bool success);
+ void NotifyGetSitesWithDataCompleted(uint32 request_id,
+ const std::vector<std::string>& sites);
+ void NotifyClearSiteDataCompleted(uint32 request_id, bool success);
void NotifyError(
const std::vector<std::pair<uint32, RequestType> >& notifications);
@@ -137,6 +157,9 @@ class PepperFlashSettingsManager::Core
const ppapi::FlashSiteSettings& sites);
void OnSetDefaultPermissionResult(uint32 request_id, bool success);
void OnSetSitePermissionResult(uint32 request_id, bool success);
+ void OnGetSitesWithDataResult(uint32 request_id,
+ const std::vector<std::string>& sites);
+ void OnClearSiteDataResult(uint32 request_id, bool success);
// Used only on the UI thread.
PepperFlashSettingsManager* manager_;
@@ -251,6 +274,26 @@ void PepperFlashSettingsManager::Core::SetSitePermission(
setting_type, sites));
}
+void PepperFlashSettingsManager::Core::GetSitesWithData(uint32 request_id) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&Core::GetSitesWithDataOnIOThread, this, request_id));
+}
+
+void PepperFlashSettingsManager::Core::ClearSiteData(uint32 request_id,
+ const std::string& site,
+ uint64 flags,
+ uint64 max_age) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&Core::ClearSiteDataOnIOThread, this, request_id,
+ site, flags, max_age));
+}
+
bool PepperFlashSettingsManager::Core::OnMessageReceived(
const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP(Core, message)
@@ -262,6 +305,10 @@ bool PepperFlashSettingsManager::Core::OnMessageReceived(
OnSetDefaultPermissionResult)
IPC_MESSAGE_HANDLER(PpapiHostMsg_SetSitePermissionResult,
OnSetSitePermissionResult)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_GetSitesWithDataResult,
+ OnGetSitesWithDataResult)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_ClearSiteDataResult,
+ OnClearSiteDataResult)
IPC_MESSAGE_UNHANDLED_ERROR()
IPC_END_MESSAGE_MAP()
@@ -307,6 +354,9 @@ void PepperFlashSettingsManager::Core::ConnectToChannel(
temp_pending_requests.begin();
iter != temp_pending_requests.end(); ++iter) {
switch (iter->type) {
+ case INVALID_REQUEST_TYPE:
+ NOTREACHED();
+ break;
case DEAUTHORIZE_CONTENT_LICENSES:
DeauthorizeContentLicensesOnIOThread(iter->id);
break;
@@ -321,8 +371,12 @@ void PepperFlashSettingsManager::Core::ConnectToChannel(
case SET_SITE_PERMISSION:
SetSitePermissionOnIOThread(iter->id, iter->setting_type, iter->sites);
break;
- default:
- NOTREACHED();
+ case GET_SITES_WITH_DATA:
+ GetSitesWithDataOnIOThread(iter->id);
+ break;
+ case CLEAR_SITE_DATA:
+ ClearSiteDataOnIOThread(iter->id, iter->site, iter->flags,
+ iter->max_age);
break;
}
}
@@ -471,6 +525,62 @@ void PepperFlashSettingsManager::Core::SetSitePermissionOnIOThread(
}
}
+void PepperFlashSettingsManager::Core::GetSitesWithDataOnIOThread(
+ uint32 request_id) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ if (detached_)
+ return;
+
+ if (!initialized_) {
+ pending_requests_.push_back(PendingRequest());
+ PendingRequest& request = pending_requests_.back();
+ request.id = request_id;
+ request.type = GET_SITES_WITH_DATA;
+ return;
+ }
+
+ pending_responses_.insert(std::make_pair(request_id, GET_SITES_WITH_DATA));
+ IPC::Message* msg = new PpapiMsg_GetSitesWithData(
+ request_id, plugin_data_path_);
+ if (!channel_->Send(msg)) {
+ DLOG(ERROR) << "Couldn't send GetSitesWithData message";
+ // A failure notification for the current request will be sent since
+ // |pending_responses_| has been updated.
+ NotifyErrorFromIOThread();
+ }
+}
+
+void PepperFlashSettingsManager::Core::ClearSiteDataOnIOThread(
+ uint32 request_id,
+ const std::string& site,
+ uint64 flags,
+ uint64 max_age) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ if (detached_)
+ return;
+
+ if (!initialized_) {
+ pending_requests_.push_back(PendingRequest());
+ PendingRequest& request = pending_requests_.back();
+ request.id = request_id;
+ request.type = CLEAR_SITE_DATA;
+ request.site = site;
+ request.flags = flags;
+ request.max_age = max_age;
+ return;
+ }
+
+ pending_responses_.insert(std::make_pair(request_id, CLEAR_SITE_DATA));
+ IPC::Message* msg = new PpapiMsg_ClearSiteData(
+ request_id, plugin_data_path_, site, flags, max_age);
+ if (!channel_->Send(msg)) {
+ DLOG(ERROR) << "Couldn't send ClearSiteData message";
+ // A failure notification for the current request will be sent since
+ // |pending_responses_| has been updated.
+ NotifyErrorFromIOThread();
+ }
+}
+
void PepperFlashSettingsManager::Core::DetachOnIOThread() {
detached_ = true;
}
@@ -542,6 +652,26 @@ void PepperFlashSettingsManager::Core::NotifySetSitePermissionCompleted(
}
}
+void PepperFlashSettingsManager::Core::NotifyGetSitesWithDataCompleted(
+ uint32 request_id,
+ const std::vector<std::string>& sites) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ if (manager_) {
+ manager_->client_->OnGetSitesWithDataCompleted(
+ request_id, sites);
+ }
+}
+
+void PepperFlashSettingsManager::Core::NotifyClearSiteDataCompleted(
+ uint32 request_id,
+ bool success) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ if (manager_)
+ manager_->client_->OnClearSiteDataCompleted(request_id, success);
+}
+
void PepperFlashSettingsManager::Core::NotifyError(
const std::vector<std::pair<uint32, RequestType> >& notifications) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -551,28 +681,36 @@ void PepperFlashSettingsManager::Core::NotifyError(
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;
- case GET_PERMISSION_SETTINGS:
- manager_->client_->OnGetPermissionSettingsCompleted(
- iter->first, false, PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT,
- ppapi::FlashSiteSettings());
- break;
- case SET_DEFAULT_PERMISSION:
- manager_->client_->OnSetDefaultPermissionCompleted(
- iter->first, false);
- break;
- case SET_SITE_PERMISSION:
- manager_->client_->OnSetSitePermissionCompleted(iter->first, false);
- break;
- default:
- NOTREACHED();
- break;
- }
+ if (!manager_)
+ return;
+
+ switch (iter->second) {
+ case INVALID_REQUEST_TYPE:
+ NOTREACHED();
+ break;
+ case DEAUTHORIZE_CONTENT_LICENSES:
+ manager_->client_->OnDeauthorizeContentLicensesCompleted(
+ iter->first, false);
+ break;
+ case GET_PERMISSION_SETTINGS:
+ manager_->client_->OnGetPermissionSettingsCompleted(
+ iter->first, false, PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT,
+ ppapi::FlashSiteSettings());
+ break;
+ case SET_DEFAULT_PERMISSION:
+ manager_->client_->OnSetDefaultPermissionCompleted(
+ iter->first, false);
+ break;
+ case SET_SITE_PERMISSION:
+ manager_->client_->OnSetSitePermissionCompleted(iter->first, false);
+ break;
+ case GET_SITES_WITH_DATA:
+ manager_->client_->OnGetSitesWithDataCompleted(
+ iter->first, std::vector<std::string>());
+ break;
+ case CLEAR_SITE_DATA:
+ manager_->client_->OnClearSiteDataCompleted(iter->first, false);
+ break;
}
}
@@ -591,15 +729,16 @@ void PepperFlashSettingsManager::Core::OnDeauthorizeContentLicensesResult(
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));
- }
+ if (iter == pending_responses_.end())
+ return;
+
+ 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));
}
void PepperFlashSettingsManager::Core::OnGetPermissionSettingsResult(
@@ -615,15 +754,16 @@ void PepperFlashSettingsManager::Core::OnGetPermissionSettingsResult(
std::map<uint32, RequestType>::iterator iter =
pending_responses_.find(request_id);
- if (iter != pending_responses_.end()) {
- DCHECK_EQ(iter->second, GET_PERMISSION_SETTINGS);
-
- pending_responses_.erase(iter);
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(&Core::NotifyGetPermissionSettingsCompleted, this,
- request_id, success, default_permission, sites));
- }
+ if (iter == pending_responses_.end())
+ return;
+
+ DCHECK_EQ(iter->second, GET_PERMISSION_SETTINGS);
+
+ pending_responses_.erase(iter);
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(&Core::NotifyGetPermissionSettingsCompleted, this,
+ request_id, success, default_permission, sites));
}
void PepperFlashSettingsManager::Core::OnSetDefaultPermissionResult(
@@ -637,15 +777,16 @@ void PepperFlashSettingsManager::Core::OnSetDefaultPermissionResult(
std::map<uint32, RequestType>::iterator iter =
pending_responses_.find(request_id);
- if (iter != pending_responses_.end()) {
- DCHECK_EQ(iter->second, SET_DEFAULT_PERMISSION);
-
- pending_responses_.erase(iter);
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(&Core::NotifySetDefaultPermissionCompleted, this,
- request_id, success));
- }
+ if (iter == pending_responses_.end())
+ return;
+
+ DCHECK_EQ(iter->second, SET_DEFAULT_PERMISSION);
+
+ pending_responses_.erase(iter);
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(&Core::NotifySetDefaultPermissionCompleted, this,
+ request_id, success));
}
void PepperFlashSettingsManager::Core::OnSetSitePermissionResult(
@@ -659,15 +800,60 @@ void PepperFlashSettingsManager::Core::OnSetSitePermissionResult(
std::map<uint32, RequestType>::iterator iter =
pending_responses_.find(request_id);
- if (iter != pending_responses_.end()) {
- DCHECK_EQ(iter->second, SET_SITE_PERMISSION);
-
- pending_responses_.erase(iter);
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(&Core::NotifySetSitePermissionCompleted, this, request_id,
- success));
- }
+ if (iter == pending_responses_.end())
+ return;
+
+ DCHECK_EQ(iter->second, SET_SITE_PERMISSION);
+
+ pending_responses_.erase(iter);
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(&Core::NotifySetSitePermissionCompleted, this, request_id,
+ success));
+}
+
+void PepperFlashSettingsManager::Core::OnGetSitesWithDataResult(
+ uint32 request_id,
+ const std::vector<std::string>& sites) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ if (detached_)
+ return;
+
+ std::map<uint32, RequestType>::iterator iter =
+ pending_responses_.find(request_id);
+ if (iter == pending_responses_.end())
+ return;
+
+ DCHECK_EQ(iter->second, GET_SITES_WITH_DATA);
+
+ pending_responses_.erase(iter);
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(&Core::NotifyGetSitesWithDataCompleted, this, request_id,
+ sites));
+}
+
+void PepperFlashSettingsManager::Core::OnClearSiteDataResult(
+ uint32 request_id,
+ bool success) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ if (detached_)
+ return;
+
+ DLOG_IF(ERROR, !success) << "ClearSiteData returned error";
+
+ std::map<uint32, RequestType>::iterator iter =
+ pending_responses_.find(request_id);
+ if (iter == pending_responses_.end())
+ return;
+
+ DCHECK_EQ(iter->second, CLEAR_SITE_DATA);
+
+ pending_responses_.erase(iter);
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(&Core::NotifyClearSiteDataCompleted, this, request_id,
+ success));
}
PepperFlashSettingsManager::PepperFlashSettingsManager(
@@ -681,10 +867,8 @@ PepperFlashSettingsManager::PepperFlashSettingsManager(
}
PepperFlashSettingsManager::~PepperFlashSettingsManager() {
- if (core_.get()) {
+ if (core_.get())
core_->Detach();
- core_ = NULL;
- }
}
// static
@@ -765,6 +949,26 @@ uint32 PepperFlashSettingsManager::SetSitePermission(
return id;
}
+uint32 PepperFlashSettingsManager::GetSitesWithData() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ EnsureCoreExists();
+ uint32 id = GetNextRequestId();
+ core_->GetSitesWithData(id);
+ return id;
+}
+
+uint32 PepperFlashSettingsManager::ClearSiteData(const std::string& site,
+ uint64 flags,
+ uint64 max_age) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ EnsureCoreExists();
+ uint32 id = GetNextRequestId();
+ core_->ClearSiteData(id, site, flags, max_age);
+ return id;
+}
+
uint32 PepperFlashSettingsManager::GetNextRequestId() {
return next_request_id_++;
}
diff --git a/chrome/browser/pepper_flash_settings_manager.h b/chrome/browser/pepper_flash_settings_manager.h
index 463559b..65bb055 100644
--- a/chrome/browser/pepper_flash_settings_manager.h
+++ b/chrome/browser/pepper_flash_settings_manager.h
@@ -42,6 +42,12 @@ class PepperFlashSettingsManager {
virtual void OnSetSitePermissionCompleted(uint32 request_id,
bool success) {}
+
+ virtual void OnGetSitesWithDataCompleted(
+ uint32 request_id,
+ const std::vector<std::string>& sites) {}
+
+ virtual void OnClearSiteDataCompleted(uint32 request_id, bool success) {}
};
// |client| must outlive this object. It is guaranteed that |client| won't
@@ -84,6 +90,16 @@ class PepperFlashSettingsManager {
uint32 SetSitePermission(PP_Flash_BrowserOperations_SettingType setting_type,
const ppapi::FlashSiteSettings& sites);
+ // Gets a list of sites that have stored data.
+ // Client::OnGetSitesWithDataCompleted() will be called when the operation is
+ // completed.
+ uint32 GetSitesWithData();
+
+ // Clears data for a certain site.
+ // Client::OnClearSiteDataompleted() will be called when the operation is
+ // completed.
+ uint32 ClearSiteData(const std::string& site, uint64 flags, uint64 max_age);
+
private:
// Core does most of the work. It is ref-counted so that its lifespan can be
// independent of the containing object's:
diff --git a/content/browser/plugin_data_remover_impl.cc b/content/browser/plugin_data_remover_impl.cc
index e41f133..7981453 100644
--- a/content/browser/plugin_data_remover_impl.cc
+++ b/content/browser/plugin_data_remover_impl.cc
@@ -177,7 +177,7 @@ class PluginDataRemoverImpl::Context
IPC_MESSAGE_HANDLER(PluginHostMsg_ClearSiteDataResult,
OnClearSiteDataResult)
IPC_MESSAGE_HANDLER(PpapiHostMsg_ClearSiteDataResult,
- OnClearSiteDataResult)
+ OnPpapiClearSiteDataResult)
IPC_MESSAGE_UNHANDLED_ERROR()
IPC_END_MESSAGE_MAP()
@@ -232,7 +232,7 @@ class PluginDataRemoverImpl::Context
#else
FilePath plugin_data_path = profile_path.Append(FilePath(plugin_name_));
#endif
- msg = new PpapiMsg_ClearSiteData(plugin_data_path, std::string(),
+ msg = new PpapiMsg_ClearSiteData(0u, plugin_data_path, std::string(),
kClearAllData, max_age);
} else {
msg = new PluginMsg_ClearSiteData(std::string(), kClearAllData, max_age);
@@ -244,7 +244,14 @@ class PluginDataRemoverImpl::Context
}
}
- // Handles the *HostMsg_ClearSiteDataResult message.
+ // Handles the PpapiHostMsg_ClearSiteDataResult message by delegating to the
+ // PluginHostMsg_ClearSiteDataResult handler.
+ void OnPpapiClearSiteDataResult(uint32 request_id, bool success) {
+ DCHECK_EQ(0u, request_id);
+ OnClearSiteDataResult(success);
+ }
+
+ // Handles the PluginHostMsg_ClearSiteDataResult message.
void OnClearSiteDataResult(bool success) {
LOG_IF(ERROR, !success) << "ClearSiteData returned error";
UMA_HISTOGRAM_TIMES("ClearPluginData.time",
diff --git a/content/ppapi_plugin/broker_process_dispatcher.cc b/content/ppapi_plugin/broker_process_dispatcher.cc
index 56dd3a5..a68425c 100644
--- a/content/ppapi_plugin/broker_process_dispatcher.cc
+++ b/content/ppapi_plugin/broker_process_dispatcher.cc
@@ -77,6 +77,7 @@ BrokerProcessDispatcher::BrokerProcessDispatcher(
PP_ConnectInstance_Func connect_instance)
: ppapi::proxy::BrokerSideDispatcher(connect_instance),
get_plugin_interface_(get_plugin_interface),
+ flash_browser_operations_1_3_(NULL),
flash_browser_operations_1_2_(NULL),
flash_browser_operations_1_0_(NULL) {
ChildProcess::current()->AddRefProcess();
@@ -89,6 +90,10 @@ BrokerProcessDispatcher::BrokerProcessDispatcher(
flash_browser_operations_1_2_ =
static_cast<const PPP_Flash_BrowserOperations_1_2*>(
get_plugin_interface_(PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_2));
+
+ flash_browser_operations_1_3_ =
+ static_cast<const PPP_Flash_BrowserOperations_1_3*>(
+ get_plugin_interface_(PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_3));
}
}
@@ -108,6 +113,7 @@ BrokerProcessDispatcher::~BrokerProcessDispatcher() {
bool BrokerProcessDispatcher::OnMessageReceived(const IPC::Message& msg) {
IPC_BEGIN_MESSAGE_MAP(BrokerProcessDispatcher, msg)
+ IPC_MESSAGE_HANDLER(PpapiMsg_GetSitesWithData, OnMsgGetSitesWithData)
IPC_MESSAGE_HANDLER(PpapiMsg_ClearSiteData, OnMsgClearSiteData)
IPC_MESSAGE_HANDLER(PpapiMsg_DeauthorizeContentLicenses,
OnMsgDeauthorizeContentLicenses)
@@ -130,13 +136,22 @@ void BrokerProcessDispatcher::OnGetPermissionSettingsCompleted(
request_id, success, default_permission, sites));
}
+void BrokerProcessDispatcher::OnMsgGetSitesWithData(
+ uint32 request_id,
+ const FilePath& plugin_data_path) {
+ std::vector<std::string> sites;
+ GetSitesWithData(plugin_data_path, &sites);
+ Send(new PpapiHostMsg_GetSitesWithDataResult(request_id, sites));
+}
+
void BrokerProcessDispatcher::OnMsgClearSiteData(
+ uint32 request_id,
const FilePath& plugin_data_path,
const std::string& site,
uint64 flags,
uint64 max_age) {
Send(new PpapiHostMsg_ClearSiteDataResult(
- ClearSiteData(plugin_data_path, site, flags, max_age)));
+ request_id, ClearSiteData(plugin_data_path, site, flags, max_age)));
}
void BrokerProcessDispatcher::OnMsgDeauthorizeContentLicenses(
@@ -150,19 +165,30 @@ void BrokerProcessDispatcher::OnMsgGetPermissionSettings(
uint32 request_id,
const FilePath& plugin_data_path,
PP_Flash_BrowserOperations_SettingType setting_type) {
- if (!flash_browser_operations_1_2_) {
- OnGetPermissionSettingsCompleted(
- request_id, false, PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT,
- ppapi::FlashSiteSettings());
+ if (flash_browser_operations_1_3_) {
+ std::string data_str = ConvertPluginDataPath(plugin_data_path);
+ // The GetPermissionSettingsContext object will be deleted in
+ // GetPermissionSettingsCallback().
+ flash_browser_operations_1_3_->GetPermissionSettings(
+ data_str.c_str(), setting_type, &GetPermissionSettingsCallback,
+ new GetPermissionSettingsContext(AsWeakPtr(), request_id));
return;
}
- std::string data_str = ConvertPluginDataPath(plugin_data_path);
- // The GetPermissionSettingsContext object will be deleted in
- // GetPermissionSettingsCallback().
- flash_browser_operations_1_2_->GetPermissionSettings(
- data_str.c_str(), setting_type, &GetPermissionSettingsCallback,
- new GetPermissionSettingsContext(AsWeakPtr(), request_id));
+ if (flash_browser_operations_1_2_) {
+ std::string data_str = ConvertPluginDataPath(plugin_data_path);
+ // The GetPermissionSettingsContext object will be deleted in
+ // GetPermissionSettingsCallback().
+ flash_browser_operations_1_2_->GetPermissionSettings(
+ data_str.c_str(), setting_type, &GetPermissionSettingsCallback,
+ new GetPermissionSettingsContext(AsWeakPtr(), request_id));
+ return;
+ }
+
+ OnGetPermissionSettingsCompleted(
+ request_id, false, PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT,
+ ppapi::FlashSiteSettings());
+ return;
}
void BrokerProcessDispatcher::OnMsgSetDefaultPermission(
@@ -186,19 +212,42 @@ void BrokerProcessDispatcher::OnMsgSetSitePermission(
request_id, SetSitePermission(plugin_data_path, setting_type, sites)));
}
+void BrokerProcessDispatcher::GetSitesWithData(
+ const FilePath& plugin_data_path,
+ std::vector<std::string>* site_vector) {
+ std::string data_str = ConvertPluginDataPath(plugin_data_path);
+ if (flash_browser_operations_1_3_) {
+ char** sites = NULL;
+ flash_browser_operations_1_3_->GetSitesWithData(data_str.c_str(), &sites);
+ if (!sites)
+ return;
+
+ for (size_t i = 0; sites[i]; ++i)
+ site_vector->push_back(sites[i]);
+
+ flash_browser_operations_1_3_->FreeSiteList(sites);
+ }
+}
+
bool BrokerProcessDispatcher::ClearSiteData(const FilePath& plugin_data_path,
const std::string& site,
uint64 flags,
uint64 max_age) {
std::string data_str = ConvertPluginDataPath(plugin_data_path);
- if (flash_browser_operations_1_2_) {
- flash_browser_operations_1_2_->ClearSiteData(
+ if (flash_browser_operations_1_3_) {
+ flash_browser_operations_1_3_->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.
+ if (flash_browser_operations_1_2_) {
+ flash_browser_operations_1_2_->ClearSiteData(
+ data_str.c_str(), site.empty() ? NULL : site.c_str(), flags, max_age);
+ return true;
+ }
+
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);
@@ -210,12 +259,19 @@ bool BrokerProcessDispatcher::ClearSiteData(const FilePath& plugin_data_path,
bool BrokerProcessDispatcher::DeauthorizeContentLicenses(
const FilePath& plugin_data_path) {
- if (!flash_browser_operations_1_2_)
- return false;
+ if (flash_browser_operations_1_3_) {
+ std::string data_str = ConvertPluginDataPath(plugin_data_path);
+ return PP_ToBool(flash_browser_operations_1_3_->DeauthorizeContentLicenses(
+ data_str.c_str()));
+ }
- std::string data_str = ConvertPluginDataPath(plugin_data_path);
- return PP_ToBool(flash_browser_operations_1_2_->DeauthorizeContentLicenses(
- data_str.c_str()));
+ if (flash_browser_operations_1_2_) {
+ std::string data_str = ConvertPluginDataPath(plugin_data_path);
+ return PP_ToBool(flash_browser_operations_1_2_->DeauthorizeContentLicenses(
+ data_str.c_str()));
+ }
+
+ return false;
}
bool BrokerProcessDispatcher::SetDefaultPermission(
@@ -223,22 +279,27 @@ bool BrokerProcessDispatcher::SetDefaultPermission(
PP_Flash_BrowserOperations_SettingType setting_type,
PP_Flash_BrowserOperations_Permission permission,
bool clear_site_specific) {
- if (!flash_browser_operations_1_2_)
- return false;
+ if (flash_browser_operations_1_3_) {
+ std::string data_str = ConvertPluginDataPath(plugin_data_path);
+ return PP_ToBool(flash_browser_operations_1_3_->SetDefaultPermission(
+ data_str.c_str(), setting_type, permission,
+ PP_FromBool(clear_site_specific)));
+ }
- std::string data_str = ConvertPluginDataPath(plugin_data_path);
- return PP_ToBool(flash_browser_operations_1_2_->SetDefaultPermission(
- data_str.c_str(), setting_type, permission,
- PP_FromBool(clear_site_specific)));
+ if (flash_browser_operations_1_2_) {
+ std::string data_str = ConvertPluginDataPath(plugin_data_path);
+ return PP_ToBool(flash_browser_operations_1_2_->SetDefaultPermission(
+ data_str.c_str(), setting_type, permission,
+ PP_FromBool(clear_site_specific)));
+ }
+
+ return false;
}
bool BrokerProcessDispatcher::SetSitePermission(
const FilePath& plugin_data_path,
PP_Flash_BrowserOperations_SettingType setting_type,
const ppapi::FlashSiteSettings& sites) {
- if (!flash_browser_operations_1_2_)
- return false;
-
if (sites.empty())
return true;
@@ -251,8 +312,19 @@ bool BrokerProcessDispatcher::SetSitePermission(
site_array[i].permission = sites[i].permission;
}
- PP_Bool result = flash_browser_operations_1_2_->SetSitePermission(
- data_str.c_str(), setting_type, sites.size(), site_array.get());
+ if (flash_browser_operations_1_3_) {
+ PP_Bool result = flash_browser_operations_1_3_->SetSitePermission(
+ data_str.c_str(), setting_type, sites.size(), site_array.get());
+
+ return PP_ToBool(result);
+ }
- return PP_ToBool(result);
+ if (flash_browser_operations_1_2_) {
+ PP_Bool result = flash_browser_operations_1_2_->SetSitePermission(
+ data_str.c_str(), setting_type, sites.size(), site_array.get());
+
+ return PP_ToBool(result);
+ }
+
+ return false;
}
diff --git a/content/ppapi_plugin/broker_process_dispatcher.h b/content/ppapi_plugin/broker_process_dispatcher.h
index 486ce4d..4678745 100644
--- a/content/ppapi_plugin/broker_process_dispatcher.h
+++ b/content/ppapi_plugin/broker_process_dispatcher.h
@@ -32,7 +32,10 @@ class BrokerProcessDispatcher
const ppapi::FlashSiteSettings& sites);
private:
- void OnMsgClearSiteData(const FilePath& plugin_data_path,
+ void OnMsgGetSitesWithData(uint32 request_id,
+ const FilePath& plugin_data_path);
+ void OnMsgClearSiteData(uint32 request_id,
+ const FilePath& plugin_data_path,
const std::string& site,
uint64 flags,
uint64 max_age);
@@ -54,11 +57,16 @@ class BrokerProcessDispatcher
PP_Flash_BrowserOperations_SettingType setting_type,
const ppapi::FlashSiteSettings& sites);
+ // Returns a list of sites that have data stored.
+ void GetSitesWithData(const FilePath& plugin_data_path,
+ std::vector<std::string>* sites);
+
// 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);
bool SetDefaultPermission(const FilePath& plugin_data_path,
PP_Flash_BrowserOperations_SettingType setting_type,
@@ -70,6 +78,7 @@ class BrokerProcessDispatcher
PP_GetInterface_Func get_plugin_interface_;
+ const PPP_Flash_BrowserOperations_1_3* flash_browser_operations_1_3_;
const PPP_Flash_BrowserOperations_1_2* flash_browser_operations_1_2_;
const PPP_Flash_BrowserOperations_1_0* flash_browser_operations_1_0_;
diff --git a/ppapi/api/private/ppp_flash_browser_operations.idl b/ppapi/api/private/ppp_flash_browser_operations.idl
index 4eeadb7..acd4432 100644
--- a/ppapi/api/private/ppp_flash_browser_operations.idl
+++ b/ppapi/api/private/ppp_flash_browser_operations.idl
@@ -9,7 +9,8 @@
label Chrome {
M20 = 1.0,
- M21 = 1.2
+ M21 = 1.2,
+ M22 = 1.3
};
[assert_size(4)]
@@ -46,29 +47,28 @@ interface PPP_Flash_BrowserOperations {
/**
* This function allows the plugin to implement the "Clear site data" feature.
*
- * @plugin_data_path String containing the directory where the plugin data is
+ * @param[in] plugin_data_path String containing the directory where the
+ * plugin data is
* stored. On UTF16 systems (Windows), this will be encoded as UTF-8. It will
* be an absolute path and will not have a directory separator (slash) at the
* end.
- *
- * @arg site String specifying which site to clear the data for. This will
- * be null to clear data for all sites.
- *
- * @arg flags Currently always 0 in Chrome to clear all data. This may be
- * extended in the future to clear only specific types of data.
- *
- * @arg max_age The maximum age in seconds to clear data for. This allows the
- * plugin to implement "clear past hour" and "clear past data", etc.
+ * @param[in] site String specifying which site to clear the data for. This
+ * will be null to clear data for all sites.
+ * @param[in] flags Currently always 0 in Chrome to clear all data. This may
+ * be extended in the future to clear only specific types of data.
+ * @param[in] max_age The maximum age in seconds to clear data for. This
+ * allows the plugin to implement "clear past hour" and "clear past data",
+ * etc.
*
* @return PP_TRUE on success, PP_FALSE on failure.
*
* See also the NPP_ClearSiteData function in NPAPI.
* https://wiki.mozilla.org/NPAPI:ClearSiteData
*/
- PP_Bool ClearSiteData(str_t plugin_data_path,
- str_t site,
- uint64_t flags,
- uint64_t max_age);
+ PP_Bool ClearSiteData([in] str_t plugin_data_path,
+ [in] str_t site,
+ [in] uint64_t flags,
+ [in] uint64_t max_age);
/**
* Requests the plugin to deauthorize content licenses. It prevents Flash from
@@ -141,4 +141,28 @@ interface PPP_Flash_BrowserOperations {
[in] PP_Flash_BrowserOperations_SettingType setting_type,
[in] uint32_t site_count,
[in, size_is(site_count)] PP_Flash_BrowserOperations_SiteSetting[] sites);
+
+ /**
+ * Returns a list of sites that have stored data, for use with the
+ * "Clear site data" feature.
+ *
+ * @param[in] plugin_data_path String containing the directory where the
+ * plugin data is stored.
+ * @param[out] sites A NULL-terminated array of sites that have stored data.
+ * Use FreeSiteList on the the array when done.
+ *
+ * See also the NPP_GetSitesWithData function in NPAPI:
+ * https://wiki.mozilla.org/NPAPI:ClearSiteData
+ */
+ [version=1.3]
+ void GetSitesWithData([in] str_t plugin_data_path,
+ [out] str_t[] sites);
+
+ /**
+ * Frees the list of sites returned by GetSitesWithData.
+ *
+ * @param[in] sites A NULL-terminated array of strings.
+ */
+ [version=1.3]
+ void FreeSiteList([inout] str_t[] sites);
};
diff --git a/ppapi/c/private/ppp_flash_browser_operations.h b/ppapi/c/private/ppp_flash_browser_operations.h
index 80174f9..12d1c86 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 Fri Jun 15 17:00:18 2012.
+ * modified Wed Jul 25 16:53:17 2012.
*/
#ifndef PPAPI_C_PRIVATE_PPP_FLASH_BROWSER_OPERATIONS_H_
@@ -18,8 +18,10 @@
"PPP_Flash_BrowserOperations;1.0"
#define PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_2 \
"PPP_Flash_BrowserOperations;1.2"
+#define PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_3 \
+ "PPP_Flash_BrowserOperations;1.3"
#define PPP_FLASH_BROWSEROPERATIONS_INTERFACE \
- PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_2
+ PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_3
/**
* @file
@@ -82,23 +84,22 @@ typedef void (*PPB_Flash_BrowserOperations_GetSettingsCallback)(
/**
* This interface allows the browser to request the plugin do things.
*/
-struct PPP_Flash_BrowserOperations_1_2 {
+struct PPP_Flash_BrowserOperations_1_3 {
/**
* This function allows the plugin to implement the "Clear site data" feature.
*
- * @plugin_data_path String containing the directory where the plugin data is
+ * @param[in] plugin_data_path String containing the directory where the
+ * plugin data is
* stored. On UTF16 systems (Windows), this will be encoded as UTF-8. It will
* be an absolute path and will not have a directory separator (slash) at the
* end.
- *
- * @arg site String specifying which site to clear the data for. This will
- * be null to clear data for all sites.
- *
- * @arg flags Currently always 0 in Chrome to clear all data. This may be
- * extended in the future to clear only specific types of data.
- *
- * @arg max_age The maximum age in seconds to clear data for. This allows the
- * plugin to implement "clear past hour" and "clear past data", etc.
+ * @param[in] site String specifying which site to clear the data for. This
+ * will be null to clear data for all sites.
+ * @param[in] flags Currently always 0 in Chrome to clear all data. This may
+ * be extended in the future to clear only specific types of data.
+ * @param[in] max_age The maximum age in seconds to clear data for. This
+ * allows the plugin to implement "clear past hour" and "clear past data",
+ * etc.
*
* @return PP_TRUE on success, PP_FALSE on failure.
*
@@ -173,9 +174,28 @@ struct PPP_Flash_BrowserOperations_1_2 {
PP_Flash_BrowserOperations_SettingType setting_type,
uint32_t site_count,
const struct PP_Flash_BrowserOperations_SiteSetting sites[]);
+ /**
+ * Returns a list of sites that have stored data, for use with the
+ * "Clear site data" feature.
+ *
+ * @param[in] plugin_data_path String containing the directory where the
+ * plugin data is stored.
+ * @param[out] sites A NULL-terminated array of sites that have stored data.
+ * Use FreeSiteList on the the array when done.
+ *
+ * See also the NPP_GetSitesWithData function in NPAPI:
+ * https://wiki.mozilla.org/NPAPI:ClearSiteData
+ */
+ void (*GetSitesWithData)(const char* plugin_data_path, char** sites[]);
+ /**
+ * Frees the list of sites returned by GetSitesWithData.
+ *
+ * @param[in] sites A NULL-terminated array of strings.
+ */
+ void (*FreeSiteList)(char* sites[]);
};
-typedef struct PPP_Flash_BrowserOperations_1_2 PPP_Flash_BrowserOperations;
+typedef struct PPP_Flash_BrowserOperations_1_3 PPP_Flash_BrowserOperations;
struct PPP_Flash_BrowserOperations_1_0 {
PP_Bool (*ClearSiteData)(const char* plugin_data_path,
@@ -183,6 +203,29 @@ struct PPP_Flash_BrowserOperations_1_0 {
uint64_t flags,
uint64_t max_age);
};
+
+struct PPP_Flash_BrowserOperations_1_2 {
+ PP_Bool (*ClearSiteData)(const char* plugin_data_path,
+ const char* site,
+ uint64_t flags,
+ uint64_t max_age);
+ PP_Bool (*DeauthorizeContentLicenses)(const char* plugin_data_path);
+ void (*GetPermissionSettings)(
+ const char* plugin_data_path,
+ PP_Flash_BrowserOperations_SettingType setting_type,
+ PPB_Flash_BrowserOperations_GetSettingsCallback callback,
+ void* user_data);
+ PP_Bool (*SetDefaultPermission)(
+ const char* plugin_data_path,
+ PP_Flash_BrowserOperations_SettingType setting_type,
+ PP_Flash_BrowserOperations_Permission permission,
+ PP_Bool clear_site_specific);
+ 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[]);
+};
/**
* @}
*/
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index 16cc01b..7d392b5 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -289,15 +289,27 @@ IPC_SYNC_MESSAGE_CONTROL1_1(PpapiMsg_SupportsInterface,
IPC_MESSAGE_CONTROL1(PpapiMsg_SetNetworkState,
bool /* online */)
+// Requests a list of sites that have data stored from the plugin. The plugin
+// process will respond with PpapiHostMsg_GetSitesWithDataResult. This is used
+// for Flash.
+IPC_MESSAGE_CONTROL2(PpapiMsg_GetSitesWithData,
+ uint32 /* request_id */,
+ FilePath /* plugin_data_path */)
+IPC_MESSAGE_CONTROL2(PpapiHostMsg_GetSitesWithDataResult,
+ uint32 /* request_id */,
+ std::vector<std::string> /* sites */)
+
// Instructs the plugin to clear data for the given site & time. The plugin
// process will respond with PpapiHostMsg_ClearSiteDataResult. This is used
// for Flash.
-IPC_MESSAGE_CONTROL4(PpapiMsg_ClearSiteData,
+IPC_MESSAGE_CONTROL5(PpapiMsg_ClearSiteData,
+ uint32 /* request_id */,
FilePath /* plugin_data_path */,
std::string /* site */,
uint64 /* flags */,
uint64 /* max_age */)
-IPC_MESSAGE_CONTROL1(PpapiHostMsg_ClearSiteDataResult,
+IPC_MESSAGE_CONTROL2(PpapiHostMsg_ClearSiteDataResult,
+ uint32 /* request_id */,
bool /* success */)
IPC_MESSAGE_CONTROL2(PpapiMsg_DeauthorizeContentLicenses,