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 "chrome/browser/prefs/scoped_user_pref_update.h" | 7 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
8 #include "chrome/common/pref_names.h" | 8 #include "chrome/common/pref_names.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 #include "content/public/browser/media_devices_monitor.h" | 10 #include "content/public/browser/media_devices_monitor.h" |
11 #include "content/public/common/media_stream_request.h" | 11 #include "content/public/common/media_stream_request.h" |
12 | 12 |
13 using content::BrowserThread; | 13 using content::BrowserThread; |
14 using content::MediaStreamDevices; | 14 using content::MediaStreamDevices; |
15 | 15 |
16 MediaCaptureDevicesDispatcher::MediaCaptureDevicesDispatcher() | 16 MediaCaptureDevicesDispatcher::MediaCaptureDevicesDispatcher() |
17 : devices_enumerated_(false) {} | 17 : devices_enumerated_(false) {} |
18 | 18 |
19 MediaCaptureDevicesDispatcher::~MediaCaptureDevicesDispatcher() {} | 19 MediaCaptureDevicesDispatcher::~MediaCaptureDevicesDispatcher() {} |
20 | 20 |
21 void MediaCaptureDevicesDispatcher::RegisterUserPrefs(PrefService* user_prefs) { | 21 void MediaCaptureDevicesDispatcher::RegisterUserPrefs( |
| 22 PrefServiceSyncable* user_prefs) { |
22 if (!user_prefs->FindPreference(prefs::kDefaultAudioCaptureDevice)) { | 23 if (!user_prefs->FindPreference(prefs::kDefaultAudioCaptureDevice)) { |
23 user_prefs->RegisterStringPref(prefs::kDefaultAudioCaptureDevice, | 24 user_prefs->RegisterStringPref(prefs::kDefaultAudioCaptureDevice, |
24 std::string(), | 25 std::string(), |
25 PrefService::UNSYNCABLE_PREF); | 26 PrefServiceSyncable::UNSYNCABLE_PREF); |
26 } | 27 } |
27 if (!user_prefs->FindPreference(prefs::kDefaultVideoCaptureDevice)) { | 28 if (!user_prefs->FindPreference(prefs::kDefaultVideoCaptureDevice)) { |
28 user_prefs->RegisterStringPref(prefs::kDefaultVideoCaptureDevice, | 29 user_prefs->RegisterStringPref(prefs::kDefaultVideoCaptureDevice, |
29 std::string(), | 30 std::string(), |
30 PrefService::UNSYNCABLE_PREF); | 31 PrefServiceSyncable::UNSYNCABLE_PREF); |
31 } | 32 } |
32 } | 33 } |
33 | 34 |
34 void MediaCaptureDevicesDispatcher::AudioCaptureDevicesChanged( | 35 void MediaCaptureDevicesDispatcher::AudioCaptureDevicesChanged( |
35 const MediaStreamDevices& devices) { | 36 const MediaStreamDevices& devices) { |
36 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 37 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
37 | 38 |
38 BrowserThread::PostTask( | 39 BrowserThread::PostTask( |
39 BrowserThread::UI, FROM_HERE, | 40 BrowserThread::UI, FROM_HERE, |
40 base::Bind(&MediaCaptureDevicesDispatcher::UpdateAudioDevicesOnUIThread, | 41 base::Bind(&MediaCaptureDevicesDispatcher::UpdateAudioDevicesOnUIThread, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 } | 97 } |
97 | 98 |
98 void MediaCaptureDevicesDispatcher::UpdateVideoDevicesOnUIThread( | 99 void MediaCaptureDevicesDispatcher::UpdateVideoDevicesOnUIThread( |
99 const content::MediaStreamDevices& devices){ | 100 const content::MediaStreamDevices& devices){ |
100 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 101 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
101 devices_enumerated_ = true; | 102 devices_enumerated_ = true; |
102 video_devices_ = devices; | 103 video_devices_ = devices; |
103 FOR_EACH_OBSERVER(Observer, observers_, | 104 FOR_EACH_OBSERVER(Observer, observers_, |
104 OnUpdateVideoDevices(video_devices_)); | 105 OnUpdateVideoDevices(video_devices_)); |
105 } | 106 } |
OLD | NEW |