| 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 3cf2bf98178df9a4aee9153c138d5b56d3517e12..5cff2e4a8ef3682069781a77faff477a86015681 100644
|
| --- a/chrome/browser/ui/content_settings/content_setting_image_model.cc
|
| +++ b/chrome/browser/ui/content_settings/content_setting_image_model.cc
|
| @@ -30,6 +30,14 @@ class ContentSettingGeolocationImageModel : public ContentSettingImageModel {
|
| virtual void UpdateFromWebContents(WebContents* web_contents) OVERRIDE;
|
| };
|
|
|
| +// Image model for displaying media icons in the location bar.
|
| +class ContentSettingMediaImageModel : public ContentSettingImageModel {
|
| + public:
|
| + ContentSettingMediaImageModel();
|
| +
|
| + virtual void UpdateFromWebContents(WebContents* web_contents) OVERRIDE;
|
| +};
|
| +
|
| class ContentSettingRPHImageModel : public ContentSettingImageModel {
|
| public:
|
| ContentSettingRPHImageModel();
|
| @@ -166,6 +174,34 @@ void ContentSettingGeolocationImageModel::UpdateFromWebContents(
|
| IDS_GEOLOCATION_ALLOWED_TOOLTIP : IDS_GEOLOCATION_BLOCKED_TOOLTIP));
|
| }
|
|
|
| +ContentSettingMediaImageModel::ContentSettingMediaImageModel()
|
| + : ContentSettingImageModel(CONTENT_SETTINGS_TYPE_MEDIASTREAM) {
|
| +}
|
| +
|
| +void ContentSettingMediaImageModel::UpdateFromWebContents(
|
| + WebContents* web_contents) {
|
| + set_visible(false);
|
| + if (!web_contents)
|
| + return;
|
| +
|
| + TabSpecificContentSettings* content_settings =
|
| + TabSpecificContentSettings::FromWebContents(web_contents);
|
| + if (!content_settings)
|
| + return;
|
| +
|
| + bool blocked =
|
| + content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_MEDIASTREAM);
|
| + if (!blocked &&
|
| + !content_settings->IsContentAccessed(get_content_settings_type()))
|
| + return;
|
| +
|
| + set_tooltip(
|
| + l10n_util::GetStringUTF8(blocked ? IDS_MEDIASTREAM_BLOCKED_TOOLTIP
|
| + : IDS_MEDIASTREAM_ALLOWED_TOOLTIP));
|
| + set_icon(blocked ? IDR_BLOCKED_MEDIA : IDR_ASK_MEDIA);
|
| + set_visible(true);
|
| +}
|
| +
|
| ContentSettingRPHImageModel::ContentSettingRPHImageModel()
|
| : ContentSettingImageModel(
|
| CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS) {
|
| @@ -218,6 +254,8 @@ ContentSettingImageModel*
|
| return new ContentSettingNotificationsImageModel();
|
| case CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS:
|
| return new ContentSettingRPHImageModel();
|
| + case CONTENT_SETTINGS_TYPE_MEDIASTREAM:
|
| + return new ContentSettingMediaImageModel();
|
| default:
|
| return new ContentSettingBlockedImageModel(content_settings_type);
|
| }
|
|
|