OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extensions/api/audio/audio_service.h" | 5 #include "chrome/browser/extensions/api/audio/audio_service.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
11 #include "base/threading/thread_checker.h" | 11 #include "base/threading/thread_checker.h" |
12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
13 | 13 |
14 using content::BrowserThread; | 14 using content::BrowserThread; |
15 | 15 |
16 namespace extensions { | 16 namespace extensions { |
17 | 17 |
18 using api::audio::OutputDeviceInfo; | 18 using api::audio::OutputDeviceInfo; |
19 using api::audio::InputDeviceInfo; | 19 using api::audio::InputDeviceInfo; |
20 | 20 |
21 class AudioServiceImpl : public AudioService { | 21 class AudioServiceImpl : public AudioService { |
22 public: | 22 public: |
23 AudioServiceImpl(); | 23 AudioServiceImpl(); |
24 virtual ~AudioServiceImpl(); | 24 virtual ~AudioServiceImpl(); |
25 | 25 |
26 private: | 26 private: |
27 // Called by listeners to this service to add/remove themselves as observers. | 27 // Called by listeners to this service to add/remove themselves as observers. |
28 virtual void AddObserver(AudioService::Observer* observer) OVERRIDE; | 28 virtual void AddObserver(AudioService::Observer* observer) override; |
29 virtual void RemoveObserver(AudioService::Observer* observer) OVERRIDE; | 29 virtual void RemoveObserver(AudioService::Observer* observer) override; |
30 | 30 |
31 // Start to query audio device information. | 31 // Start to query audio device information. |
32 virtual void StartGetInfo(const GetInfoCallback& callback) OVERRIDE; | 32 virtual void StartGetInfo(const GetInfoCallback& callback) override; |
33 virtual void SetActiveDevices(const DeviceIdList& device_list) OVERRIDE; | 33 virtual void SetActiveDevices(const DeviceIdList& device_list) override; |
34 virtual bool SetDeviceProperties(const std::string& device_id, | 34 virtual bool SetDeviceProperties(const std::string& device_id, |
35 bool muted, | 35 bool muted, |
36 int volume, | 36 int volume, |
37 int gain) OVERRIDE; | 37 int gain) override; |
38 | 38 |
39 // List of observers. | 39 // List of observers. |
40 ObserverList<AudioService::Observer> observer_list_; | 40 ObserverList<AudioService::Observer> observer_list_; |
41 | 41 |
42 base::ThreadChecker thread_checker_; | 42 base::ThreadChecker thread_checker_; |
43 | 43 |
44 // Note: This should remain the last member so it'll be destroyed and | 44 // Note: This should remain the last member so it'll be destroyed and |
45 // invalidate the weak pointers before any other members are destroyed. | 45 // invalidate the weak pointers before any other members are destroyed. |
46 base::WeakPtrFactory<AudioServiceImpl> weak_ptr_factory_; | 46 base::WeakPtrFactory<AudioServiceImpl> weak_ptr_factory_; |
47 | 47 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 int gain) { | 82 int gain) { |
83 DCHECK(thread_checker_.CalledOnValidThread()); | 83 DCHECK(thread_checker_.CalledOnValidThread()); |
84 return false; | 84 return false; |
85 } | 85 } |
86 | 86 |
87 AudioService* AudioService::CreateInstance() { | 87 AudioService* AudioService::CreateInstance() { |
88 return new AudioServiceImpl; | 88 return new AudioServiceImpl; |
89 } | 89 } |
90 | 90 |
91 } // namespace extensions | 91 } // namespace extensions |
OLD | NEW |