| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef CHROMEOS_AUDIO_CRAS_AUDIO_HANDLER_H_ | 5 #ifndef CHROMEOS_AUDIO_CRAS_AUDIO_HANDLER_H_ |
| 6 #define CHROMEOS_AUDIO_CRAS_AUDIO_HANDLER_H_ | 6 #define CHROMEOS_AUDIO_CRAS_AUDIO_HANDLER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <queue> | 10 #include <queue> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
| 17 #include "chromeos/audio/audio_device.h" | 17 #include "chromeos/audio/audio_device.h" |
| 18 #include "chromeos/audio/audio_devices_pref_handler.h" | 18 #include "chromeos/audio/audio_devices_pref_handler.h" |
| 19 #include "chromeos/audio/audio_pref_observer.h" | 19 #include "chromeos/audio/audio_pref_observer.h" |
| 20 #include "chromeos/dbus/audio_node.h" | 20 #include "chromeos/dbus/audio_node.h" |
| 21 #include "chromeos/dbus/cras_audio_client.h" | 21 #include "chromeos/dbus/cras_audio_client.h" |
| 22 #include "chromeos/dbus/session_manager_client.h" | 22 #include "chromeos/dbus/session_manager_client.h" |
| 23 #include "chromeos/dbus/volume_state.h" | 23 #include "chromeos/dbus/volume_state.h" |
| 24 #include "component/arc/video_facing.h" |
| 24 | 25 |
| 25 namespace chromeos { | 26 namespace chromeos { |
| 26 | 27 |
| 27 class AudioDevicesPrefHandler; | 28 class AudioDevicesPrefHandler; |
| 28 | 29 |
| 29 class CHROMEOS_EXPORT CrasAudioHandler : public CrasAudioClient::Observer, | 30 class CHROMEOS_EXPORT CrasAudioHandler : public CrasAudioClient::Observer, |
| 30 public AudioPrefObserver, | 31 public AudioPrefObserver, |
| 31 public SessionManagerClient::Observer { | 32 public SessionManagerClient::Observer, |
| 33 public component::VideoCaptureObserver
{ |
| 32 public: | 34 public: |
| 33 typedef std::priority_queue<AudioDevice, | 35 typedef std::priority_queue<AudioDevice, |
| 34 std::vector<AudioDevice>, | 36 std::vector<AudioDevice>, |
| 35 AudioDeviceCompare> AudioDevicePriorityQueue; | 37 AudioDeviceCompare> AudioDevicePriorityQueue; |
| 36 typedef std::vector<uint64_t> NodeIdList; | 38 typedef std::vector<uint64_t> NodeIdList; |
| 37 | 39 |
| 38 // Volume change reasons that are not user-initiated. | 40 // Volume change reasons that are not user-initiated. |
| 39 enum AutomatedVolumeChangeReason { | 41 enum AutomatedVolumeChangeReason { |
| 40 // Indicates it is from initializing audio state. | 42 // Indicates it is from initializing audio state. |
| 41 VOLUME_CHANGE_INITIALIZING_AUDIO_STATE, | 43 VOLUME_CHANGE_INITIALIZING_AUDIO_STATE, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 98 |
| 97 // Destroys the global instance. | 99 // Destroys the global instance. |
| 98 static void Shutdown(); | 100 static void Shutdown(); |
| 99 | 101 |
| 100 // Returns true if the global instance is initialized. | 102 // Returns true if the global instance is initialized. |
| 101 static bool IsInitialized(); | 103 static bool IsInitialized(); |
| 102 | 104 |
| 103 // Gets the global instance. Initialize must be called first. | 105 // Gets the global instance. Initialize must be called first. |
| 104 static CrasAudioHandler* Get(); | 106 static CrasAudioHandler* Get(); |
| 105 | 107 |
| 108 void OnVideoCaptureStarted(component::VideoFacingMode facing) override; |
| 109 void OnVideoCaptureStopped(component::VideoFacingMode facing) override; |
| 110 |
| 106 // Adds an audio observer. | 111 // Adds an audio observer. |
| 107 virtual void AddAudioObserver(AudioObserver* observer); | 112 virtual void AddAudioObserver(AudioObserver* observer); |
| 108 | 113 |
| 109 // Removes an audio observer. | 114 // Removes an audio observer. |
| 110 virtual void RemoveAudioObserver(AudioObserver* observer); | 115 virtual void RemoveAudioObserver(AudioObserver* observer); |
| 111 | 116 |
| 112 // Returns true if keyboard mic exists. | 117 // Returns true if keyboard mic exists. |
| 113 virtual bool HasKeyboardMic(); | 118 virtual bool HasKeyboardMic(); |
| 114 | 119 |
| 115 // Returns true if audio output is muted for the system. | 120 // Returns true if audio output is muted for the system. |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 uint64_t init_node_id_; | 466 uint64_t init_node_id_; |
| 462 | 467 |
| 463 base::WeakPtrFactory<CrasAudioHandler> weak_ptr_factory_; | 468 base::WeakPtrFactory<CrasAudioHandler> weak_ptr_factory_; |
| 464 | 469 |
| 465 DISALLOW_COPY_AND_ASSIGN(CrasAudioHandler); | 470 DISALLOW_COPY_AND_ASSIGN(CrasAudioHandler); |
| 466 }; | 471 }; |
| 467 | 472 |
| 468 } // namespace chromeos | 473 } // namespace chromeos |
| 469 | 474 |
| 470 #endif // CHROMEOS_AUDIO_CRAS_AUDIO_HANDLER_H_ | 475 #endif // CHROMEOS_AUDIO_CRAS_AUDIO_HANDLER_H_ |
| OLD | NEW |