diff options
author | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-11 21:01:54 +0000 |
---|---|---|
committer | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-11 21:01:54 +0000 |
commit | 5c69d0840291641a73bbe040a6e6cebe0c3114d4 (patch) | |
tree | df80996df716d4188d55071e228a51805dccb085 /chrome | |
parent | 0d02104a4c82b4989e830e140cb6129f320c2191 (diff) | |
download | chromium_src-5c69d0840291641a73bbe040a6e6cebe0c3114d4.zip chromium_src-5c69d0840291641a73bbe040a6e6cebe0c3114d4.tar.gz chromium_src-5c69d0840291641a73bbe040a6e6cebe0c3114d4.tar.bz2 |
Revert 141482 - Pepper Flash settings integration - camera and microphone.
BUG=112190
TEST=None
Review URL: https://chromiumcodereview.appspot.com/10479015
TBR=yzshen@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10536103
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141492 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/generated_resources.grd | 12 | ||||
-rw-r--r-- | chrome/browser/DEPS | 2 | ||||
-rw-r--r-- | chrome/browser/pepper_flash_settings_manager.cc | 351 | ||||
-rw-r--r-- | chrome/browser/pepper_flash_settings_manager.h | 35 | ||||
-rw-r--r-- | chrome/browser/resources/options2/content_settings.html | 21 | ||||
-rw-r--r-- | chrome/browser/resources/options2/content_settings.js | 15 | ||||
-rw-r--r-- | chrome/browser/resources/options2/content_settings_exceptions_area.html | 4 | ||||
-rw-r--r-- | chrome/browser/resources/options2/content_settings_exceptions_area.js | 3 | ||||
-rw-r--r-- | chrome/browser/ui/webui/options2/content_settings_handler2.cc | 432 | ||||
-rw-r--r-- | chrome/browser/ui/webui/options2/content_settings_handler2.h | 56 | ||||
-rw-r--r-- | chrome/tools/chromeactions.txt | 4 |
11 files changed, 118 insertions, 817 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 5cb849c..a54505c 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -6960,18 +6960,6 @@ The following plug-in is unresponsive: <ph name="PLUGIN_NAME">$1 <message name="IDS_MOUSE_LOCK_BLOCK_RADIO" desc="A radio button in the Content Settings dialog for blocking all sites ability to disable the mouse cursor."> Do not allow any site to disable the mouse cursor </message> - <message name="IDS_PEPPER_FLASH_CAMERAMIC_TAB_LABEL" desc="Label for Pepper Flash camera and microphone tab on Content Settings dialog"> - Flash camera and microphone - </message> - <message name="IDS_PEPPER_FLASH_CAMERAMIC_HEADER" desc="Label for Pepper Flash camera and microphone exception management page on Content Settings dialog"> - Flash camera and microphone exceptions - </message> - <message name="IDS_PEPPER_FLASH_CAMERAMIC_ASK_RADIO" desc="A radio button in the Content Settings dialog for asking before allowing sites to use the camera or microphone."> - Ask me when a site wants to use the camera or microphone (recommended) - </message> - <message name="IDS_PEPPER_FLASH_CAMERAMIC_BLOCK_RADIO" desc="A radio button in the Content Settings dialog for blocking all sites from using the camera and microphone."> - Block all sites from using the camera and microphone - </message> <if expr="pp_ifdef('chromeos')"> <message name="IDS_PROTECTED_CONTENT_TAB_LABEL" desc="Label for the Protected Content tab on the Content Settings dialog."> Protected Content diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index 992f259..cdd5f55 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS @@ -16,8 +16,6 @@ include_rules = [ "+ppapi/c", # For various types. "+ppapi/proxy", "+ppapi/shared_impl/api_id.h", - # Defines some types that are marshalled over IPC. - "+ppapi/shared_impl/ppp_flash_browser_operations_shared.h", "+rlz", "+sandbox/linux", "+sandbox/src", # The path doesn't say it, but this is the Windows sandbox. diff --git a/chrome/browser/pepper_flash_settings_manager.cc b/chrome/browser/pepper_flash_settings_manager.cc index 8e246fb..ba7192d 100644 --- a/chrome/browser/pepper_flash_settings_manager.cc +++ b/chrome/browser/pepper_flash_settings_manager.cc @@ -40,17 +40,6 @@ class PepperFlashSettingsManager::Core 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 @@ class PepperFlashSettingsManager::Core 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 @@ class PepperFlashSettingsManager::Core 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 @@ void PepperFlashSettingsManager::Core::DeauthorizeContentLicenses( 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 @@ void PepperFlashSettingsManager::Core::ConnectToChannel( 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 @@ void PepperFlashSettingsManager::Core::ConnectToChannel( 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,90 +237,7 @@ void PepperFlashSettingsManager::Core::DeauthorizeContentLicensesOnIOThread( IPC::Message* msg = new PpapiMsg_DeauthorizeContentLicenses(request_id, plugin_data_path_); if (!channel_->Send(msg)) { - DLOG(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"; + LOG(ERROR) << "Couldn't send DeauthorizeContentLicenses message"; // A failure notification for the current request will be sent since // |pending_responses_| has been updated. NotifyErrorFromIOThread(); @@ -469,41 +274,6 @@ PepperFlashSettingsManager::Core::NotifyDeauthorizeContentLicensesCompleted( } } -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,20 +286,8 @@ void PepperFlashSettingsManager::Core::NotifyError( 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); + manager_->client_->OnDeauthorizeContentLicensesCompleted(iter->first, + false); break; default: NOTREACHED(); @@ -546,7 +304,7 @@ void PepperFlashSettingsManager::Core::OnDeauthorizeContentLicensesResult( 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::OnDeauthorizeContentLicensesResult( } } -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 @@ uint32 PepperFlashSettingsManager::DeauthorizeContentLicenses() { 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_++; } diff --git a/chrome/browser/pepper_flash_settings_manager.h b/chrome/browser/pepper_flash_settings_manager.h index 1048912..4a20df3 100644 --- a/chrome/browser/pepper_flash_settings_manager.h +++ b/chrome/browser/pepper_flash_settings_manager.h @@ -8,8 +8,6 @@ #include "base/basictypes.h" #include "base/memory/ref_counted.h" -#include "ppapi/c/private/ppp_flash_browser_operations.h" -#include "ppapi/shared_impl/ppp_flash_browser_operations_shared.h" class PluginPrefs; class PrefService; @@ -31,18 +29,7 @@ class PepperFlashSettingsManager { virtual ~Client() {} virtual void OnDeauthorizeContentLicensesCompleted(uint32 request_id, - bool success) {} - virtual void OnGetPermissionSettingsCompleted( - uint32 request_id, - bool success, - PP_Flash_BrowserOperations_Permission default_permission, - const ppapi::FlashSiteSettings& sites) {} - - virtual void OnSetDefaultPermissionCompleted(uint32 request_id, - bool success) {} - - virtual void OnSetSitePermissionCompleted(uint32 request_id, - bool success) {} + bool success) = 0; }; // |client| must outlive this object. It is guaranteed that |client| won't @@ -65,26 +52,6 @@ class PepperFlashSettingsManager { // Client::OnDeauthorizeContentLicensesCompleted(). uint32 DeauthorizeContentLicenses(); - // Gets permission settings. - // Client::OnGetPermissionSettingsCompleted() will be called when the - // operation is completed. - uint32 GetPermissionSettings( - PP_Flash_BrowserOperations_SettingType setting_type); - - // Sets default permission. - // Client::OnSetDefaultPermissionCompleted() will be called when the - // operation is completed. - uint32 SetDefaultPermission( - PP_Flash_BrowserOperations_SettingType setting_type, - PP_Flash_BrowserOperations_Permission permission, - bool clear_site_specific); - - // Sets site-specific permission. - // Client::OnSetSitePermissionCompleted() will be called when the operation - // is completed. - uint32 SetSitePermission(PP_Flash_BrowserOperations_SettingType setting_type, - const ppapi::FlashSiteSettings& sites); - private: // Core does most of the work. It is ref-counted so that its lifespan can be // independent of the containing object's: diff --git a/chrome/browser/resources/options2/content_settings.html b/chrome/browser/resources/options2/content_settings.html index 6060800..4f813bf 100644 --- a/chrome/browser/resources/options2/content_settings.html +++ b/chrome/browser/resources/options2/content_settings.html @@ -257,27 +257,6 @@ </label> </div> </section> - <!-- Pepper Flash camera and microphone filter --> - <section id="pepper-flash-cameramic-section" class="pepper-flash-settings"> - <h3 i18n-content="pepperFlashCameramicTabLabel"></h3> - <div> - <div class="radio"> - <label> - <input type="radio" name="pepper-flash-cameramic" value="ask"> - <span i18n-content="pepperFlashCameramicAsk"></span> - </label> - </div> - <div class="radio"> - <label> - <input type="radio" name="pepper-flash-cameramic" value="block"> - <span i18n-content="pepperFlashCameramicBlock"></span> - </label> - </div> - <button class="exceptions-list-button" - contentType="pepper-flash-cameramic" - i18n-content="manage_exceptions"></button> - </div> - </section> <if expr="pp_ifdef('chromeos')"> <!-- Protected Content filter --> <section guest-visibility="disabled"> diff --git a/chrome/browser/resources/options2/content_settings.js b/chrome/browser/resources/options2/content_settings.js index ccabdafa..af4af7a 100644 --- a/chrome/browser/resources/options2/content_settings.js +++ b/chrome/browser/resources/options2/content_settings.js @@ -86,6 +86,8 @@ cr.define('options', function() { OptionsPage.navigateToPage('cookies'); }; + // Remove from DOM instead of hiding so :last-of-type applies the style + // correctly. var intentsSection = $('intents-section'); if (!loadTimeData.getBoolean('enable_web_intents') && intentsSection) intentsSection.parentNode.removeChild(intentsSection); @@ -97,9 +99,6 @@ cr.define('options', function() { $('content-settings-overlay-confirm').onclick = OptionsPage.closeOverlay.bind(OptionsPage); - - $('pepper-flash-cameramic-section').style.display = 'none'; - $('pepper-flash-cameramic-exceptions-div').style.display = 'none'; }, /** @@ -228,16 +227,6 @@ cr.define('options', function() { exceptionsList.patternValidityCheckComplete(pattern, valid); }; - /** - * Enables the Pepper Flash camera and microphone settings. - * Please note that whether the settings are actually showed or not is also - * affected by the style class pepper-flash-settings. - */ - ContentSettings.enablePepperFlashCameraMicSettings = function() { - $('pepper-flash-cameramic-section').style.display = ''; - $('pepper-flash-cameramic-exceptions-div').style.display = ''; - } - // Export return { ContentSettings: ContentSettings diff --git a/chrome/browser/resources/options2/content_settings_exceptions_area.html b/chrome/browser/resources/options2/content_settings_exceptions_area.html index a2b2f0d..1aec06c 100644 --- a/chrome/browser/resources/options2/content_settings_exceptions_area.html +++ b/chrome/browser/resources/options2/content_settings_exceptions_area.html @@ -76,10 +76,6 @@ <list mode="otr"></list> </div> </div> - <div id="pepper-flash-cameramic-exceptions-div" - contentType="pepper-flash-cameramic" class="pepper-flash-settings"> - <list mode="normal"></list> - </div> </div> <div class="action-area"> <div class="button-strip"> diff --git a/chrome/browser/resources/options2/content_settings_exceptions_area.js b/chrome/browser/resources/options2/content_settings_exceptions_area.js index 17bc9b7..ef4fa6b 100644 --- a/chrome/browser/resources/options2/content_settings_exceptions_area.js +++ b/chrome/browser/resources/options2/content_settings_exceptions_area.js @@ -375,8 +375,7 @@ cr.define('options.contentSettings', function() { var exceptionList = this; // Whether the exceptions in this list allow an 'Ask every time' option. - this.enableAskOption = this.contentType == 'plugins' || - this.contentType == 'pepper-flash-cameramic'; + this.enableAskOption = this.contentType == 'plugins'; this.autoExpands = true; this.reset(); diff --git a/chrome/browser/ui/webui/options2/content_settings_handler2.cc b/chrome/browser/ui/webui/options2/content_settings_handler2.cc index 168da09..1e27409 100644 --- a/chrome/browser/ui/webui/options2/content_settings_handler2.cc +++ b/chrome/browser/ui/webui/options2/content_settings_handler2.cc @@ -4,6 +4,8 @@ #include "chrome/browser/ui/webui/options2/content_settings_handler2.h" +#include <map> +#include <string> #include <vector> #include "base/bind.h" @@ -39,7 +41,6 @@ #include "content/public/common/content_switches.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" -#include "net/base/net_util.h" #include "ui/base/l10n/l10n_util.h" #if defined(OS_CHROMEOS) @@ -50,10 +51,9 @@ using content::UserMetricsAction; namespace { -enum ExContentSettingsTypeEnum { - EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC = - CONTENT_SETTINGS_NUM_TYPES, - EX_CONTENT_SETTINGS_NUM_TYPES +struct ContentSettingsTypeNameEntry { + ContentSettingsType type; + const char* name; }; typedef std::map<ContentSettingsPattern, ContentSetting> OnePatternSettings; @@ -67,8 +67,33 @@ const char* kSource = "source"; const char* kAppName = "appName"; const char* kAppId = "appId"; const char* kEmbeddingOrigin = "embeddingOrigin"; -const char* kDefaultProviderID = "default"; -const char* kPreferencesSource = "preferences"; + +const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = { + {CONTENT_SETTINGS_TYPE_COOKIES, "cookies"}, + {CONTENT_SETTINGS_TYPE_IMAGES, "images"}, + {CONTENT_SETTINGS_TYPE_JAVASCRIPT, "javascript"}, + {CONTENT_SETTINGS_TYPE_PLUGINS, "plugins"}, + {CONTENT_SETTINGS_TYPE_POPUPS, "popups"}, + {CONTENT_SETTINGS_TYPE_GEOLOCATION, "location"}, + {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "notifications"}, + {CONTENT_SETTINGS_TYPE_INTENTS, "intents"}, + {CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "auto-select-certificate"}, + {CONTENT_SETTINGS_TYPE_FULLSCREEN, "fullscreen"}, + {CONTENT_SETTINGS_TYPE_MOUSELOCK, "mouselock"}, +}; +COMPILE_ASSERT(arraysize(kContentSettingsTypeGroupNames) == + CONTENT_SETTINGS_NUM_TYPES, + MISSING_CONTENT_SETTINGS_TYPE); + +ContentSettingsType ContentSettingsTypeFromGroupName(const std::string& name) { + for (size_t i = 0; i < arraysize(kContentSettingsTypeGroupNames); ++i) { + if (name == kContentSettingsTypeGroupNames[i].name) + return kContentSettingsTypeGroupNames[i].type; + } + + NOTREACHED() << name << " is not a recognized content settings type."; + return CONTENT_SETTINGS_TYPE_DEFAULT; +} std::string ContentSettingToString(ContentSetting setting) { switch (setting) { @@ -219,109 +244,10 @@ void AddExceptionsGrantedByHostedApps( } } -ContentSetting FlashPermissionToContentSetting( - PP_Flash_BrowserOperations_Permission permission) { - switch (permission) { - case PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT: - return CONTENT_SETTING_DEFAULT; - case PP_FLASH_BROWSEROPERATIONS_PERMISSION_ALLOW: - return CONTENT_SETTING_ALLOW; - case PP_FLASH_BROWSEROPERATIONS_PERMISSION_BLOCK: - return CONTENT_SETTING_BLOCK; - case PP_FLASH_BROWSEROPERATIONS_PERMISSION_ASK: - return CONTENT_SETTING_ASK; - default: - NOTREACHED(); - return CONTENT_SETTING_DEFAULT; - } -} - -PP_Flash_BrowserOperations_Permission FlashPermissionFromContentSetting( - ContentSetting setting) { - switch (setting) { - case CONTENT_SETTING_DEFAULT: - return PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT; - case CONTENT_SETTING_ALLOW: - return PP_FLASH_BROWSEROPERATIONS_PERMISSION_ALLOW; - case CONTENT_SETTING_BLOCK: - return PP_FLASH_BROWSEROPERATIONS_PERMISSION_BLOCK; - case CONTENT_SETTING_ASK: - return PP_FLASH_BROWSEROPERATIONS_PERMISSION_ASK; - default: - NOTREACHED(); - return PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT; - } -} - -std::string CanonicalizeHost(const std::string& host) { - url_canon::CanonHostInfo info; - return net::CanonicalizeHost(host, &info); -} - -bool IsValidHost(const std::string& host) { - std::string canonicalized_host = CanonicalizeHost(host); - return !canonicalized_host.empty(); -} - } // namespace namespace options2 { -class ContentSettingsHandler::ExContentSettingsType { - public: - explicit ExContentSettingsType(int value) : value_(value) { - DCHECK(value_ < EX_CONTENT_SETTINGS_NUM_TYPES); - } - explicit ExContentSettingsType(ContentSettingsType type) : value_(type) {} - explicit ExContentSettingsType(ExContentSettingsTypeEnum type) - : value_(type) {} - - bool IsExtraContentSettingsType() const { - return value_ >= CONTENT_SETTINGS_NUM_TYPES; - } - - operator int() const { return value_; } - - ContentSettingsType ToContentSettingsType() const { - DCHECK(value_ < CONTENT_SETTINGS_NUM_TYPES); - return static_cast<ContentSettingsType>(value_); - } - - private: - int value_; -}; - -ContentSettingsHandler::CachedPepperFlashSettings::CachedPepperFlashSettings() - : default_permission(PP_FLASH_BROWSEROPERATIONS_PERMISSION_BLOCK), - initialized(false) { -} - -ContentSettingsHandler::CachedPepperFlashSettings::~CachedPepperFlashSettings() { -} - -struct ContentSettingsHandler::ExContentSettingsTypeNameEntry { - ExContentSettingsType type; - const char* name; -}; - -const ContentSettingsHandler::ExContentSettingsTypeNameEntry - ContentSettingsHandler::kExContentSettingsTypeGroupNames[] = { - {ExContentSettingsType(CONTENT_SETTINGS_TYPE_COOKIES), "cookies"}, - {ExContentSettingsType(CONTENT_SETTINGS_TYPE_IMAGES), "images"}, - {ExContentSettingsType(CONTENT_SETTINGS_TYPE_JAVASCRIPT), "javascript"}, - {ExContentSettingsType(CONTENT_SETTINGS_TYPE_PLUGINS), "plugins"}, - {ExContentSettingsType(CONTENT_SETTINGS_TYPE_POPUPS), "popups"}, - {ExContentSettingsType(CONTENT_SETTINGS_TYPE_GEOLOCATION), "location"}, - {ExContentSettingsType(CONTENT_SETTINGS_TYPE_NOTIFICATIONS), "notifications"}, - {ExContentSettingsType(CONTENT_SETTINGS_TYPE_INTENTS), "intents"}, - {ExContentSettingsType(CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE), - "auto-select-certificate"}, - {ExContentSettingsType(CONTENT_SETTINGS_TYPE_FULLSCREEN), "fullscreen"}, - {ExContentSettingsType(CONTENT_SETTINGS_TYPE_MOUSELOCK), "mouselock"}, - {ExContentSettingsType(EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC), - "pepper-flash-cameramic"}, -}; - ContentSettingsHandler::ContentSettingsHandler() { } @@ -402,12 +328,6 @@ void ContentSettingsHandler::GetLocalizedValues( { "mouselock_allow", IDS_MOUSE_LOCK_ALLOW_RADIO }, { "mouselock_ask", IDS_MOUSE_LOCK_ASK_RADIO }, { "mouselock_block", IDS_MOUSE_LOCK_BLOCK_RADIO }, - // Pepper Flash camera and microphone filter. - { "pepperFlashCameramicTabLabel", IDS_PEPPER_FLASH_CAMERAMIC_TAB_LABEL }, - // The header has to be named as <content_type_name>_header. - { "pepper-flash-cameramic_header", IDS_PEPPER_FLASH_CAMERAMIC_HEADER }, - { "pepperFlashCameramicAsk", IDS_PEPPER_FLASH_CAMERAMIC_ASK_RADIO }, - { "pepperFlashCameramicBlock", IDS_PEPPER_FLASH_CAMERAMIC_BLOCK_RADIO }, #if defined(OS_CHROMEOS) // Protected Content filter { "protectedContentTabLabel", IDS_PROTECTED_CONTENT_TAB_LABEL }, @@ -440,8 +360,6 @@ void ContentSettingsHandler::GetLocalizedValues( IDS_FULLSCREEN_TAB_LABEL); RegisterTitle(localized_strings, "mouselock", IDS_MOUSE_LOCK_TAB_LABEL); - RegisterTitle(localized_strings, "pepper-flash-cameramic", - IDS_PEPPER_FLASH_CAMERAMIC_TAB_LABEL); Profile* profile = Profile::FromWebUI(web_ui()); localized_strings->SetBoolean( @@ -475,18 +393,11 @@ void ContentSettingsHandler::InitializeHandler() { PrefService* prefs = profile->GetPrefs(); pref_change_registrar_.Init(prefs); pref_change_registrar_.Add(prefs::kGeolocationContentSettings, this); - pref_change_registrar_.Add(prefs::kPepperFlashSettingsEnabled, this); - - flash_settings_manager_.reset(new PepperFlashSettingsManager(this, profile)); } void ContentSettingsHandler::InitializePage() { UpdateHandlersEnabledRadios(); UpdateAllExceptionsViewsFromModel(); - - flash_cameramic_settings_ = CachedPepperFlashSettings(); - flash_settings_manager_->GetPermissionSettings( - PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_CAMERAMIC); } void ContentSettingsHandler::Observe( @@ -520,27 +431,18 @@ void ContentSettingsHandler::Observe( content::Details<const ContentSettingsDetails>(details).ptr(); // TODO(estade): we pretend update_all() is always true. - if (settings_details->update_all_types()) { + if (settings_details->update_all_types()) UpdateAllExceptionsViewsFromModel(); - } else { - UpdateExceptionsViewFromModel( - ExContentSettingsType(settings_details->type())); - } + else + UpdateExceptionsViewFromModel(settings_details->type()); break; } case chrome::NOTIFICATION_PREF_CHANGED: { const std::string& pref_name = *content::Details<std::string>(details).ptr(); - if (pref_name == prefs::kGeolocationContentSettings) { + if (pref_name == prefs::kGeolocationContentSettings) UpdateGeolocationExceptionsView(); - } else if (pref_name == prefs::kPepperFlashSettingsEnabled) { - if (!flash_cameramic_settings_.initialized) { - flash_settings_manager_->GetPermissionSettings( - PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_CAMERAMIC); - } - } - break; } @@ -559,36 +461,15 @@ void ContentSettingsHandler::Observe( } } -void ContentSettingsHandler::OnGetPermissionSettingsCompleted( - uint32 /* request_id */, - bool success, - PP_Flash_BrowserOperations_Permission default_permission, - const ppapi::FlashSiteSettings& sites) { - if (success && !flash_cameramic_settings_.initialized) { - flash_cameramic_settings_.initialized = true; - flash_cameramic_settings_.default_permission = default_permission; - for (ppapi::FlashSiteSettings::const_iterator iter = sites.begin(); - iter != sites.end(); ++iter) { - if (IsValidHost(iter->site)) - flash_cameramic_settings_.sites[iter->site] = iter->permission; - } - UpdateExceptionsViewFromModel( - ExContentSettingsType(EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC)); - - web_ui()->CallJavascriptFunction( - "ContentSettings.enablePepperFlashCameraMicSettings"); - } -} - void ContentSettingsHandler::UpdateSettingDefaultFromModel( - const ExContentSettingsType& type) { + ContentSettingsType type) { DictionaryValue filter_settings; std::string provider_id; + filter_settings.SetString(ContentSettingsTypeToGroupName(type) + ".value", + GetSettingDefaultFromModel(type, &provider_id)); filter_settings.SetString( - ExContentSettingsTypeToGroupName(type) + ".value", - GetSettingDefaultFromModel(type, &provider_id)); - filter_settings.SetString( - ExContentSettingsTypeToGroupName(type) + ".managedBy", provider_id); + ContentSettingsTypeToGroupName(type) + ".managedBy", + provider_id); web_ui()->CallJavascriptFunction( "ContentSettings.setContentFilterSettingsValue", filter_settings); @@ -597,21 +478,17 @@ void ContentSettingsHandler::UpdateSettingDefaultFromModel( } std::string ContentSettingsHandler::GetSettingDefaultFromModel( - const ExContentSettingsType& type, std::string* provider_id) { + ContentSettingsType type, std::string* provider_id) { Profile* profile = Profile::FromWebUI(web_ui()); ContentSetting default_setting; if (type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) { default_setting = DesktopNotificationServiceFactory::GetForProfile(profile)-> GetDefaultContentSetting(provider_id); - } else if (type == EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC) { - default_setting = FlashPermissionToContentSetting( - flash_cameramic_settings_.default_permission); - *provider_id = kDefaultProviderID; } else { default_setting = profile->GetHostContentSettingsMap()-> - GetDefaultContentSetting(type.ToContentSettingsType(), provider_id); + GetDefaultContentSetting(type, provider_id); } return ContentSettingToString(default_setting); @@ -628,25 +505,25 @@ void ContentSettingsHandler::UpdateHandlersEnabledRadios() { void ContentSettingsHandler::UpdateAllExceptionsViewsFromModel() { for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; - type < EX_CONTENT_SETTINGS_NUM_TYPES; ++type) { + type < CONTENT_SETTINGS_NUM_TYPES; ++type) { // The content settings type CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE // is supposed to be set by policy only. Hence there is no user facing UI // for this content type and we skip it here. if (type == CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE) continue; - UpdateExceptionsViewFromModel(ExContentSettingsType(type)); + UpdateExceptionsViewFromModel(static_cast<ContentSettingsType>(type)); } } void ContentSettingsHandler::UpdateAllOTRExceptionsViewsFromModel() { for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; - type < EX_CONTENT_SETTINGS_NUM_TYPES; ++type) { - UpdateOTRExceptionsViewFromModel(ExContentSettingsType(type)); + type < CONTENT_SETTINGS_NUM_TYPES; ++type) { + UpdateOTRExceptionsViewFromModel(static_cast<ContentSettingsType>(type)); } } void ContentSettingsHandler::UpdateExceptionsViewFromModel( - const ExContentSettingsType& type) { + ContentSettingsType type) { // Don't update intents settings at this point. // Turn on when enable_web_intents_tag is enabled. if (type == CONTENT_SETTINGS_TYPE_INTENTS) @@ -659,28 +536,22 @@ void ContentSettingsHandler::UpdateExceptionsViewFromModel( case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: UpdateNotificationExceptionsView(); break; - case EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC: - UpdateFlashCameraMicExceptionsView(); - break; default: - UpdateExceptionsViewFromHostContentSettingsMap( - type.ToContentSettingsType()); + UpdateExceptionsViewFromHostContentSettingsMap(type); break; } } void ContentSettingsHandler::UpdateOTRExceptionsViewFromModel( - const ExContentSettingsType& type) { + ContentSettingsType type) { switch (type) { case CONTENT_SETTINGS_TYPE_GEOLOCATION: case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: case CONTENT_SETTINGS_TYPE_INTENTS: case CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE: - case EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC: break; default: - UpdateExceptionsViewFromOTRHostContentSettingsMap( - type.ToContentSettingsType()); + UpdateExceptionsViewFromOTRHostContentSettingsMap(type); break; } } @@ -704,7 +575,7 @@ void ContentSettingsHandler::UpdateGeolocationExceptionsView() { // Don't add default settings. if (i->primary_pattern == ContentSettingsPattern::Wildcard() && i->secondary_pattern == ContentSettingsPattern::Wildcard() && - i->source != kPreferencesSource) { + i->source != "preferences") { continue; } all_patterns_settings[i->primary_pattern][i->secondary_pattern] = @@ -751,8 +622,7 @@ void ContentSettingsHandler::UpdateGeolocationExceptionsView() { // This is mainly here to keep this function ideologically parallel to // UpdateExceptionsViewFromHostContentSettingsMap(). - UpdateSettingDefaultFromModel( - ExContentSettingsType(CONTENT_SETTINGS_TYPE_GEOLOCATION)); + UpdateSettingDefaultFromModel(CONTENT_SETTINGS_TYPE_GEOLOCATION); } void ContentSettingsHandler::UpdateNotificationExceptionsView() { @@ -774,7 +644,7 @@ void ContentSettingsHandler::UpdateNotificationExceptionsView() { // Don't add default settings. if (i->primary_pattern == ContentSettingsPattern::Wildcard() && i->secondary_pattern == ContentSettingsPattern::Wildcard() && - i->source != kPreferencesSource) { + i->source != "preferences") { continue; } @@ -790,31 +660,7 @@ void ContentSettingsHandler::UpdateNotificationExceptionsView() { // This is mainly here to keep this function ideologically parallel to // UpdateExceptionsViewFromHostContentSettingsMap(). - UpdateSettingDefaultFromModel( - ExContentSettingsType(CONTENT_SETTINGS_TYPE_NOTIFICATIONS)); -} - -void ContentSettingsHandler::UpdateFlashCameraMicExceptionsView() { - ListValue exceptions; - for (CachedPepperFlashSettings::SiteMap::iterator iter = - flash_cameramic_settings_.sites.begin(); - iter != flash_cameramic_settings_.sites.end(); ++iter) { - DictionaryValue* exception = new DictionaryValue(); - exception->SetString(kDisplayPattern, iter->first); - exception->SetString( - kSetting, - ContentSettingToString(FlashPermissionToContentSetting(iter->second))); - exception->SetString(kSource, kPreferencesSource); - exceptions.Append(exception); - } - - StringValue type_string(ExContentSettingsTypeToGroupName( - ExContentSettingsType(EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC))); - web_ui()->CallJavascriptFunction("ContentSettings.setExceptions", - type_string, exceptions); - - UpdateSettingDefaultFromModel( - ExContentSettingsType(EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC)); + UpdateSettingDefaultFromModel(CONTENT_SETTINGS_TYPE_NOTIFICATIONS); } void ContentSettingsHandler::UpdateExceptionsViewFromHostContentSettingsMap( @@ -860,7 +706,7 @@ void ContentSettingsHandler::UpdateExceptionsViewFromHostContentSettingsMap( // The default may also have changed (we won't get a separate notification). // If it hasn't changed, this call will be harmless. - UpdateSettingDefaultFromModel(ExContentSettingsType(type)); + UpdateSettingDefaultFromModel(type); } void ContentSettingsHandler::UpdateExceptionsViewFromOTRHostContentSettingsMap( @@ -956,8 +802,7 @@ void ContentSettingsHandler::SetContentFilter(const ListValue* args) { } ContentSetting default_setting = ContentSettingFromString(setting); - ExContentSettingsType content_type = - ExContentSettingsTypeFromGroupName(group); + ContentSettingsType content_type = ContentSettingsTypeFromGroupName(group); Profile* profile = Profile::FromWebUI(web_ui()); #if defined(OS_CHROMEOS) @@ -970,17 +815,10 @@ void ContentSettingsHandler::SetContentFilter(const ListValue* args) { if (content_type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) { DesktopNotificationServiceFactory::GetForProfile(profile)-> SetDefaultContentSetting(default_setting); - } else if (content_type == EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC) { - flash_cameramic_settings_.default_permission = - FlashPermissionFromContentSetting(default_setting); - flash_settings_manager_->SetDefaultPermission( - PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_CAMERAMIC, - flash_cameramic_settings_.default_permission, false); } else { HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); - ContentSettingsType converted_type = content_type.ToContentSettingsType(); - ApplyWhitelist(converted_type, default_setting); - map->SetDefaultContentSetting(converted_type, default_setting); + ApplyWhitelist(content_type, default_setting); + map->SetDefaultContentSetting(content_type, default_setting); } switch (content_type) { case CONTENT_SETTINGS_TYPE_COOKIES: @@ -1019,10 +857,6 @@ void ContentSettingsHandler::SetContentFilter(const ListValue* args) { content::RecordAction( UserMetricsAction("Options_DefaultMouseLockSettingChanged")); break; - case EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC: - content::RecordAction( - UserMetricsAction("Options_DefaultFlashCameraMicSettingChanged")); - break; default: break; } @@ -1034,8 +868,7 @@ void ContentSettingsHandler::RemoveException(const ListValue* args) { CHECK(args->GetString(arg_i++, &type_string)); Profile* profile = Profile::FromWebUI(web_ui()); - ExContentSettingsType type = ExContentSettingsTypeFromGroupName( - type_string); + ContentSettingsType type = ContentSettingsTypeFromGroupName(type_string); if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION) { std::string origin; std::string embedding_origin; @@ -1072,37 +905,18 @@ void ContentSettingsHandler::RemoveException(const ListValue* args) { rv = args->GetString(arg_i++, &pattern); DCHECK(rv); - if (type == EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC) { - DCHECK_EQ(mode, "normal"); - - CachedPepperFlashSettings::SiteMap::iterator iter = - flash_cameramic_settings_.sites.find(pattern); - if (iter != flash_cameramic_settings_.sites.end()) { - flash_cameramic_settings_.sites.erase(iter); - ppapi::FlashSiteSettings site_settings(1, - ppapi::FlashSiteSetting( - pattern, PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT)); - flash_settings_manager_->SetSitePermission( - PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_CAMERAMIC, - site_settings); - } else { - NOTREACHED(); - } - UpdateFlashCameraMicExceptionsView(); - } else { - HostContentSettingsMap* settings_map = - mode == "normal" ? GetContentSettingsMap() : - GetOTRContentSettingsMap(); - // The settings map could be null if the mode was OTR but the OTR profile - // got destroyed before we received this message. - if (settings_map) { - settings_map->SetContentSetting( - ContentSettingsPattern::FromString(pattern), - ContentSettingsPattern::Wildcard(), - type.ToContentSettingsType(), - "", - CONTENT_SETTING_DEFAULT); - } + HostContentSettingsMap* settings_map = + mode == "normal" ? GetContentSettingsMap() : + GetOTRContentSettingsMap(); + // The settings map could be null if the mode was OTR but the OTR profile + // got destroyed before we received this message. + if (settings_map) { + settings_map->SetContentSetting( + ContentSettingsPattern::FromString(pattern), + ContentSettingsPattern::Wildcard(), + ContentSettingsTypeFromGroupName(type_string), + "", + CONTENT_SETTING_DEFAULT); } } } @@ -1118,71 +932,48 @@ void ContentSettingsHandler::SetException(const ListValue* args) { std::string setting; CHECK(args->GetString(arg_i++, &setting)); - ExContentSettingsType type = ExContentSettingsTypeFromGroupName(type_string); + ContentSettingsType type = ContentSettingsTypeFromGroupName(type_string); if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION || type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) { NOTREACHED(); - } else if (type == EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC) { - DCHECK(IsValidHost(pattern)); + return; + } - if (flash_cameramic_settings_.sites.find(pattern) == - flash_cameramic_settings_.sites.end()) { - pattern = CanonicalizeHost(pattern); - } - PP_Flash_BrowserOperations_Permission permission = - FlashPermissionFromContentSetting(ContentSettingFromString(setting)); - flash_cameramic_settings_.sites[pattern] = permission; - ppapi::FlashSiteSettings - site_settings(1, ppapi::FlashSiteSetting(pattern, permission)); - flash_settings_manager_->SetSitePermission( - PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_CAMERAMIC, - site_settings); - UpdateFlashCameraMicExceptionsView(); - } else { - HostContentSettingsMap* settings_map = - mode == "normal" ? GetContentSettingsMap() : - GetOTRContentSettingsMap(); + HostContentSettingsMap* settings_map = + mode == "normal" ? GetContentSettingsMap() : + GetOTRContentSettingsMap(); - // The settings map could be null if the mode was OTR but the OTR profile - // got destroyed before we received this message. - if (!settings_map) - return; - settings_map->SetContentSetting(ContentSettingsPattern::FromString(pattern), - ContentSettingsPattern::Wildcard(), - type.ToContentSettingsType(), - "", - ContentSettingFromString(setting)); - } + // The settings map could be null if the mode was OTR but the OTR profile + // got destroyed before we received this message. + if (!settings_map) + return; + settings_map->SetContentSetting(ContentSettingsPattern::FromString(pattern), + ContentSettingsPattern::Wildcard(), + type, + "", + ContentSettingFromString(setting)); } void ContentSettingsHandler::CheckExceptionPatternValidity( const ListValue* args) { size_t arg_i = 0; - std::string type_string; - CHECK(args->GetString(arg_i++, &type_string)); + Value* type; + CHECK(args->Get(arg_i++, &type)); std::string mode_string; CHECK(args->GetString(arg_i++, &mode_string)); std::string pattern_string; CHECK(args->GetString(arg_i++, &pattern_string)); - ExContentSettingsType type = ExContentSettingsTypeFromGroupName(type_string); - bool is_valid = false; - if (type == EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC) { - is_valid = IsValidHost(pattern_string); - } else { - ContentSettingsPattern pattern = - ContentSettingsPattern::FromString(pattern_string); - is_valid = pattern.IsValid(); - } + ContentSettingsPattern pattern = + ContentSettingsPattern::FromString(pattern_string); - scoped_ptr<Value> type_value(Value::CreateStringValue(type_string)); scoped_ptr<Value> mode_value(Value::CreateStringValue(mode_string)); scoped_ptr<Value> pattern_value(Value::CreateStringValue(pattern_string)); - scoped_ptr<Value> valid_value(Value::CreateBooleanValue(is_valid)); + scoped_ptr<Value> valid_value(Value::CreateBooleanValue(pattern.IsValid())); web_ui()->CallJavascriptFunction( "ContentSettings.patternValidityCheckComplete", - *type_value.get(), + *type, *mode_value.get(), *pattern_value.get(), *valid_value.get()); @@ -1191,7 +982,13 @@ void ContentSettingsHandler::CheckExceptionPatternValidity( // static std::string ContentSettingsHandler::ContentSettingsTypeToGroupName( ContentSettingsType type) { - return ExContentSettingsTypeToGroupName(ExContentSettingsType(type)); + for (size_t i = 0; i < arraysize(kContentSettingsTypeGroupNames); ++i) { + if (type == kContentSettingsTypeGroupNames[i].type) + return kContentSettingsTypeGroupNames[i].name; + } + + NOTREACHED(); + return std::string(); } HostContentSettingsMap* ContentSettingsHandler::GetContentSettingsMap() { @@ -1210,33 +1007,4 @@ HostContentSettingsMap* return NULL; } -// static -ContentSettingsHandler::ExContentSettingsType - ContentSettingsHandler::ExContentSettingsTypeFromGroupName( - const std::string& name) { - COMPILE_ASSERT(arraysize(kExContentSettingsTypeGroupNames) == - EX_CONTENT_SETTINGS_NUM_TYPES, - MISSING_CONTENT_SETTINGS_TYPE); - - for (size_t i = 0; i < arraysize(kExContentSettingsTypeGroupNames); ++i) { - if (name == kExContentSettingsTypeGroupNames[i].name) - return kExContentSettingsTypeGroupNames[i].type; - } - - NOTREACHED() << name << " is not a recognized content settings type."; - return ExContentSettingsType(CONTENT_SETTINGS_TYPE_DEFAULT); -} - -// static -std::string ContentSettingsHandler::ExContentSettingsTypeToGroupName( - const ExContentSettingsType& type) { - for (size_t i = 0; i < arraysize(kExContentSettingsTypeGroupNames); ++i) { - if (type == kExContentSettingsTypeGroupNames[i].type) - return kExContentSettingsTypeGroupNames[i].name; - } - - NOTREACHED(); - return std::string(); -} - } // namespace options2 diff --git a/chrome/browser/ui/webui/options2/content_settings_handler2.h b/chrome/browser/ui/webui/options2/content_settings_handler2.h index 8c4ae5f..2ec6909 100644 --- a/chrome/browser/ui/webui/options2/content_settings_handler2.h +++ b/chrome/browser/ui/webui/options2/content_settings_handler2.h @@ -6,11 +6,7 @@ #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_CONTENT_SETTINGS_HANDLER2_H_ #pragma once -#include <map> -#include <string> - -#include "base/memory/scoped_ptr.h" -#include "chrome/browser/pepper_flash_settings_manager.h" +#include "chrome/browser/plugin_data_remover_helper.h" #include "chrome/browser/prefs/pref_change_registrar.h" #include "chrome/browser/ui/webui/options2/options_ui2.h" #include "chrome/common/content_settings_types.h" @@ -23,8 +19,7 @@ class ProtocolHandlerRegistry; namespace options2 { -class ContentSettingsHandler : public OptionsPageUIHandler, - public PepperFlashSettingsManager::Client { +class ContentSettingsHandler : public OptionsPageUIHandler { public: ContentSettingsHandler(); virtual ~ContentSettingsHandler(); @@ -40,46 +35,20 @@ class ContentSettingsHandler : public OptionsPageUIHandler, const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE; - // PepperFlashSettingsManager::Client implementation. - virtual void OnGetPermissionSettingsCompleted( - uint32 request_id, - bool success, - PP_Flash_BrowserOperations_Permission default_permission, - const ppapi::FlashSiteSettings& sites) OVERRIDE; - // Gets a string identifier for the group name, for use in HTML. static std::string ContentSettingsTypeToGroupName(ContentSettingsType type); private: - // Extends ContentSettingsType with some other types that will be also - // displayed in the content settings UI. - class ExContentSettingsType; - struct ExContentSettingsTypeNameEntry; - - struct CachedPepperFlashSettings { - CachedPepperFlashSettings(); - ~CachedPepperFlashSettings(); - - PP_Flash_BrowserOperations_Permission default_permission; - - typedef std::map<std::string, PP_Flash_BrowserOperations_Permission> - SiteMap; - SiteMap sites; - - bool initialized; - }; - // Functions that call into the page ----------------------------------------- // Updates the page with the default settings (allow, ask, block, etc.) - void UpdateSettingDefaultFromModel(const ExContentSettingsType& type); + void UpdateSettingDefaultFromModel(ContentSettingsType type); // Clobbers and rebuilds the specific content setting type exceptions table. - void UpdateExceptionsViewFromModel(const ExContentSettingsType& type); + void UpdateExceptionsViewFromModel(ContentSettingsType type); // Clobbers and rebuilds the specific content setting type exceptions // OTR table. - void UpdateOTRExceptionsViewFromModel( - const ExContentSettingsType& type); + void UpdateOTRExceptionsViewFromModel(ContentSettingsType type); // Clobbers and rebuilds all the exceptions tables in the page (both normal // and OTR tables). void UpdateAllExceptionsViewsFromModel(); @@ -89,9 +58,6 @@ class ContentSettingsHandler : public OptionsPageUIHandler, void UpdateGeolocationExceptionsView(); // Clobbers and rebuilds just the desktop notification exception table. void UpdateNotificationExceptionsView(); - // Clobbers and rebuilds just the Pepper Flash camera and microphone exception - // table. - void UpdateFlashCameraMicExceptionsView(); // Clobbers and rebuilds an exception table that's managed by the host content // settings map. void UpdateExceptionsViewFromHostContentSettingsMap(ContentSettingsType type); @@ -136,26 +102,16 @@ class ContentSettingsHandler : public OptionsPageUIHandler, // Gets the default setting in string form. If |provider_id| is not NULL, the // id of the provider which provided the default setting is assigned to it. - std::string GetSettingDefaultFromModel(const ExContentSettingsType& type, + std::string GetSettingDefaultFromModel(ContentSettingsType type, std::string* provider_id); // Gets the ProtocolHandlerRegistry for the normal profile. ProtocolHandlerRegistry* GetProtocolHandlerRegistry(); - static ExContentSettingsType ExContentSettingsTypeFromGroupName( - const std::string& name); - static std::string ExContentSettingsTypeToGroupName( - const ExContentSettingsType& type); - // Member variables --------------------------------------------------------- content::NotificationRegistrar notification_registrar_; PrefChangeRegistrar pref_change_registrar_; - scoped_ptr<PepperFlashSettingsManager> flash_settings_manager_; - CachedPepperFlashSettings flash_cameramic_settings_; - - static const ExContentSettingsTypeNameEntry - kExContentSettingsTypeGroupNames[]; DISALLOW_COPY_AND_ASSIGN(ContentSettingsHandler); }; diff --git a/chrome/tools/chromeactions.txt b/chrome/tools/chromeactions.txt index 2908df8..f50b740 100644 --- a/chrome/tools/chromeactions.txt +++ b/chrome/tools/chromeactions.txt @@ -118,7 +118,6 @@ 0x3c463d9eb1c92f64 BadMessageTerminate_DSMF_1 0x8b956c45b0f38be9 BadMessageTerminate_DSMF_2 0x6ebaa5e3651107fa BadMessageTerminate_EFD -0xff06108fb2aa73fa BadMessageTerminate_FAMF 0xbecb3852be04c506 BadMessageTerminate_IDBMF 0xd7e4d61883121c76 BadMessageTerminate_NC 0x448f44d226b839b7 BadMessageTerminate_NC17 @@ -935,7 +934,6 @@ 0xe2fd858f8395432f Options_CustomFrame_Disable 0x531823c36ca21da2 Options_CustomFrame_Enable 0x33e7b018e003c5b1 Options_DefaultCookieSettingChanged -0xd5a152f698cfa270 Options_DefaultFlashCameraMicSettingChanged 0x3864ed1197ddceb8 Options_DefaultGeolocationSettingChanged 0x3f92cd6678d2f595 Options_DefaultHandlersSettingChanged 0x5dfe307474e6b526 Options_DefaultImagesSettingChanged @@ -979,8 +977,6 @@ 0x4aa2c70a745dbb49 Options_MetricsReportingCheckbox_Enable 0x224b0bf60dccdeda Options_MousePrimaryRight_Disable 0xb23cd3cde814d929 Options_MousePrimaryRight_Enable -0x820f29cc9c44d0d5 Options_PasswordGenerationCheckbox_Disable -0x4df19d1fb4741c2a Options_PasswordGenerationCheckbox_Enable 0xc5fbe9d9b3a165dd Options_PasswordManager_Disable 0x59b4f208d9d9f648 Options_PasswordManager_Enable 0x6149925370ef4f47 Options_PluginsCheckbox_Disable |