OLD | NEW |
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/media/media_stream_capture_indicator.h" | 5 #include "chrome/browser/media/media_stream_capture_indicator.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 void MediaStreamCaptureIndicator::ExecuteCommand(int command_id, | 289 void MediaStreamCaptureIndicator::ExecuteCommand(int command_id, |
290 int event_flags) { | 290 int event_flags) { |
291 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 291 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
292 | 292 |
293 const int index = | 293 const int index = |
294 command_id - IDC_MEDIA_CONTEXT_MEDIA_STREAM_CAPTURE_LIST_FIRST; | 294 command_id - IDC_MEDIA_CONTEXT_MEDIA_STREAM_CAPTURE_LIST_FIRST; |
295 DCHECK_LE(0, index); | 295 DCHECK_LE(0, index); |
296 DCHECK_GT(static_cast<int>(command_targets_.size()), index); | 296 DCHECK_GT(static_cast<int>(command_targets_.size()), index); |
297 WebContents* web_contents = command_targets_[index]; | 297 WebContents* web_contents = command_targets_[index]; |
298 if (ContainsKey(usage_map_, web_contents)) | 298 if (ContainsKey(usage_map_, web_contents)) |
299 web_contents->GetDelegate()->ActivateContents(web_contents); | 299 web_contents->GetDelegate()->ActivateContents(web_contents, |
| 300 true /* user_gesture */); |
300 } | 301 } |
301 | 302 |
302 bool MediaStreamCaptureIndicator::IsCapturingUserMedia( | 303 bool MediaStreamCaptureIndicator::IsCapturingUserMedia( |
303 content::WebContents* web_contents) const { | 304 content::WebContents* web_contents) const { |
304 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 305 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
305 | 306 |
306 WebContentsDeviceUsage* usage = usage_map_.get(web_contents); | 307 WebContentsDeviceUsage* usage = usage_map_.get(web_contents); |
307 return usage && (usage->IsCapturingAudio() || usage->IsCapturingVideo()); | 308 return usage && (usage->IsCapturingAudio() || usage->IsCapturingVideo()); |
308 } | 309 } |
309 | 310 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 } else if (audio && !video) { | 467 } else if (audio && !video) { |
467 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_AUDIO_ONLY; | 468 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_AUDIO_ONLY; |
468 *image = *mic_image_; | 469 *image = *mic_image_; |
469 } else if (!audio && video) { | 470 } else if (!audio && video) { |
470 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_VIDEO_ONLY; | 471 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_VIDEO_ONLY; |
471 *image = *camera_image_; | 472 *image = *camera_image_; |
472 } | 473 } |
473 | 474 |
474 *tool_tip = l10n_util::GetStringUTF16(message_id); | 475 *tool_tip = l10n_util::GetStringUTF16(message_id); |
475 } | 476 } |
OLD | NEW |