Index: chrome/browser/ui/content_settings/content_setting_image_model.cc |
diff --git a/chrome/browser/ui/content_settings/content_setting_image_model.cc b/chrome/browser/ui/content_settings/content_setting_image_model.cc |
index 1bef3be8a1f4d1faa43c6f0c1379345e4de734e6..524c6011c6b3cd5fc80cdeda2add052e84d14f5e 100644 |
--- a/chrome/browser/ui/content_settings/content_setting_image_model.cc |
+++ b/chrome/browser/ui/content_settings/content_setting_image_model.cc |
@@ -75,7 +75,10 @@ class ContentSettingMediaImageModel : public ContentSettingImageModel { |
bool ShouldRunAnimation(WebContents* web_contents) override; |
void SetAnimationHasRun(WebContents* web_contents) override; |
+ ContentSettingsType GetContentType() override; |
private: |
+ // This is cached here for testing purposes. |
+ ContentSettingsType last_content_type_; |
DISALLOW_COPY_AND_ASSIGN(ContentSettingMediaImageModel); |
}; |
@@ -92,7 +95,6 @@ class ContentSettingMIDISysExImageModel |
ContentSettingMIDISysExImageModel(); |
void UpdateFromWebContents(WebContents* web_contents) override; |
- |
private: |
DISALLOW_COPY_AND_ASSIGN(ContentSettingMIDISysExImageModel); |
}; |
@@ -153,7 +155,7 @@ ContentSettingBubbleModel* ContentSettingSimpleImageModel::CreateBubbleModel( |
delegate, |
web_contents, |
profile, |
- content_type()); |
+ GetContentType()); |
tapted
2017/02/03 00:35:39
since this was claimed "for testing only" we shoul
|
} |
bool ContentSettingSimpleImageModel::ShouldRunAnimation( |
@@ -166,7 +168,7 @@ bool ContentSettingSimpleImageModel::ShouldRunAnimation( |
if (!content_settings) |
return false; |
- return !content_settings->IsBlockageIndicated(content_type()); |
+ return !content_settings->IsBlockageIndicated(GetContentType()); |
} |
void ContentSettingSimpleImageModel::SetAnimationHasRun( |
@@ -176,7 +178,11 @@ void ContentSettingSimpleImageModel::SetAnimationHasRun( |
TabSpecificContentSettings* content_settings = |
TabSpecificContentSettings::FromWebContents(web_contents); |
if (content_settings) |
- content_settings->SetBlockageHasBeenIndicated(content_type()); |
+ content_settings->SetBlockageHasBeenIndicated(GetContentType()); |
+} |
+ |
+ContentSettingsType ContentSettingSimpleImageModel::GetContentType() { |
+ return content_type_; |
} |
// static |
@@ -209,7 +215,7 @@ void ContentSettingBlockedImageModel::UpdateFromWebContents( |
if (!web_contents) |
return; |
- const ContentSettingsType type = content_type(); |
+ const ContentSettingsType type = GetContentType(); |
const ContentSettingsImageDetails* image_details = GetImageDetails(type); |
DCHECK(image_details) << "No entry for " << type << " in kImageDetails[]."; |
@@ -311,7 +317,7 @@ ContentSettingMediaImageModel::ContentSettingMediaImageModel() |
void ContentSettingMediaImageModel::UpdateFromWebContents( |
WebContents* web_contents) { |
set_visible(false); |
- |
+ last_content_type_ = CONTENT_SETTINGS_TYPE_DEFAULT; |
if (!web_contents) |
return; |
@@ -345,6 +351,9 @@ void ContentSettingMediaImageModel::UpdateFromWebContents( |
if (is_mic) |
id = is_cam ? IDS_MICROPHONE_CAMERA_ALLOWED : IDS_MICROPHONE_ACCESSED; |
} |
+ // During bubble dialog testing, only one of the 'devices' will be blocked |
+ last_content_type_ = is_mic ? CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC : |
+ CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA; |
tapted
2017/02/03 00:35:39
did `git cl format` do this? (looks different to h
kylix_rd
2017/02/03 18:55:03
Yes, 'git cl format' did this.
|
set_tooltip(l10n_util::GetStringUTF16(id)); |
set_visible(true); |
} |
@@ -386,6 +395,11 @@ void ContentSettingMediaImageModel::SetAnimationHasRun( |
} |
} |
+ContentSettingsType ContentSettingMediaImageModel::GetContentType() { |
+ return last_content_type_; |
+} |
+ |
tapted
2017/02/03 00:35:39
nit: remove blank line
|
+ |
// Subresource Filter ---------------------------------------------------------- |
ContentSettingSubresourceFilterImageModel:: |
@@ -521,6 +535,10 @@ ContentSettingImageModel::ContentSettingImageModel() |
icon_badge_id_(gfx::VectorIconId::VECTOR_ICON_NONE), |
explanatory_string_id_(0) {} |
+ContentSettingsType ContentSettingImageModel::GetContentType() { |
+ return CONTENT_SETTINGS_TYPE_DEFAULT; |
+} |
+ |
// static |
std::vector<std::unique_ptr<ContentSettingImageModel>> |
ContentSettingImageModel::GenerateContentSettingImageModels() { |