| Index: chrome/browser/pepper_flash_settings_manager.cc
|
| ===================================================================
|
| --- chrome/browser/pepper_flash_settings_manager.cc (revision 141490)
|
| +++ chrome/browser/pepper_flash_settings_manager.cc (working copy)
|
| @@ -40,17 +40,6 @@
|
| void Detach();
|
|
|
| void DeauthorizeContentLicenses(uint32 request_id);
|
| - void GetPermissionSettings(
|
| - uint32 request_id,
|
| - PP_Flash_BrowserOperations_SettingType setting_type);
|
| - void SetDefaultPermission(
|
| - uint32 request_id,
|
| - PP_Flash_BrowserOperations_SettingType setting_type,
|
| - PP_Flash_BrowserOperations_Permission permission,
|
| - bool clear_site_specific);
|
| - void SetSitePermission(uint32 request_id,
|
| - PP_Flash_BrowserOperations_SettingType setting_type,
|
| - const ppapi::FlashSiteSettings& sites);
|
|
|
| // IPC::Channel::Listener implementation.
|
| virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
|
| @@ -62,34 +51,14 @@
|
|
|
| enum RequestType {
|
| INVALID_REQUEST_TYPE = 0,
|
| - DEAUTHORIZE_CONTENT_LICENSES,
|
| - GET_PERMISSION_SETTINGS,
|
| - SET_DEFAULT_PERMISSION,
|
| - SET_SITE_PERMISSION
|
| + DEAUTHORIZE_CONTENT_LICENSES
|
| };
|
|
|
| struct PendingRequest {
|
| - PendingRequest()
|
| - : id(0),
|
| - type(INVALID_REQUEST_TYPE),
|
| - setting_type(PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_CAMERAMIC),
|
| - permission(PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT),
|
| - clear_site_specific(false) {
|
| - }
|
| + PendingRequest() : id(0), type(INVALID_REQUEST_TYPE) {}
|
|
|
| uint32 id;
|
| RequestType type;
|
| -
|
| - // Used by GET_PERMISSION_SETTINGS, SET_DEFAULT_PERMISSION and
|
| - // SET_SITE_PERMISSION.
|
| - PP_Flash_BrowserOperations_SettingType setting_type;
|
| -
|
| - // Used by SET_DEFAULT_PERMISSION.
|
| - PP_Flash_BrowserOperations_Permission permission;
|
| - bool clear_site_specific;
|
| -
|
| - // Used by SET_SITE_PERMISSION.
|
| - ppapi::FlashSiteSettings sites;
|
| };
|
|
|
| virtual ~Core();
|
| @@ -98,43 +67,15 @@
|
| void ConnectToChannel(bool success, const IPC::ChannelHandle& handle);
|
|
|
| void DeauthorizeContentLicensesOnIOThread(uint32 request_id);
|
| - void GetPermissionSettingsOnIOThread(
|
| - uint32 request_id,
|
| - PP_Flash_BrowserOperations_SettingType setting_type);
|
| - void SetDefaultPermissionOnIOThread(
|
| - uint32 request_id,
|
| - PP_Flash_BrowserOperations_SettingType setting_type,
|
| - PP_Flash_BrowserOperations_Permission permission,
|
| - bool clear_site_specific);
|
| - void SetSitePermissionOnIOThread(
|
| - uint32 request_id,
|
| - PP_Flash_BrowserOperations_SettingType setting_type,
|
| - const ppapi::FlashSiteSettings& sites);
|
| -
|
| void NotifyErrorFromIOThread();
|
|
|
| void NotifyDeauthorizeContentLicensesCompleted(uint32 request_id,
|
| bool success);
|
| - void NotifyGetPermissionSettingsCompleted(
|
| - uint32 request_id,
|
| - bool success,
|
| - PP_Flash_BrowserOperations_Permission default_permission,
|
| - const ppapi::FlashSiteSettings& sites);
|
| - void NotifySetDefaultPermissionCompleted(uint32 request_id, bool success);
|
| - void NotifySetSitePermissionCompleted(uint32 request_id, bool success);
|
| -
|
| void NotifyError(
|
| const std::vector<std::pair<uint32, RequestType> >& notifications);
|
|
|
| // Message handlers.
|
| void OnDeauthorizeContentLicensesResult(uint32 request_id, bool success);
|
| - void OnGetPermissionSettingsResult(
|
| - uint32 request_id,
|
| - bool success,
|
| - PP_Flash_BrowserOperations_Permission default_permission,
|
| - const ppapi::FlashSiteSettings& sites);
|
| - void OnSetDefaultPermissionResult(uint32 request_id, bool success);
|
| - void OnSetSitePermissionResult(uint32 request_id, bool success);
|
|
|
| // Used only on the UI thread.
|
| PepperFlashSettingsManager* manager_;
|
| @@ -199,53 +140,11 @@
|
| request_id));
|
| }
|
|
|
| -void PepperFlashSettingsManager::Core::GetPermissionSettings(
|
| - uint32 request_id,
|
| - PP_Flash_BrowserOperations_SettingType setting_type) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| -
|
| - BrowserThread::PostTask(
|
| - BrowserThread::IO, FROM_HERE,
|
| - base::Bind(&Core::GetPermissionSettingsOnIOThread, this, request_id,
|
| - setting_type));
|
| -}
|
| -
|
| -void PepperFlashSettingsManager::Core::SetDefaultPermission(
|
| - uint32 request_id,
|
| - PP_Flash_BrowserOperations_SettingType setting_type,
|
| - PP_Flash_BrowserOperations_Permission permission,
|
| - bool clear_site_specific) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| -
|
| - BrowserThread::PostTask(
|
| - BrowserThread::IO, FROM_HERE,
|
| - base::Bind(&Core::SetDefaultPermissionOnIOThread, this, request_id,
|
| - setting_type, permission, clear_site_specific));
|
| -}
|
| -
|
| -void PepperFlashSettingsManager::Core::SetSitePermission(
|
| - uint32 request_id,
|
| - PP_Flash_BrowserOperations_SettingType setting_type,
|
| - const ppapi::FlashSiteSettings& sites) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| -
|
| - BrowserThread::PostTask(
|
| - BrowserThread::IO, FROM_HERE,
|
| - base::Bind(&Core::SetSitePermissionOnIOThread, this, request_id,
|
| - setting_type, sites));
|
| -}
|
| -
|
| bool PepperFlashSettingsManager::Core::OnMessageReceived(
|
| const IPC::Message& message) {
|
| IPC_BEGIN_MESSAGE_MAP(Core, message)
|
| IPC_MESSAGE_HANDLER(PpapiHostMsg_DeauthorizeContentLicensesResult,
|
| OnDeauthorizeContentLicensesResult)
|
| - IPC_MESSAGE_HANDLER(PpapiHostMsg_GetPermissionSettingsResult,
|
| - OnGetPermissionSettingsResult)
|
| - IPC_MESSAGE_HANDLER(PpapiHostMsg_SetDefaultPermissionResult,
|
| - OnSetDefaultPermissionResult)
|
| - IPC_MESSAGE_HANDLER(PpapiHostMsg_SetSitePermissionResult,
|
| - OnSetSitePermissionResult)
|
| IPC_MESSAGE_UNHANDLED_ERROR()
|
| IPC_END_MESSAGE_MAP()
|
|
|
| @@ -291,14 +190,14 @@
|
| DCHECK(!channel_.get());
|
|
|
| if (!success) {
|
| - DLOG(ERROR) << "Couldn't open plugin channel";
|
| + LOG(ERROR) << "Couldn't open plugin channel";
|
| NotifyErrorFromIOThread();
|
| return;
|
| }
|
|
|
| channel_.reset(new IPC::Channel(handle, IPC::Channel::MODE_CLIENT, this));
|
| if (!channel_->Connect()) {
|
| - DLOG(ERROR) << "Couldn't connect to plugin";
|
| + LOG(ERROR) << "Couldn't connect to plugin";
|
| NotifyErrorFromIOThread();
|
| return;
|
| }
|
| @@ -314,17 +213,6 @@
|
| case DEAUTHORIZE_CONTENT_LICENSES:
|
| DeauthorizeContentLicensesOnIOThread(iter->id);
|
| break;
|
| - case GET_PERMISSION_SETTINGS:
|
| - GetPermissionSettingsOnIOThread(iter->id, iter->setting_type);
|
| - break;
|
| - case SET_DEFAULT_PERMISSION:
|
| - SetDefaultPermissionOnIOThread(
|
| - iter->id, iter->setting_type, iter->permission,
|
| - iter->clear_site_specific);
|
| - break;
|
| - case SET_SITE_PERMISSION:
|
| - SetSitePermissionOnIOThread(iter->id, iter->setting_type, iter->sites);
|
| - break;
|
| default:
|
| NOTREACHED();
|
| break;
|
| @@ -349,96 +237,13 @@
|
| IPC::Message* msg =
|
| new PpapiMsg_DeauthorizeContentLicenses(request_id, plugin_data_path_);
|
| if (!channel_->Send(msg)) {
|
| - DLOG(ERROR) << "Couldn't send DeauthorizeContentLicenses message";
|
| + 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::GetPermissionSettingsOnIOThread(
|
| - uint32 request_id,
|
| - PP_Flash_BrowserOperations_SettingType setting_type) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| -
|
| - if (!initialized_) {
|
| - PendingRequest request;
|
| - request.id = request_id;
|
| - request.type = GET_PERMISSION_SETTINGS;
|
| - request.setting_type = setting_type;
|
| - pending_requests_.push_back(request);
|
| - return;
|
| - }
|
| -
|
| - pending_responses_.insert(
|
| - std::make_pair(request_id, GET_PERMISSION_SETTINGS));
|
| - IPC::Message* msg = new PpapiMsg_GetPermissionSettings(
|
| - request_id, plugin_data_path_, setting_type);
|
| - if (!channel_->Send(msg)) {
|
| - DLOG(ERROR) << "Couldn't send GetPermissionSettings message";
|
| - // A failure notification for the current request will be sent since
|
| - // |pending_responses_| has been updated.
|
| - NotifyErrorFromIOThread();
|
| - }
|
| -}
|
| -
|
| -void PepperFlashSettingsManager::Core::SetDefaultPermissionOnIOThread(
|
| - uint32 request_id,
|
| - PP_Flash_BrowserOperations_SettingType setting_type,
|
| - PP_Flash_BrowserOperations_Permission permission,
|
| - bool clear_site_specific) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| -
|
| - if (!initialized_) {
|
| - PendingRequest request;
|
| - request.id = request_id;
|
| - request.type = SET_DEFAULT_PERMISSION;
|
| - request.setting_type = setting_type;
|
| - request.permission = permission;
|
| - request.clear_site_specific = clear_site_specific;
|
| - pending_requests_.push_back(request);
|
| - return;
|
| - }
|
| -
|
| - pending_responses_.insert(std::make_pair(request_id, SET_DEFAULT_PERMISSION));
|
| - IPC::Message* msg = new PpapiMsg_SetDefaultPermission(
|
| - request_id, plugin_data_path_, setting_type, permission,
|
| - clear_site_specific);
|
| - if (!channel_->Send(msg)) {
|
| - DLOG(ERROR) << "Couldn't send SetDefaultPermission message";
|
| - // A failure notification for the current request will be sent since
|
| - // |pending_responses_| has been updated.
|
| - NotifyErrorFromIOThread();
|
| - }
|
| -}
|
| -
|
| -void PepperFlashSettingsManager::Core::SetSitePermissionOnIOThread(
|
| - uint32 request_id,
|
| - PP_Flash_BrowserOperations_SettingType setting_type,
|
| - const ppapi::FlashSiteSettings& sites) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| -
|
| - if (!initialized_) {
|
| - pending_requests_.push_back(PendingRequest());
|
| - PendingRequest& request = pending_requests_.back();
|
| - request.id = request_id;
|
| - request.type = SET_SITE_PERMISSION;
|
| - request.setting_type = setting_type;
|
| - request.sites = sites;
|
| - return;
|
| - }
|
| -
|
| - pending_responses_.insert(std::make_pair(request_id, SET_SITE_PERMISSION));
|
| - IPC::Message* msg = new PpapiMsg_SetSitePermission(
|
| - request_id, plugin_data_path_, setting_type, sites);
|
| - if (!channel_->Send(msg)) {
|
| - DLOG(ERROR) << "Couldn't send SetSitePermission 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));
|
|
|
| @@ -469,41 +274,6 @@
|
| }
|
| }
|
|
|
| -void PepperFlashSettingsManager::Core::NotifyGetPermissionSettingsCompleted(
|
| - uint32 request_id,
|
| - bool success,
|
| - PP_Flash_BrowserOperations_Permission default_permission,
|
| - const ppapi::FlashSiteSettings& sites) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| -
|
| - if (manager_) {
|
| - manager_->client_->OnGetPermissionSettingsCompleted(
|
| - request_id, success, default_permission, sites);
|
| - }
|
| -}
|
| -
|
| -void PepperFlashSettingsManager::Core::NotifySetDefaultPermissionCompleted(
|
| - uint32 request_id,
|
| - bool success) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| -
|
| - if (manager_) {
|
| - manager_->client_->OnSetDefaultPermissionCompleted(
|
| - request_id, success);
|
| - }
|
| -}
|
| -
|
| -void PepperFlashSettingsManager::Core::NotifySetSitePermissionCompleted(
|
| - uint32 request_id,
|
| - bool success) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| -
|
| - if (manager_) {
|
| - manager_->client_->OnSetSitePermissionCompleted(
|
| - request_id, success);
|
| - }
|
| -}
|
| -
|
| void PepperFlashSettingsManager::Core::NotifyError(
|
| const std::vector<std::pair<uint32, RequestType> >& notifications) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| @@ -516,21 +286,9 @@
|
| if (manager_) {
|
| switch (iter->second) {
|
| case DEAUTHORIZE_CONTENT_LICENSES:
|
| - manager_->client_->OnDeauthorizeContentLicensesCompleted(
|
| - iter->first, false);
|
| + 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;
|
| @@ -546,7 +304,7 @@
|
| uint32 request_id,
|
| bool success) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| - DLOG_IF(ERROR, !success) << "DeauthorizeContentLicenses returned error";
|
| + LOG_IF(ERROR, !success) << "DeauthorizeContentLicenses returned error";
|
|
|
| std::map<uint32, RequestType>::iterator iter =
|
| pending_responses_.find(request_id);
|
| @@ -561,65 +319,6 @@
|
| }
|
| }
|
|
|
| -void PepperFlashSettingsManager::Core::OnGetPermissionSettingsResult(
|
| - uint32 request_id,
|
| - bool success,
|
| - PP_Flash_BrowserOperations_Permission default_permission,
|
| - const ppapi::FlashSiteSettings& sites) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| - DLOG_IF(ERROR, !success) << "GetPermissionSettings returned error";
|
| -
|
| - 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));
|
| - }
|
| -}
|
| -
|
| -void PepperFlashSettingsManager::Core::OnSetDefaultPermissionResult(
|
| - uint32 request_id,
|
| - bool success) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| - DLOG_IF(ERROR, !success) << "SetDefaultPermission returned error";
|
| -
|
| - 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));
|
| - }
|
| -}
|
| -
|
| -void PepperFlashSettingsManager::Core::OnSetSitePermissionResult(
|
| - uint32 request_id,
|
| - bool success) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| - DLOG_IF(ERROR, !success) << "SetSitePermission returned error";
|
| -
|
| - 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));
|
| - }
|
| -}
|
| -
|
| PepperFlashSettingsManager::PepperFlashSettingsManager(
|
| Client* client,
|
| content::BrowserContext* browser_context)
|
| @@ -681,40 +380,6 @@
|
| return id;
|
| }
|
|
|
| -uint32 PepperFlashSettingsManager::GetPermissionSettings(
|
| - PP_Flash_BrowserOperations_SettingType setting_type) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| -
|
| - EnsureCoreExists();
|
| - uint32 id = GetNextRequestId();
|
| - core_->GetPermissionSettings(id, setting_type);
|
| - return id;
|
| -}
|
| -
|
| -uint32 PepperFlashSettingsManager::SetDefaultPermission(
|
| - PP_Flash_BrowserOperations_SettingType setting_type,
|
| - PP_Flash_BrowserOperations_Permission permission,
|
| - bool clear_site_specific) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| -
|
| - EnsureCoreExists();
|
| - uint32 id = GetNextRequestId();
|
| - core_->SetDefaultPermission(id, setting_type, permission,
|
| - clear_site_specific);
|
| - return id;
|
| -}
|
| -
|
| -uint32 PepperFlashSettingsManager::SetSitePermission(
|
| - PP_Flash_BrowserOperations_SettingType setting_type,
|
| - const ppapi::FlashSiteSettings& sites) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| -
|
| - EnsureCoreExists();
|
| - uint32 id = GetNextRequestId();
|
| - core_->SetSitePermission(id, setting_type, sites);
|
| - return id;
|
| -}
|
| -
|
| uint32 PepperFlashSettingsManager::GetNextRequestId() {
|
| return next_request_id_++;
|
| }
|
|
|