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 "content/browser/device_monitor_mac.h" | 5 #include "content/browser/device_monitor_mac.h" |
6 | 6 |
7 #import <QTKit/QTKit.h> | 7 #import <QTKit/QTKit.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 129 |
130 if (video_device_added || video_device_removed) | 130 if (video_device_added || video_device_removed) |
131 monitor_->NotifyDeviceChanged(base::SystemMonitor::DEVTYPE_VIDEO_CAPTURE); | 131 monitor_->NotifyDeviceChanged(base::SystemMonitor::DEVTYPE_VIDEO_CAPTURE); |
132 if (audio_device_added || audio_device_removed) | 132 if (audio_device_added || audio_device_removed) |
133 monitor_->NotifyDeviceChanged(base::SystemMonitor::DEVTYPE_AUDIO_CAPTURE); | 133 monitor_->NotifyDeviceChanged(base::SystemMonitor::DEVTYPE_AUDIO_CAPTURE); |
134 } | 134 } |
135 | 135 |
136 class QTKitMonitorImpl : public DeviceMonitorMacImpl { | 136 class QTKitMonitorImpl : public DeviceMonitorMacImpl { |
137 public: | 137 public: |
138 explicit QTKitMonitorImpl(content::DeviceMonitorMac* monitor); | 138 explicit QTKitMonitorImpl(content::DeviceMonitorMac* monitor); |
139 virtual ~QTKitMonitorImpl(); | 139 ~QTKitMonitorImpl() override; |
140 | 140 |
141 virtual void OnDeviceChanged() override; | 141 void OnDeviceChanged() override; |
| 142 |
142 private: | 143 private: |
143 void CountDevices(); | 144 void CountDevices(); |
144 void OnAttributeChanged(NSNotification* notification); | 145 void OnAttributeChanged(NSNotification* notification); |
145 | 146 |
146 id device_change_; | 147 id device_change_; |
147 }; | 148 }; |
148 | 149 |
149 QTKitMonitorImpl::QTKitMonitorImpl(content::DeviceMonitorMac* monitor) | 150 QTKitMonitorImpl::QTKitMonitorImpl(content::DeviceMonitorMac* monitor) |
150 : DeviceMonitorMacImpl(monitor) { | 151 : DeviceMonitorMacImpl(monitor) { |
151 NSNotificationCenter* nc = [NSNotificationCenter defaultCenter]; | 152 NSNotificationCenter* nc = [NSNotificationCenter defaultCenter]; |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 | 371 |
371 // AVFoundation implementation of the Mac Device Monitor, registers as a global | 372 // AVFoundation implementation of the Mac Device Monitor, registers as a global |
372 // device connect/disconnect observer and plugs suspend/wake up device observers | 373 // device connect/disconnect observer and plugs suspend/wake up device observers |
373 // per device. This class is created and lives in UI thread. Owns a | 374 // per device. This class is created and lives in UI thread. Owns a |
374 // SuspendObserverDelegate that notifies when a device is suspended/resumed. | 375 // SuspendObserverDelegate that notifies when a device is suspended/resumed. |
375 class AVFoundationMonitorImpl : public DeviceMonitorMacImpl { | 376 class AVFoundationMonitorImpl : public DeviceMonitorMacImpl { |
376 public: | 377 public: |
377 AVFoundationMonitorImpl( | 378 AVFoundationMonitorImpl( |
378 content::DeviceMonitorMac* monitor, | 379 content::DeviceMonitorMac* monitor, |
379 const scoped_refptr<base::SingleThreadTaskRunner>& device_task_runner); | 380 const scoped_refptr<base::SingleThreadTaskRunner>& device_task_runner); |
380 virtual ~AVFoundationMonitorImpl(); | 381 ~AVFoundationMonitorImpl() override; |
381 | 382 |
382 virtual void OnDeviceChanged() override; | 383 void OnDeviceChanged() override; |
383 | 384 |
384 private: | 385 private: |
385 // {Video,AudioInput}DeviceManager's "Device" thread task runner used for | 386 // {Video,AudioInput}DeviceManager's "Device" thread task runner used for |
386 // posting tasks to |suspend_observer_delegate_|; valid after | 387 // posting tasks to |suspend_observer_delegate_|; valid after |
387 // MediaStreamManager calls StartMonitoring(). | 388 // MediaStreamManager calls StartMonitoring(). |
388 const scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_; | 389 const scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_; |
389 | 390 |
390 scoped_refptr<SuspendObserverDelegate> suspend_observer_delegate_; | 391 scoped_refptr<SuspendObserverDelegate> suspend_observer_delegate_; |
391 | 392 |
392 DISALLOW_COPY_AND_ASSIGN(AVFoundationMonitorImpl); | 393 DISALLOW_COPY_AND_ASSIGN(AVFoundationMonitorImpl); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 } | 537 } |
537 | 538 |
538 void DeviceMonitorMac::NotifyDeviceChanged( | 539 void DeviceMonitorMac::NotifyDeviceChanged( |
539 base::SystemMonitor::DeviceType type) { | 540 base::SystemMonitor::DeviceType type) { |
540 DCHECK(thread_checker_.CalledOnValidThread()); | 541 DCHECK(thread_checker_.CalledOnValidThread()); |
541 // TODO(xians): Remove the global variable for SystemMonitor. | 542 // TODO(xians): Remove the global variable for SystemMonitor. |
542 base::SystemMonitor::Get()->ProcessDevicesChanged(type); | 543 base::SystemMonitor::Get()->ProcessDevicesChanged(type); |
543 } | 544 } |
544 | 545 |
545 } // namespace content | 546 } // namespace content |
OLD | NEW |