Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(907)

Unified Diff: chrome/browser/ui/content_settings/content_setting_image_model.cc

Issue 11896028: Add an location bar icon and a content settings bubble for media settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase on tot. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..44a69461257cad5b6e8f6f9730541d3bdc45f183 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,32 @@ 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;
Bernhard Bauer 2013/01/22 14:59:08 Nit: new line after this one would be nice.
markusheintz_ 2013/01/23 10:42:30 Done.
+ 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;
Bernhard Bauer 2013/01/22 14:59:08 Use braces if the if-statement is more than one li
markusheintz_ 2013/01/23 10:42:30 Added a newline. So let me repeat Peters view on
Bernhard Bauer 2013/01/23 10:54:11 No, it's fine with me.
+ 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 +252,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);
}

Powered by Google App Engine
This is Rietveld 408576698