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

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: Remove redundant is_cam 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..1e69842d44d9eeca82d82c0c078e86a8c12e772f 100644
--- a/chrome/browser/ui/content_settings/content_setting_image_model.cc
+++ b/chrome/browser/ui/content_settings/content_setting_image_model.cc
@@ -246,38 +246,30 @@ void ContentSettingMediaImageModel::UpdateFromWebContents(
if (!content_settings)
return;
TabSpecificContentSettings::MicrophoneCameraState state =
- content_settings->GetMicrophoneCameraState();
+ content_settings->GetMicrophoneCameraState();
Bernhard Bauer 2014/09/25 16:18:27 Nit: remove the extra space here.
robwu 2014/09/25 19:15:53 Done.
- 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;
+
+ const bool is_mic = state & TabSpecificContentSettings::MICROPHONE_ACCESSED;
+ const bool is_cam = state & TabSpecificContentSettings::CAMERA_ACCESSED;
+ 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