Commit c65a8d31 authored by Charlie Harrison's avatar Charlie Harrison Committed by Commit Bot

Remove ContentSettingSubresourceFilterImageModel

All the functionality is in ContentSettingBlockedImageModel. This
CL should have no behavior changes.

Bug: None
Change-Id: I7694d5968cbb514c0959d821bf0888a770477a0c
Reviewed-on: https://chromium-review.googlesource.com/c/1287314
Commit-Queue: Charlie Harrison <csharrison@chromium.org>
Reviewed-by: default avatarMartin Šrámek <msramek@chromium.org>
Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600764}
parent 964eeb18
...@@ -1407,9 +1407,6 @@ ContentSettingSubresourceFilterBubbleModel:: ...@@ -1407,9 +1407,6 @@ ContentSettingSubresourceFilterBubbleModel::
SetMessage(); SetMessage();
SetManageText(); SetManageText();
set_done_button_text(l10n_util::GetStringUTF16(IDS_OK)); set_done_button_text(l10n_util::GetStringUTF16(IDS_OK));
// TODO(csharrison): The learn more link UI layout is non ideal. Make it align
// with the future Harmony UI version with a link icon in the bottom left of
// the bubble.
set_show_learn_more(true); set_show_learn_more(true);
ChromeSubresourceFilterClient::LogAction( ChromeSubresourceFilterClient::LogAction(
SubresourceFilterAction::kDetailsShown); SubresourceFilterAction::kDetailsShown);
...@@ -1687,6 +1684,14 @@ ContentSettingBubbleModel* ...@@ -1687,6 +1684,14 @@ ContentSettingBubbleModel*
return new ContentSettingMidiSysExBubbleModel(delegate, web_contents, return new ContentSettingMidiSysExBubbleModel(delegate, web_contents,
profile); profile);
} }
if (content_type == CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS) {
return new ContentSettingDownloadsBubbleModel(delegate, web_contents,
profile);
}
if (content_type == CONTENT_SETTINGS_TYPE_ADS) {
return new ContentSettingSubresourceFilterBubbleModel(
delegate, web_contents, profile);
}
if (content_type == CONTENT_SETTINGS_TYPE_IMAGES || if (content_type == CONTENT_SETTINGS_TYPE_IMAGES ||
content_type == CONTENT_SETTINGS_TYPE_JAVASCRIPT || content_type == CONTENT_SETTINGS_TYPE_JAVASCRIPT ||
content_type == CONTENT_SETTINGS_TYPE_PPAPI_BROKER || content_type == CONTENT_SETTINGS_TYPE_PPAPI_BROKER ||
...@@ -1696,10 +1701,6 @@ ContentSettingBubbleModel* ...@@ -1696,10 +1701,6 @@ ContentSettingBubbleModel*
return new ContentSettingSingleRadioGroup(delegate, web_contents, profile, return new ContentSettingSingleRadioGroup(delegate, web_contents, profile,
content_type); content_type);
} }
if (content_type == CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS) {
return new ContentSettingDownloadsBubbleModel(delegate, web_contents,
profile);
}
NOTREACHED() << "No bubble for the content type " << content_type << "."; NOTREACHED() << "No bubble for the content type " << content_type << ".";
return nullptr; return nullptr;
} }
......
...@@ -49,7 +49,6 @@ using content::WebContents; ...@@ -49,7 +49,6 @@ using content::WebContents;
// ContentSettingClipboardReadImageModel - clipboard read // ContentSettingClipboardReadImageModel - clipboard read
// ContentSettingSensorsImageModel - sensors // ContentSettingSensorsImageModel - sensors
// ContentSettingMediaImageModel - media // ContentSettingMediaImageModel - media
// ContentSettingSubresourceFilterImageModel - deceptive content
// ContentSettingFramebustBlockImageModel - blocked framebust // ContentSettingFramebustBlockImageModel - blocked framebust
class ContentSettingBlockedImageModel : public ContentSettingSimpleImageModel { class ContentSettingBlockedImageModel : public ContentSettingSimpleImageModel {
...@@ -172,6 +171,8 @@ const ContentSettingsImageDetails kImageDetails[] = { ...@@ -172,6 +171,8 @@ const ContentSettingsImageDetails kImageDetails[] = {
{CONTENT_SETTINGS_TYPE_PPAPI_BROKER, kExtensionIcon, {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, kExtensionIcon,
IDS_BLOCKED_PPAPI_BROKER_MESSAGE, 0, IDS_ALLOWED_PPAPI_BROKER_MESSAGE}, IDS_BLOCKED_PPAPI_BROKER_MESSAGE, 0, IDS_ALLOWED_PPAPI_BROKER_MESSAGE},
{CONTENT_SETTINGS_TYPE_SOUND, kTabAudioIcon, IDS_BLOCKED_SOUND_TITLE, 0, 0}, {CONTENT_SETTINGS_TYPE_SOUND, kTabAudioIcon, IDS_BLOCKED_SOUND_TITLE, 0, 0},
{CONTENT_SETTINGS_TYPE_ADS, kAdsIcon, IDS_BLOCKED_ADS_PROMPT_TOOLTIP,
IDS_BLOCKED_ADS_PROMPT_TITLE, 0},
}; };
const ContentSettingsImageDetails* GetImageDetails(ContentSettingsType type) { const ContentSettingsImageDetails* GetImageDetails(ContentSettingsType type) {
...@@ -258,7 +259,8 @@ ContentSettingImageModel::CreateForContentType(ImageType image_type) { ...@@ -258,7 +259,8 @@ ContentSettingImageModel::CreateForContentType(ImageType image_type) {
case ImageType::MEDIASTREAM: case ImageType::MEDIASTREAM:
return std::make_unique<ContentSettingMediaImageModel>(); return std::make_unique<ContentSettingMediaImageModel>();
case ImageType::ADS: case ImageType::ADS:
return std::make_unique<ContentSettingSubresourceFilterImageModel>(); return std::make_unique<ContentSettingBlockedImageModel>(
ImageType::ADS, CONTENT_SETTINGS_TYPE_ADS);
case ImageType::AUTOMATIC_DOWNLOADS: case ImageType::AUTOMATIC_DOWNLOADS:
return std::make_unique<ContentSettingDownloadsImageModel>(); return std::make_unique<ContentSettingDownloadsImageModel>();
case ImageType::MIDI_SYSEX: case ImageType::MIDI_SYSEX:
...@@ -595,61 +597,6 @@ void ContentSettingMediaImageModel::SetAnimationHasRun( ...@@ -595,61 +597,6 @@ void ContentSettingMediaImageModel::SetAnimationHasRun(
} }
} }
// Subresource Filter ----------------------------------------------------------
ContentSettingSubresourceFilterImageModel::
ContentSettingSubresourceFilterImageModel()
: ContentSettingImageModel(ImageType::ADS) {}
void ContentSettingSubresourceFilterImageModel::UpdateFromWebContents(
WebContents* web_contents) {
set_visible(false);
if (!web_contents)
return;
TabSpecificContentSettings* content_settings =
TabSpecificContentSettings::FromWebContents(web_contents);
if (!content_settings ||
!content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_ADS)) {
return;
}
set_icon(kAdsIcon, kBlockedBadgeIcon);
set_explanatory_string_id(IDS_BLOCKED_ADS_PROMPT_TITLE);
set_tooltip(l10n_util::GetStringUTF16(IDS_BLOCKED_ADS_PROMPT_TOOLTIP));
set_visible(true);
}
ContentSettingBubbleModel*
ContentSettingSubresourceFilterImageModel::CreateBubbleModelImpl(
ContentSettingBubbleModel::Delegate* delegate,
WebContents* web_contents,
Profile* profile) {
return new ContentSettingSubresourceFilterBubbleModel(delegate, web_contents,
profile);
}
bool ContentSettingSubresourceFilterImageModel::ShouldRunAnimation(
WebContents* web_contents) {
if (!web_contents)
return false;
TabSpecificContentSettings* content_settings =
TabSpecificContentSettings::FromWebContents(web_contents);
return content_settings &&
!content_settings->IsBlockageIndicated(CONTENT_SETTINGS_TYPE_ADS);
}
void ContentSettingSubresourceFilterImageModel::SetAnimationHasRun(
WebContents* web_contents) {
if (!web_contents)
return;
TabSpecificContentSettings* content_settings =
TabSpecificContentSettings::FromWebContents(web_contents);
if (content_settings) {
content_settings->SetBlockageHasBeenIndicated(CONTENT_SETTINGS_TYPE_ADS);
}
}
// Blocked Framebust ----------------------------------------------------------- // Blocked Framebust -----------------------------------------------------------
ContentSettingFramebustBlockImageModel::ContentSettingFramebustBlockImageModel() ContentSettingFramebustBlockImageModel::ContentSettingFramebustBlockImageModel()
......
...@@ -158,26 +158,6 @@ class ContentSettingSimpleImageModel : public ContentSettingImageModel { ...@@ -158,26 +158,6 @@ class ContentSettingSimpleImageModel : public ContentSettingImageModel {
DISALLOW_COPY_AND_ASSIGN(ContentSettingSimpleImageModel); DISALLOW_COPY_AND_ASSIGN(ContentSettingSimpleImageModel);
}; };
// Image model for subresource filter icons in the location bar.
class ContentSettingSubresourceFilterImageModel
: public ContentSettingImageModel {
public:
ContentSettingSubresourceFilterImageModel();
void UpdateFromWebContents(content::WebContents* web_contents) override;
ContentSettingBubbleModel* CreateBubbleModelImpl(
ContentSettingBubbleModel::Delegate* delegate,
content::WebContents* web_contents,
Profile* profile) override;
bool ShouldRunAnimation(content::WebContents* web_contents) override;
void SetAnimationHasRun(content::WebContents* web_contents) override;
private:
DISALLOW_COPY_AND_ASSIGN(ContentSettingSubresourceFilterImageModel);
};
class ContentSettingFramebustBlockImageModel : public ContentSettingImageModel { class ContentSettingFramebustBlockImageModel : public ContentSettingImageModel {
public: public:
ContentSettingFramebustBlockImageModel(); ContentSettingFramebustBlockImageModel();
......
...@@ -137,8 +137,9 @@ TEST_F(ContentSettingImageModelTest, SubresourceFilter) { ...@@ -137,8 +137,9 @@ TEST_F(ContentSettingImageModelTest, SubresourceFilter) {
TabSpecificContentSettings::CreateForWebContents(web_contents()); TabSpecificContentSettings::CreateForWebContents(web_contents());
TabSpecificContentSettings* content_settings = TabSpecificContentSettings* content_settings =
TabSpecificContentSettings::FromWebContents(web_contents()); TabSpecificContentSettings::FromWebContents(web_contents());
std::unique_ptr<ContentSettingImageModel> content_setting_image_model( auto content_setting_image_model =
new ContentSettingSubresourceFilterImageModel()); ContentSettingImageModel::CreateForContentType(
ContentSettingImageModel::ImageType::ADS);
EXPECT_FALSE(content_setting_image_model->is_visible()); EXPECT_FALSE(content_setting_image_model->is_visible());
EXPECT_TRUE(content_setting_image_model->get_tooltip().empty()); EXPECT_TRUE(content_setting_image_model->get_tooltip().empty());
......
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