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 <stddef.h> | 7 #include <stddef.h> |
8 | |
9 #include <string> | 8 #include <string> |
| 9 #include <utility> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "chrome/app/chrome_command_ids.h" | 16 #include "chrome/app/chrome_command_ids.h" |
17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/status_icons/status_icon.h" | 19 #include "chrome/browser/status_icons/status_icon.h" |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 } | 411 } |
412 | 412 |
413 if (command_targets_.empty()) { | 413 if (command_targets_.empty()) { |
414 MaybeDestroyStatusTrayIcon(); | 414 MaybeDestroyStatusTrayIcon(); |
415 return; | 415 return; |
416 } | 416 } |
417 | 417 |
418 // The icon will take the ownership of the passed context menu. | 418 // The icon will take the ownership of the passed context menu. |
419 MaybeCreateStatusTrayIcon(audio, video); | 419 MaybeCreateStatusTrayIcon(audio, video); |
420 if (status_icon_) { | 420 if (status_icon_) { |
421 status_icon_->SetContextMenu(menu.Pass()); | 421 status_icon_->SetContextMenu(std::move(menu)); |
422 } | 422 } |
423 } | 423 } |
424 | 424 |
425 void MediaStreamCaptureIndicator::GetStatusTrayIconInfo( | 425 void MediaStreamCaptureIndicator::GetStatusTrayIconInfo( |
426 bool audio, | 426 bool audio, |
427 bool video, | 427 bool video, |
428 gfx::ImageSkia* image, | 428 gfx::ImageSkia* image, |
429 base::string16* tool_tip) { | 429 base::string16* tool_tip) { |
430 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 430 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
431 DCHECK(audio || video); | 431 DCHECK(audio || video); |
432 DCHECK(image); | 432 DCHECK(image); |
433 DCHECK(tool_tip); | 433 DCHECK(tool_tip); |
434 | 434 |
435 int message_id = 0; | 435 int message_id = 0; |
436 if (audio && video) { | 436 if (audio && video) { |
437 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_AUDIO_AND_VIDEO; | 437 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_AUDIO_AND_VIDEO; |
438 *image = *camera_image_; | 438 *image = *camera_image_; |
439 } else if (audio && !video) { | 439 } else if (audio && !video) { |
440 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_AUDIO_ONLY; | 440 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_AUDIO_ONLY; |
441 *image = *mic_image_; | 441 *image = *mic_image_; |
442 } else if (!audio && video) { | 442 } else if (!audio && video) { |
443 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_VIDEO_ONLY; | 443 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_VIDEO_ONLY; |
444 *image = *camera_image_; | 444 *image = *camera_image_; |
445 } | 445 } |
446 | 446 |
447 *tool_tip = l10n_util::GetStringUTF16(message_id); | 447 *tool_tip = l10n_util::GetStringUTF16(message_id); |
448 } | 448 } |
OLD | NEW |