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

Side by Side 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, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" 5 #include "chrome/browser/ui/content_settings/content_setting_image_model.h"
6 6
7 #include "chrome/browser/content_settings/host_content_settings_map.h" 7 #include "chrome/browser/content_settings/host_content_settings_map.h"
8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 8 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
9 #include "chrome/browser/prerender/prerender_manager.h" 9 #include "chrome/browser/prerender/prerender_manager.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 if (!web_contents) 241 if (!web_contents)
242 return; 242 return;
243 243
244 TabSpecificContentSettings* content_settings = 244 TabSpecificContentSettings* content_settings =
245 TabSpecificContentSettings::FromWebContents(web_contents); 245 TabSpecificContentSettings::FromWebContents(web_contents);
246 if (!content_settings) 246 if (!content_settings)
247 return; 247 return;
248 TabSpecificContentSettings::MicrophoneCameraState state = 248 TabSpecificContentSettings::MicrophoneCameraState state =
249 content_settings->GetMicrophoneCameraState(); 249 content_settings->GetMicrophoneCameraState();
250 250
251 switch (state) { 251 // If neither the microphone nor the camera stream was accessed then no icon
252 case TabSpecificContentSettings::MICROPHONE_CAMERA_NOT_ACCESSED: 252 // is displayed in the omnibox.
253 // If neither the microphone nor the camera stream was accessed then no 253 if (state == TabSpecificContentSettings::MICROPHONE_CAMERA_NOT_ACCESSED)
254 // icon is displayed in the omnibox. 254 return;
255 return; 255
256 case TabSpecificContentSettings::MICROPHONE_ACCESSED: 256 bool is_mic = (state & TabSpecificContentSettings::MICROPHONE_ACCESSED) != 0;
257 set_icon(IDR_ASK_MEDIA); 257 bool is_cam = (state & TabSpecificContentSettings::CAMERA_ACCESSED) != 0;
258 set_tooltip(l10n_util::GetStringUTF8(IDS_MICROPHONE_ACCESSED)); 258 DCHECK(is_mic || is_cam);
259 break; 259
260 case TabSpecificContentSettings::CAMERA_ACCESSED: 260 int id = IDS_CAMERA_BLOCKED;
261 set_icon(IDR_ASK_MEDIA); 261 if (state & (TabSpecificContentSettings::MICROPHONE_BLOCKED |
262 set_tooltip(l10n_util::GetStringUTF8(IDS_CAMERA_ACCESSED)); 262 TabSpecificContentSettings::CAMERA_BLOCKED)) {
263 break; 263 set_icon(IDR_BLOCKED_MEDIA);
264 case TabSpecificContentSettings::MICROPHONE_CAMERA_ACCESSED: 264 if (is_mic)
265 set_icon(IDR_ASK_MEDIA); 265 id = is_cam ? IDS_MICROPHONE_CAMERA_BLOCKED : IDS_MICROPHONE_BLOCKED;
266 set_tooltip(l10n_util::GetStringUTF8(IDS_MICROPHONE_CAMERA_ALLOWED)); 266 } else {
267 break; 267 set_icon(IDR_ASK_MEDIA);
268 case TabSpecificContentSettings::MICROPHONE_BLOCKED: 268 id = IDS_CAMERA_ACCESSED;
269 set_icon(IDR_BLOCKED_MEDIA); 269 if (is_mic)
270 set_tooltip(l10n_util::GetStringUTF8(IDS_MICROPHONE_BLOCKED)); 270 id = is_cam ? IDS_MICROPHONE_CAMERA_ALLOWED : IDS_MICROPHONE_ACCESSED;
271 break;
272 case TabSpecificContentSettings::CAMERA_BLOCKED:
273 set_icon(IDR_BLOCKED_MEDIA);
274 set_tooltip(l10n_util::GetStringUTF8(IDS_CAMERA_BLOCKED));
275 break;
276 case TabSpecificContentSettings::MICROPHONE_CAMERA_BLOCKED:
277 set_icon(IDR_BLOCKED_MEDIA);
278 set_tooltip(l10n_util::GetStringUTF8(IDS_MICROPHONE_CAMERA_BLOCKED));
279 break;
280 } 271 }
272 set_tooltip(l10n_util::GetStringUTF8(id));
281 set_visible(true); 273 set_visible(true);
282 } 274 }
283 275
284 ContentSettingRPHImageModel::ContentSettingRPHImageModel() 276 ContentSettingRPHImageModel::ContentSettingRPHImageModel()
285 : ContentSettingImageModel( 277 : ContentSettingImageModel(
286 CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS) { 278 CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS) {
287 set_icon(IDR_REGISTER_PROTOCOL_HANDLER); 279 set_icon(IDR_REGISTER_PROTOCOL_HANDLER);
288 set_tooltip(l10n_util::GetStringUTF8(IDS_REGISTER_PROTOCOL_HANDLER_TOOLTIP)); 280 set_tooltip(l10n_util::GetStringUTF8(IDS_REGISTER_PROTOCOL_HANDLER_TOOLTIP));
289 } 281 }
290 282
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 case CONTENT_SETTINGS_TYPE_MEDIASTREAM: 358 case CONTENT_SETTINGS_TYPE_MEDIASTREAM:
367 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC: 359 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC:
368 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA: 360 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA:
369 return new ContentSettingMediaImageModel(content_settings_type); 361 return new ContentSettingMediaImageModel(content_settings_type);
370 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: 362 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX:
371 return new ContentSettingMIDISysExImageModel(); 363 return new ContentSettingMIDISysExImageModel();
372 default: 364 default:
373 return new ContentSettingBlockedImageModel(content_settings_type); 365 return new ContentSettingBlockedImageModel(content_settings_type);
374 } 366 }
375 } 367 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698