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..5fcd9c6840f978008632a53506d35d6a011d0043 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 content_type() 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); |
}; |
@@ -179,6 +181,10 @@ void ContentSettingSimpleImageModel::SetAnimationHasRun( |
content_settings->SetBlockageHasBeenIndicated(content_type()); |
} |
+ContentSettingsType ContentSettingSimpleImageModel::content_type() { |
+ return content_type_; |
+} |
+ |
// static |
std::unique_ptr<ContentSettingImageModel> |
ContentSettingSimpleImageModel::CreateForContentTypeForTesting( |
@@ -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; |
set_tooltip(l10n_util::GetStringUTF16(id)); |
set_visible(true); |
} |
@@ -386,6 +395,11 @@ void ContentSettingMediaImageModel::SetAnimationHasRun( |
} |
} |
+ContentSettingsType ContentSettingMediaImageModel::content_type() { |
+ return last_content_type_; |
+} |
+ |
+ |
// Subresource Filter ---------------------------------------------------------- |
ContentSettingSubresourceFilterImageModel:: |
@@ -521,6 +535,10 @@ ContentSettingImageModel::ContentSettingImageModel() |
icon_badge_id_(gfx::VectorIconId::VECTOR_ICON_NONE), |
explanatory_string_id_(0) {} |
+ContentSettingsType ContentSettingImageModel::content_type() { |
+ return CONTENT_SETTINGS_TYPE_DEFAULT; |
+} |
+ |
// static |
std::vector<std::unique_ptr<ContentSettingImageModel>> |
ContentSettingImageModel::GenerateContentSettingImageModels() { |