If the plugins setting is managed and can't be controlled by the user, then...

If the plugins setting is managed and can't be controlled by the user, then disable the run all plugins link on the plugins settings bubble.

BUG=321772

Review URL: https://codereview.chromium.org/126143002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243639 0039d316-1c4b-4281-b951-d872f2087c98
parent 03612626
...@@ -361,6 +361,8 @@ void ContentSettingSingleRadioGroup::SetRadioGroup() { ...@@ -361,6 +361,8 @@ void ContentSettingSingleRadioGroup::SetRadioGroup() {
radio_group.default_item = 1; radio_group.default_item = 1;
block_setting_ = setting; block_setting_ = setting;
} }
set_setting_is_managed(setting_source != SETTING_SOURCE_USER);
if (setting_source != SETTING_SOURCE_USER) { if (setting_source != SETTING_SOURCE_USER) {
set_radio_group_enabled(false); set_radio_group_enabled(false);
} else { } else {
...@@ -449,7 +451,11 @@ ContentSettingPluginBubbleModel::ContentSettingPluginBubbleModel( ...@@ -449,7 +451,11 @@ ContentSettingPluginBubbleModel::ContentSettingPluginBubbleModel(
: ContentSettingSingleRadioGroup( : ContentSettingSingleRadioGroup(
delegate, web_contents, profile, content_type) { delegate, web_contents, profile, content_type) {
DCHECK_EQ(content_type, CONTENT_SETTINGS_TYPE_PLUGINS); DCHECK_EQ(content_type, CONTENT_SETTINGS_TYPE_PLUGINS);
set_custom_link_enabled(web_contents && // Disable the "Run all plugins this time" link if the setting is managed and
// can't be controlled by the user or if the user already clicked on the link
// and ran all plugins.
set_custom_link_enabled(!setting_is_managed() &&
web_contents &&
TabSpecificContentSettings::FromWebContents( TabSpecificContentSettings::FromWebContents(
web_contents)->load_plugins_link_enabled()); web_contents)->load_plugins_link_enabled());
} }
...@@ -1263,7 +1269,8 @@ ContentSettingBubbleModel::ContentSettingBubbleModel( ...@@ -1263,7 +1269,8 @@ ContentSettingBubbleModel::ContentSettingBubbleModel(
ContentSettingsType content_type) ContentSettingsType content_type)
: web_contents_(web_contents), : web_contents_(web_contents),
profile_(profile), profile_(profile),
content_type_(content_type) { content_type_(content_type),
setting_is_managed_(false) {
registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
content::Source<WebContents>(web_contents)); content::Source<WebContents>(web_contents));
registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED,
......
...@@ -157,6 +157,12 @@ class ContentSettingBubbleModel : public content::NotificationObserver { ...@@ -157,6 +157,12 @@ class ContentSettingBubbleModel : public content::NotificationObserver {
void set_selected_device(const content::MediaStreamDevice& device) { void set_selected_device(const content::MediaStreamDevice& device) {
bubble_content_.media_menus[device.type].selected_device = device; bubble_content_.media_menus[device.type].selected_device = device;
} }
bool setting_is_managed() {
return setting_is_managed_;
}
void set_setting_is_managed(bool managed) {
setting_is_managed_ = managed;
}
private: private:
content::WebContents* web_contents_; content::WebContents* web_contents_;
...@@ -165,6 +171,9 @@ class ContentSettingBubbleModel : public content::NotificationObserver { ...@@ -165,6 +171,9 @@ class ContentSettingBubbleModel : public content::NotificationObserver {
BubbleContent bubble_content_; BubbleContent bubble_content_;
// A registrar for listening for WEB_CONTENTS_DESTROYED notifications. // A registrar for listening for WEB_CONTENTS_DESTROYED notifications.
content::NotificationRegistrar registrar_; content::NotificationRegistrar registrar_;
// A flag that indicates if the content setting managed i.e. can't be
// controlled by the user.
bool setting_is_managed_;
DISALLOW_COPY_AND_ASSIGN(ContentSettingBubbleModel); DISALLOW_COPY_AND_ASSIGN(ContentSettingBubbleModel);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment