Index: chromeos/audio/cras_audio_handler.h |
diff --git a/chromeos/audio/cras_audio_handler.h b/chromeos/audio/cras_audio_handler.h |
index 633e30a33a7a2d5d9b4729f747479f23c668b79c..704b9c15088eaa34bf2bcd4828234b3a7699d644 100644 |
--- a/chromeos/audio/cras_audio_handler.h |
+++ b/chromeos/audio/cras_audio_handler.h |
@@ -21,6 +21,11 @@ |
class PrefRegistrySimple; |
class PrefService; |
+namespace media { |
+ |
Daniel Erat
2015/06/23 14:15:49
nit: delete extra blank line here
cychiang
2015/06/24 08:11:29
Done.
|
+class AudioManager; |
+} |
+ |
namespace chromeos { |
class AudioDevicesPrefHandler; |
@@ -63,6 +68,25 @@ class CHROMEOS_EXPORT CrasAudioHandler : public CrasAudioClient::Observer, |
DISALLOW_COPY_AND_ASSIGN(AudioObserver); |
}; |
+ // The wrapper for audio manager methods to be called from this class. |
+ // The detail of AudioManager is hidden from CrasAudioHandler. |
+ class AudioManagerWrapper { |
+ public: |
+ virtual ~AudioManagerWrapper(); |
+ virtual void SetHasInputDevices(bool has_input_devices) = 0; |
+ |
+ protected: |
+ AudioManagerWrapper(); |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(AudioManagerWrapper); |
+ }; |
+ |
+ // Set audio manager wrapper for test. Must be called before Initialize |
+ // for testing. CrasAudioHandler will delete this pointer at Shutdown. |
+ static void SetUpAudioManagerWrapperForTesting( |
+ CrasAudioHandler::AudioManagerWrapper* test_wrapper); |
Daniel Erat
2015/06/23 14:15:49
pass scoped_ptr<CrasAudioHandler::AudioManagerWrap
|
+ |
// Sets the global instance. Must be called before any calls to Get(). |
static void Initialize( |
scoped_refptr<AudioDevicesPrefHandler> audio_pref_handler); |
@@ -196,6 +220,16 @@ class CHROMEOS_EXPORT CrasAudioHandler : public CrasAudioClient::Observer, |
private: |
friend class CrasAudioHandlerTest; |
+ class AudioManagerWrapperImpl : public AudioManagerWrapper { |
+ public: |
+ AudioManagerWrapperImpl(); |
+ ~AudioManagerWrapperImpl() override; |
+ void SetHasInputDevices(bool has_input_devices) override; |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(AudioManagerWrapperImpl); |
+ }; |
+ |
// CrasAudioClient::Observer overrides. |
void AudioClientRestarted() override; |
void NodesChanged() override; |
@@ -281,6 +315,12 @@ class CHROMEOS_EXPORT CrasAudioHandler : public CrasAudioClient::Observer, |
void HandleGetNodesError(const std::string& error_name, |
const std::string& error_msg); |
+ // Sets HasInputDevice in AudioManager based on the updated device list. |
+ void UpdateAudioManagerHasInputDevices(); |
+ |
+ // Sets HasInputDevice in AudioManager to true or false. |
+ void SetAudioManagerHasInputDevices(bool has_input_devices); |
+ |
// Adds an active node. |
// If there is no active node, |node_id| will be switched to become the |
// primary active node. Otherwise, it will be added as an additional active |