| Index: chrome/browser/ui/content_settings/content_setting_bubble_model.cc
|
| diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc
|
| index ff8299c0ce25dee8cacd03b68206d07025a37680..0a3395aa26d862cf400fa6ea0af780af908e39ff 100644
|
| --- a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc
|
| +++ b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc
|
| @@ -193,26 +193,6 @@ void ContentSettingSimpleBubbleModel::OnManageLinkClicked() {
|
| }
|
|
|
| void ContentSettingSimpleBubbleModel::SetCustomLink() {
|
| - if (content_type() == CONTENT_SETTINGS_TYPE_PLUGINS) {
|
| - HostContentSettingsMap* map =
|
| - HostContentSettingsMapFactory::GetForProfile(profile());
|
| - GURL url = web_contents()->GetURL();
|
| - std::unique_ptr<base::Value> value = map->GetWebsiteSetting(
|
| - url, url, content_type(), std::string(), nullptr);
|
| - ContentSetting setting =
|
| - content_settings::ValueToContentSetting(value.get());
|
| -
|
| - // When Flash has been hidden from the plugin list, it is impossible to
|
| - // dynamically load all the plugins on the page.
|
| - if (setting == CONTENT_SETTING_BLOCK &&
|
| - PluginUtils::ShouldPreferHtmlOverPlugins(map)) {
|
| - return;
|
| - }
|
| -
|
| - set_custom_link(l10n_util::GetStringUTF8(IDS_BLOCKED_PLUGINS_LOAD_ALL));
|
| - return;
|
| - }
|
| -
|
| static const ContentSettingsTypeIdEntry kCustomIDs[] = {
|
| {CONTENT_SETTINGS_TYPE_COOKIES, IDS_BLOCKED_COOKIES_INFO},
|
| {CONTENT_SETTINGS_TYPE_MIXEDSCRIPT, IDS_ALLOW_INSECURE_CONTENT_BUTTON},
|
| @@ -356,7 +336,6 @@ void ContentSettingSingleRadioGroup::SetRadioGroup() {
|
| radio_group.radio_items.push_back(radio_block_label);
|
| ContentSetting setting;
|
| SettingSource setting_source = SETTING_SOURCE_NONE;
|
| - bool setting_is_wildcard = false;
|
|
|
| if (content_type() == CONTENT_SETTINGS_TYPE_COOKIES) {
|
| content_settings::CookieSettings* cookie_settings =
|
| @@ -371,19 +350,9 @@ void ContentSettingSingleRadioGroup::SetRadioGroup() {
|
| map->GetWebsiteSetting(url, url, content_type(), std::string(), &info);
|
| setting = content_settings::ValueToContentSetting(value.get());
|
| setting_source = info.source;
|
| - setting_is_wildcard =
|
| - info.primary_pattern == ContentSettingsPattern::Wildcard() &&
|
| - info.secondary_pattern == ContentSettingsPattern::Wildcard();
|
| }
|
|
|
| - if (content_type() == CONTENT_SETTINGS_TYPE_PLUGINS &&
|
| - setting == CONTENT_SETTING_ALLOW &&
|
| - setting_is_wildcard) {
|
| - // In the corner case of unrecognized plugins (which are now blocked by
|
| - // default) we indicate the blocked state in the UI and allow the user to
|
| - // whitelist.
|
| - radio_group.default_item = 1;
|
| - } else if (setting == CONTENT_SETTING_ALLOW) {
|
| + if (setting == CONTENT_SETTING_ALLOW) {
|
| radio_group.default_item = kAllowButtonIndex;
|
| // |block_setting_| is already set to |CONTENT_SETTING_BLOCK|.
|
| } else {
|
| @@ -391,24 +360,11 @@ void ContentSettingSingleRadioGroup::SetRadioGroup() {
|
| block_setting_ = setting;
|
| }
|
|
|
| - set_setting_is_managed(setting_source != SETTING_SOURCE_USER &&
|
| - setting != CONTENT_SETTING_ASK);
|
| -
|
| - // When Flash has been hidden from the plugin list, it is impossible to
|
| - // dynamically load all the plugins on the page. Then the radio group would
|
| - // appear to do nothing. The user must go to Content Settings to enable Flash.
|
| - bool flash_hidden_from_plugin_list =
|
| - content_type() == CONTENT_SETTINGS_TYPE_PLUGINS &&
|
| - setting == CONTENT_SETTING_BLOCK &&
|
| - PluginUtils::ShouldPreferHtmlOverPlugins(
|
| - HostContentSettingsMapFactory::GetForProfile(profile()));
|
| -
|
| const auto* map = HostContentSettingsMapFactory::GetForProfile(profile());
|
| // Prevent creation of content settings for illegal urls like about:blank
|
| bool is_valid = map->CanSetNarrowestContentSetting(url, url, content_type());
|
|
|
| - set_radio_group_enabled(is_valid && setting_source == SETTING_SOURCE_USER &&
|
| - !flash_hidden_from_plugin_list);
|
| + set_radio_group_enabled(is_valid && setting_source == SETTING_SOURCE_USER);
|
|
|
| selected_item_ = radio_group.default_item;
|
| set_radio_group(radio_group);
|
| @@ -477,14 +433,12 @@ void ContentSettingCookiesBubbleModel::OnCustomLinkClicked() {
|
|
|
| // ContentSettingPluginBubbleModel ---------------------------------------------
|
|
|
| -class ContentSettingPluginBubbleModel : public ContentSettingSingleRadioGroup {
|
| +class ContentSettingPluginBubbleModel : public ContentSettingSimpleBubbleModel {
|
| public:
|
| ContentSettingPluginBubbleModel(Delegate* delegate,
|
| WebContents* web_contents,
|
| Profile* profile);
|
|
|
| - ~ContentSettingPluginBubbleModel() override;
|
| -
|
| private:
|
| void OnLearnMoreLinkClicked() override;
|
| void OnCustomLinkClicked() override;
|
| @@ -498,17 +452,40 @@ ContentSettingPluginBubbleModel::ContentSettingPluginBubbleModel(
|
| Delegate* delegate,
|
| WebContents* web_contents,
|
| Profile* profile)
|
| - : ContentSettingSingleRadioGroup(delegate,
|
| - web_contents,
|
| - profile,
|
| - CONTENT_SETTINGS_TYPE_PLUGINS) {
|
| - // 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(
|
| - web_contents)->load_plugins_link_enabled());
|
| + : ContentSettingSimpleBubbleModel(delegate,
|
| + web_contents,
|
| + profile,
|
| + CONTENT_SETTINGS_TYPE_PLUGINS) {
|
| + SettingInfo info;
|
| + HostContentSettingsMap* map =
|
| + HostContentSettingsMapFactory::GetForProfile(profile);
|
| + GURL url = web_contents->GetURL();
|
| + std::unique_ptr<base::Value> value =
|
| + map->GetWebsiteSetting(url, url, content_type(), std::string(), &info);
|
| + ContentSetting setting = content_settings::ValueToContentSetting(value.get());
|
| +
|
| + // If the setting is not managed by the user, hide the "Manage..." link.
|
| + if (info.source != SETTING_SOURCE_USER)
|
| + set_manage_text(std::string());
|
| +
|
| + // The user cannot manually run Flash on the BLOCK setting when either holds:
|
| + // - The setting is from Policy. User cannot override admin intent.
|
| + // - HTML By Default is on - Flash has been hidden from the plugin list, so
|
| + // it's impossible to dynamically run the nonexistent plugin.
|
| + bool run_blocked = setting == CONTENT_SETTING_BLOCK &&
|
| + (info.source != SETTING_SOURCE_USER ||
|
| + PluginUtils::ShouldPreferHtmlOverPlugins(map));
|
| +
|
| + if (!run_blocked) {
|
| + set_custom_link(l10n_util::GetStringUTF8(IDS_BLOCKED_PLUGINS_LOAD_ALL));
|
| + // Disable the "Run all plugins this time" link if the user already clicked
|
| + // on the link and ran all plugins.
|
| + set_custom_link_enabled(
|
| + web_contents &&
|
| + TabSpecificContentSettings::FromWebContents(web_contents)
|
| + ->load_plugins_link_enabled());
|
| + }
|
| +
|
| // Build blocked plugin list.
|
| if (web_contents) {
|
| TabSpecificContentSettings* content_settings =
|
| @@ -531,20 +508,6 @@ ContentSettingPluginBubbleModel::ContentSettingPluginBubbleModel(
|
| content_settings::PLUGINS_ACTION_DISPLAYED_BUBBLE);
|
| }
|
|
|
| -ContentSettingPluginBubbleModel::~ContentSettingPluginBubbleModel() {
|
| - // If the user elected to allow all plugins then run plugins at this time.
|
| - if (settings_changed() && selected_item() == kAllowButtonIndex) {
|
| - content_settings::RecordPluginsAction(
|
| - content_settings::
|
| - PLUGINS_ACTION_CLICKED_ALWAYS_ALLOW_PLUGINS_ON_ORIGIN);
|
| - rappor::SampleDomainAndRegistryFromGURL(
|
| - rappor_service(), "ContentSettings.Plugins.AddedAllowException",
|
| - web_contents()->GetLastCommittedURL());
|
| -
|
| - RunPluginsOnPage();
|
| - }
|
| -}
|
| -
|
| void ContentSettingPluginBubbleModel::OnLearnMoreLinkClicked() {
|
| if (delegate())
|
| delegate()->ShowLearnMorePage(CONTENT_SETTINGS_TYPE_PLUGINS);
|
| @@ -1415,7 +1378,6 @@ ContentSettingBubbleModel::ContentSettingBubbleModel(Delegate* delegate,
|
| : web_contents_(web_contents),
|
| profile_(profile),
|
| delegate_(delegate),
|
| - setting_is_managed_(false),
|
| rappor_service_(g_browser_process->rappor_service()) {
|
| registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
|
| content::Source<WebContents>(web_contents));
|
|
|