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

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

Issue 588153003: Remove MediaSettingChangedInfobar and show latest state in bubble (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: switch -> if Created 6 years, 3 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 9eff20e4c68c977b252caaaf78deff8e77c492e5..09aff0a3484e67e8bf4e4627aed4f4eed7a99ccd 100644
--- a/chrome/browser/ui/content_settings/content_setting_image_model.cc
+++ b/chrome/browser/ui/content_settings/content_setting_image_model.cc
@@ -248,36 +248,28 @@ void ContentSettingMediaImageModel::UpdateFromWebContents(
TabSpecificContentSettings::MicrophoneCameraState state =
content_settings->GetMicrophoneCameraState();
- switch (state) {
- case TabSpecificContentSettings::MICROPHONE_CAMERA_NOT_ACCESSED:
- // If neither the microphone nor the camera stream was accessed then no
- // icon is displayed in the omnibox.
- return;
- case TabSpecificContentSettings::MICROPHONE_ACCESSED:
- set_icon(IDR_ASK_MEDIA);
- set_tooltip(l10n_util::GetStringUTF8(IDS_MICROPHONE_ACCESSED));
- break;
- case TabSpecificContentSettings::CAMERA_ACCESSED:
- set_icon(IDR_ASK_MEDIA);
- set_tooltip(l10n_util::GetStringUTF8(IDS_CAMERA_ACCESSED));
- break;
- case TabSpecificContentSettings::MICROPHONE_CAMERA_ACCESSED:
- set_icon(IDR_ASK_MEDIA);
- set_tooltip(l10n_util::GetStringUTF8(IDS_MICROPHONE_CAMERA_ALLOWED));
- break;
- case TabSpecificContentSettings::MICROPHONE_BLOCKED:
- set_icon(IDR_BLOCKED_MEDIA);
- set_tooltip(l10n_util::GetStringUTF8(IDS_MICROPHONE_BLOCKED));
- break;
- case TabSpecificContentSettings::CAMERA_BLOCKED:
- set_icon(IDR_BLOCKED_MEDIA);
- set_tooltip(l10n_util::GetStringUTF8(IDS_CAMERA_BLOCKED));
- break;
- case TabSpecificContentSettings::MICROPHONE_CAMERA_BLOCKED:
- set_icon(IDR_BLOCKED_MEDIA);
- set_tooltip(l10n_util::GetStringUTF8(IDS_MICROPHONE_CAMERA_BLOCKED));
- break;
+ // If neither the microphone nor the camera stream was accessed then no icon
+ // is displayed in the omnibox.
+ if (state == TabSpecificContentSettings::MICROPHONE_CAMERA_NOT_ACCESSED)
+ return;
+
+ bool is_mic = (state & TabSpecificContentSettings::MICROPHONE_ACCESSED) != 0;
+ bool is_cam = (state & TabSpecificContentSettings::CAMERA_ACCESSED) != 0;
+ DCHECK(is_mic || is_cam);
+
+ int id = IDS_CAMERA_BLOCKED;
+ if (state & (TabSpecificContentSettings::MICROPHONE_BLOCKED |
+ TabSpecificContentSettings::CAMERA_BLOCKED)) {
+ set_icon(IDR_BLOCKED_MEDIA);
+ if (is_mic)
+ id = is_cam ? IDS_MICROPHONE_CAMERA_BLOCKED : IDS_MICROPHONE_BLOCKED;
+ } else {
+ set_icon(IDR_ASK_MEDIA);
+ id = IDS_CAMERA_ACCESSED;
+ if (is_mic)
+ id = is_cam ? IDS_MICROPHONE_CAMERA_ALLOWED : IDS_MICROPHONE_ACCESSED;
}
+ set_tooltip(l10n_util::GetStringUTF8(id));
set_visible(true);
}

Powered by Google App Engine
This is Rietveld 408576698