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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 virtual ~QTKitMonitorImpl(); |
140 | 140 |
141 virtual void OnDeviceChanged() OVERRIDE; | 141 virtual void OnDeviceChanged() override; |
142 private: | 142 private: |
143 void CountDevices(); | 143 void CountDevices(); |
144 void OnAttributeChanged(NSNotification* notification); | 144 void OnAttributeChanged(NSNotification* notification); |
145 | 145 |
146 id device_change_; | 146 id device_change_; |
147 }; | 147 }; |
148 | 148 |
149 QTKitMonitorImpl::QTKitMonitorImpl(content::DeviceMonitorMac* monitor) | 149 QTKitMonitorImpl::QTKitMonitorImpl(content::DeviceMonitorMac* monitor) |
150 : DeviceMonitorMacImpl(monitor) { | 150 : DeviceMonitorMacImpl(monitor) { |
151 NSNotificationCenter* nc = [NSNotificationCenter defaultCenter]; | 151 NSNotificationCenter* nc = [NSNotificationCenter defaultCenter]; |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 // device connect/disconnect observer and plugs suspend/wake up device observers | 372 // 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 | 373 // per device. This class is created and lives in UI thread. Owns a |
374 // SuspendObserverDelegate that notifies when a device is suspended/resumed. | 374 // SuspendObserverDelegate that notifies when a device is suspended/resumed. |
375 class AVFoundationMonitorImpl : public DeviceMonitorMacImpl { | 375 class AVFoundationMonitorImpl : public DeviceMonitorMacImpl { |
376 public: | 376 public: |
377 AVFoundationMonitorImpl( | 377 AVFoundationMonitorImpl( |
378 content::DeviceMonitorMac* monitor, | 378 content::DeviceMonitorMac* monitor, |
379 const scoped_refptr<base::SingleThreadTaskRunner>& device_task_runner); | 379 const scoped_refptr<base::SingleThreadTaskRunner>& device_task_runner); |
380 virtual ~AVFoundationMonitorImpl(); | 380 virtual ~AVFoundationMonitorImpl(); |
381 | 381 |
382 virtual void OnDeviceChanged() OVERRIDE; | 382 virtual void OnDeviceChanged() override; |
383 | 383 |
384 private: | 384 private: |
385 // {Video,AudioInput}DeviceManager's "Device" thread task runner used for | 385 // {Video,AudioInput}DeviceManager's "Device" thread task runner used for |
386 // posting tasks to |suspend_observer_delegate_|; valid after | 386 // posting tasks to |suspend_observer_delegate_|; valid after |
387 // MediaStreamManager calls StartMonitoring(). | 387 // MediaStreamManager calls StartMonitoring(). |
388 const scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_; | 388 const scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_; |
389 | 389 |
390 scoped_refptr<SuspendObserverDelegate> suspend_observer_delegate_; | 390 scoped_refptr<SuspendObserverDelegate> suspend_observer_delegate_; |
391 | 391 |
392 DISALLOW_COPY_AND_ASSIGN(AVFoundationMonitorImpl); | 392 DISALLOW_COPY_AND_ASSIGN(AVFoundationMonitorImpl); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 } | 536 } |
537 | 537 |
538 void DeviceMonitorMac::NotifyDeviceChanged( | 538 void DeviceMonitorMac::NotifyDeviceChanged( |
539 base::SystemMonitor::DeviceType type) { | 539 base::SystemMonitor::DeviceType type) { |
540 DCHECK(thread_checker_.CalledOnValidThread()); | 540 DCHECK(thread_checker_.CalledOnValidThread()); |
541 // TODO(xians): Remove the global variable for SystemMonitor. | 541 // TODO(xians): Remove the global variable for SystemMonitor. |
542 base::SystemMonitor::Get()->ProcessDevicesChanged(type); | 542 base::SystemMonitor::Get()->ProcessDevicesChanged(type); |
543 } | 543 } |
544 | 544 |
545 } // namespace content | 545 } // namespace content |
OLD | NEW |