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

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: Fix browser test 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..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));
Peter Kasting 2013/01/27 22:36:16 Nit: Google style guide says wrap after operators,
markusheintz_ 2013/01/28 10:06:47 Done.
+ 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);
}

Powered by Google App Engine
This is Rietveld 408576698