| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 weak_factory_.GetWeakPtr(), devices)); | 223 weak_factory_.GetWeakPtr(), devices)); |
| 224 } | 224 } |
| 225 | 225 |
| 226 void MediaStreamCaptureIndicator::WebContentsDeviceUsage::AddDevices( | 226 void MediaStreamCaptureIndicator::WebContentsDeviceUsage::AddDevices( |
| 227 const content::MediaStreamDevices& devices) { | 227 const content::MediaStreamDevices& devices) { |
| 228 for (content::MediaStreamDevices::const_iterator it = devices.begin(); | 228 for (content::MediaStreamDevices::const_iterator it = devices.begin(); |
| 229 it != devices.end(); ++it) { | 229 it != devices.end(); ++it) { |
| 230 if (it->type == content::MEDIA_TAB_AUDIO_CAPTURE || | 230 if (it->type == content::MEDIA_TAB_AUDIO_CAPTURE || |
| 231 it->type == content::MEDIA_TAB_VIDEO_CAPTURE) { | 231 it->type == content::MEDIA_TAB_VIDEO_CAPTURE) { |
| 232 ++mirroring_ref_count_; | 232 ++mirroring_ref_count_; |
| 233 } else if (content::IsAudioInputMediaType(it->type)) { | 233 } else if (content::IsAudioMediaType(it->type)) { |
| 234 ++audio_ref_count_; | 234 ++audio_ref_count_; |
| 235 } else if (content::IsVideoMediaType(it->type)) { | 235 } else if (content::IsVideoMediaType(it->type)) { |
| 236 ++video_ref_count_; | 236 ++video_ref_count_; |
| 237 } else { | 237 } else { |
| 238 NOTIMPLEMENTED(); | 238 NOTIMPLEMENTED(); |
| 239 } | 239 } |
| 240 } | 240 } |
| 241 | 241 |
| 242 if (web_contents()) | 242 if (web_contents()) |
| 243 web_contents()->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TAB); | 243 web_contents()->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TAB); |
| 244 | 244 |
| 245 indicator_->UpdateNotificationUserInterface(); | 245 indicator_->UpdateNotificationUserInterface(); |
| 246 } | 246 } |
| 247 | 247 |
| 248 void MediaStreamCaptureIndicator::WebContentsDeviceUsage::RemoveDevices( | 248 void MediaStreamCaptureIndicator::WebContentsDeviceUsage::RemoveDevices( |
| 249 const content::MediaStreamDevices& devices) { | 249 const content::MediaStreamDevices& devices) { |
| 250 for (content::MediaStreamDevices::const_iterator it = devices.begin(); | 250 for (content::MediaStreamDevices::const_iterator it = devices.begin(); |
| 251 it != devices.end(); ++it) { | 251 it != devices.end(); ++it) { |
| 252 if (it->type == content::MEDIA_TAB_AUDIO_CAPTURE || | 252 if (it->type == content::MEDIA_TAB_AUDIO_CAPTURE || |
| 253 it->type == content::MEDIA_TAB_VIDEO_CAPTURE) { | 253 it->type == content::MEDIA_TAB_VIDEO_CAPTURE) { |
| 254 --mirroring_ref_count_; | 254 --mirroring_ref_count_; |
| 255 } else if (content::IsAudioInputMediaType(it->type)) { | 255 } else if (content::IsAudioMediaType(it->type)) { |
| 256 --audio_ref_count_; | 256 --audio_ref_count_; |
| 257 } else if (content::IsVideoMediaType(it->type)) { | 257 } else if (content::IsVideoMediaType(it->type)) { |
| 258 --video_ref_count_; | 258 --video_ref_count_; |
| 259 } else { | 259 } else { |
| 260 NOTIMPLEMENTED(); | 260 NOTIMPLEMENTED(); |
| 261 } | 261 } |
| 262 } | 262 } |
| 263 | 263 |
| 264 DCHECK_GE(audio_ref_count_, 0); | 264 DCHECK_GE(audio_ref_count_, 0); |
| 265 DCHECK_GE(video_ref_count_, 0); | 265 DCHECK_GE(video_ref_count_, 0); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 } else if (audio && !video) { | 482 } else if (audio && !video) { |
| 483 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_AUDIO_ONLY; | 483 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_AUDIO_ONLY; |
| 484 *image = *mic_image_; | 484 *image = *mic_image_; |
| 485 } else if (!audio && video) { | 485 } else if (!audio && video) { |
| 486 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_VIDEO_ONLY; | 486 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_VIDEO_ONLY; |
| 487 *image = *camera_image_; | 487 *image = *camera_image_; |
| 488 } | 488 } |
| 489 | 489 |
| 490 *tool_tip = l10n_util::GetStringUTF16(message_id); | 490 *tool_tip = l10n_util::GetStringUTF16(message_id); |
| 491 } | 491 } |
| OLD | NEW |