| 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_capture_devices_dispatcher.h" | 5 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
| 6 | 6 |
| 7 #include "apps/app_window.h" | 7 #include "apps/app_window.h" |
| 8 #include "apps/app_window_registry.h" | 8 #include "apps/app_window_registry.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 : is_device_enumeration_disabled_(false), | 269 : is_device_enumeration_disabled_(false), |
| 270 media_stream_capture_indicator_(new MediaStreamCaptureIndicator()) { | 270 media_stream_capture_indicator_(new MediaStreamCaptureIndicator()) { |
| 271 // MediaCaptureDevicesDispatcher is a singleton. It should be created on | 271 // MediaCaptureDevicesDispatcher is a singleton. It should be created on |
| 272 // UI thread. Otherwise, it will not receive | 272 // UI thread. Otherwise, it will not receive |
| 273 // content::NOTIFICATION_WEB_CONTENTS_DESTROYED, and that will result in | 273 // content::NOTIFICATION_WEB_CONTENTS_DESTROYED, and that will result in |
| 274 // possible use after free. | 274 // possible use after free. |
| 275 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 275 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 276 notifications_registrar_.Add( | 276 notifications_registrar_.Add( |
| 277 this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 277 this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
| 278 content::NotificationService::AllSources()); | 278 content::NotificationService::AllSources()); |
| 279 |
| 280 // AVFoundation is used for video/audio device monitoring and video capture in |
| 281 // Mac. Experimentally, connect it in Canary and Unknown (developer builds). |
| 282 #if defined(OS_MACOSX) |
| 283 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
| 284 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kForceQTKit)) { |
| 285 if (channel == chrome::VersionInfo::CHANNEL_CANARY || |
| 286 channel == chrome::VersionInfo::CHANNEL_UNKNOWN) { |
| 287 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 288 switches::kEnableAVFoundation); |
| 289 } |
| 290 } |
| 291 #endif |
| 279 } | 292 } |
| 280 | 293 |
| 281 MediaCaptureDevicesDispatcher::~MediaCaptureDevicesDispatcher() {} | 294 MediaCaptureDevicesDispatcher::~MediaCaptureDevicesDispatcher() {} |
| 282 | 295 |
| 283 void MediaCaptureDevicesDispatcher::RegisterProfilePrefs( | 296 void MediaCaptureDevicesDispatcher::RegisterProfilePrefs( |
| 284 user_prefs::PrefRegistrySyncable* registry) { | 297 user_prefs::PrefRegistrySyncable* registry) { |
| 285 registry->RegisterStringPref( | 298 registry->RegisterStringPref( |
| 286 prefs::kDefaultAudioCaptureDevice, | 299 prefs::kDefaultAudioCaptureDevice, |
| 287 std::string(), | 300 std::string(), |
| 288 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 301 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 | 1015 |
| 1003 void MediaCaptureDevicesDispatcher::SetTestAudioCaptureDevices( | 1016 void MediaCaptureDevicesDispatcher::SetTestAudioCaptureDevices( |
| 1004 const MediaStreamDevices& devices) { | 1017 const MediaStreamDevices& devices) { |
| 1005 test_audio_devices_ = devices; | 1018 test_audio_devices_ = devices; |
| 1006 } | 1019 } |
| 1007 | 1020 |
| 1008 void MediaCaptureDevicesDispatcher::SetTestVideoCaptureDevices( | 1021 void MediaCaptureDevicesDispatcher::SetTestVideoCaptureDevices( |
| 1009 const MediaStreamDevices& devices) { | 1022 const MediaStreamDevices& devices) { |
| 1010 test_video_devices_ = devices; | 1023 test_video_devices_ = devices; |
| 1011 } | 1024 } |
| OLD | NEW |