diff options
author | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-03 08:22:21 +0000 |
---|---|---|
committer | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-03 08:22:21 +0000 |
commit | 97c5c596e4b649651fbef56875e125c06acb0f90 (patch) | |
tree | 3acba85143369eacd72006d383e5e198a59f9c7a /chrome/browser/content_setting_bubble_model.cc | |
parent | 7a13e7926699ad5d03f2d6e121b7bdb68ca05680 (diff) | |
download | chromium_src-97c5c596e4b649651fbef56875e125c06acb0f90.zip chromium_src-97c5c596e4b649651fbef56875e125c06acb0f90.tar.gz chromium_src-97c5c596e4b649651fbef56875e125c06acb0f90.tar.bz2 |
Add "Load all plugins on this page" button to blocked plugins bubble if click-to-play is enabled.
Screenshot: http://imgur.com/ZKsQB.png
XIB changes: Add a rounded rect button hooked up to |loadAllPlugins:| in the File's Owner and referenced by its |loadAllPluginsButton_| outlet, wrapped in a GTMWidthBasedTweaker.
BUG=49677
TEST=ContentSettingBubbleModelTest.*
Review URL: http://codereview.chromium.org/3015036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54720 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/content_setting_bubble_model.cc')
-rw-r--r-- | chrome/browser/content_setting_bubble_model.cc | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/chrome/browser/content_setting_bubble_model.cc b/chrome/browser/content_setting_bubble_model.cc index 88bb04d..2b8e190 100644 --- a/chrome/browser/content_setting_bubble_model.cc +++ b/chrome/browser/content_setting_bubble_model.cc @@ -11,6 +11,7 @@ #include "chrome/browser/host_content_settings_map.h" #include "chrome/browser/pref_service.h" #include "chrome/browser/profile.h" +#include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_delegate.h" #include "chrome/common/chrome_switches.h" @@ -177,6 +178,37 @@ class ContentSettingSingleRadioGroup : public ContentSettingTitleAndLinkModel { } }; +class ContentSettingPluginBubbleModel : public ContentSettingSingleRadioGroup { + public: + ContentSettingPluginBubbleModel(TabContents* tab_contents, Profile* profile, + ContentSettingsType content_type) + : ContentSettingSingleRadioGroup(tab_contents, profile, content_type) { + DCHECK_EQ(content_type, CONTENT_SETTINGS_TYPE_PLUGINS); + SetLoadPluginsLinkTitle(); + } + + private: + void SetLoadPluginsLinkTitle() { + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableClickToPlay)) { + set_load_plugins_link_title( + l10n_util::GetStringUTF8(IDS_BLOCKED_PLUGINS_LOAD_ALL)); + } + } + + virtual void OnLoadPluginsLinkClicked() { + DCHECK(CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableClickToPlay)); + if (tab_contents()) { + tab_contents()->render_view_host()->LoadBlockedPlugins(); + } + set_load_plugins_link_enabled(false); + TabSpecificContentSettings* settings = + tab_contents()->GetTabSpecificContentSettings(); + settings->set_load_plugins_link_enabled(false); + } +}; + class ContentSettingPopupBubbleModel : public ContentSettingSingleRadioGroup { public: ContentSettingPopupBubbleModel(TabContents* tab_contents, Profile* profile, @@ -304,6 +336,10 @@ ContentSettingBubbleModel* return new ContentSettingDomainListBubbleModel(tab_contents, profile, content_type); } + if (content_type == CONTENT_SETTINGS_TYPE_PLUGINS) { + return new ContentSettingPluginBubbleModel(tab_contents, profile, + content_type); + } return new ContentSettingSingleRadioGroup(tab_contents, profile, content_type); } @@ -313,6 +349,13 @@ ContentSettingBubbleModel::ContentSettingBubbleModel( ContentSettingsType content_type) : tab_contents_(tab_contents), profile_(profile), content_type_(content_type) { + if (tab_contents) { + TabSpecificContentSettings* settings = + tab_contents->GetTabSpecificContentSettings(); + set_load_plugins_link_enabled(settings->load_plugins_link_enabled()); + } else { + set_load_plugins_link_enabled(true); + } registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED, Source<TabContents>(tab_contents)); } |