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_DBUS_FAKE_CRAS_AUDIO_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_FAKE_CRAS_AUDIO_CLIENT_H_ |
6 #define CHROMEOS_DBUS_FAKE_CRAS_AUDIO_CLIENT_H_ | 6 #define CHROMEOS_DBUS_FAKE_CRAS_AUDIO_CLIENT_H_ |
7 | 7 |
8 #include "chromeos/chromeos_export.h" | 8 #include "chromeos/chromeos_export.h" |
9 #include "chromeos/dbus/cras_audio_client.h" | 9 #include "chromeos/dbus/cras_audio_client.h" |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 void SetInputNodeGain(uint64 node_id, int32 gain) override; | 31 void SetInputNodeGain(uint64 node_id, int32 gain) override; |
32 void SetInputMute(bool mute_on) override; | 32 void SetInputMute(bool mute_on) override; |
33 void SetActiveOutputNode(uint64 node_id) override; | 33 void SetActiveOutputNode(uint64 node_id) override; |
34 void SetActiveInputNode(uint64 node_id) override; | 34 void SetActiveInputNode(uint64 node_id) override; |
35 void AddActiveInputNode(uint64 node_id) override; | 35 void AddActiveInputNode(uint64 node_id) override; |
36 void RemoveActiveInputNode(uint64 node_id) override; | 36 void RemoveActiveInputNode(uint64 node_id) override; |
37 void AddActiveOutputNode(uint64 node_id) override; | 37 void AddActiveOutputNode(uint64 node_id) override; |
38 void RemoveActiveOutputNode(uint64 node_id) override; | 38 void RemoveActiveOutputNode(uint64 node_id) override; |
39 void SwapLeftRight(uint64 node_id, bool swap) override; | 39 void SwapLeftRight(uint64 node_id, bool swap) override; |
40 | 40 |
| 41 // Modifies an AudioNode from |node_list_| based on |audio_node.id|. |
| 42 // if the |audio_node.id| cannot be found in list, Add an |
| 43 // AudioNode to |node_list_| |
| 44 void InsertAudioNodeToList(const AudioNode& audio_node); |
| 45 |
| 46 // Removes an AudioNode from |node_list_| based on |node_id|. |
| 47 void RemoveAudioNodeFromList(const uint64& node_id); |
| 48 |
41 // Updates |node_list_| to contain |audio_nodes|. | 49 // Updates |node_list_| to contain |audio_nodes|. |
42 void SetAudioNodesForTesting(const AudioNodeList& audio_nodes); | 50 void SetAudioNodesForTesting(const AudioNodeList& audio_nodes); |
43 | 51 |
44 // Calls SetAudioNodesForTesting() and additionally notifies |observers_|. | 52 // Calls SetAudioNodesForTesting() and additionally notifies |observers_|. |
45 void SetAudioNodesAndNotifyObserversForTesting( | 53 void SetAudioNodesAndNotifyObserversForTesting( |
46 const AudioNodeList& new_nodes); | 54 const AudioNodeList& new_nodes); |
47 | 55 |
| 56 const AudioNodeList& node_list() const { return node_list_; } |
| 57 const uint64& active_input_node_id() const { return active_input_node_id_; } |
| 58 const uint64& active_output_node_id() const { return active_output_node_id_; } |
| 59 |
48 private: | 60 private: |
| 61 // Find a node in the list based on the id. |
| 62 AudioNodeList::iterator FindNode(uint64 node_id); |
| 63 |
49 VolumeState volume_state_; | 64 VolumeState volume_state_; |
50 AudioNodeList node_list_; | 65 AudioNodeList node_list_; |
51 uint64 active_input_node_id_; | 66 uint64 active_input_node_id_; |
52 uint64 active_output_node_id_; | 67 uint64 active_output_node_id_; |
53 base::ObserverList<Observer> observers_; | 68 base::ObserverList<Observer> observers_; |
54 | 69 |
55 DISALLOW_COPY_AND_ASSIGN(FakeCrasAudioClient); | 70 DISALLOW_COPY_AND_ASSIGN(FakeCrasAudioClient); |
56 }; | 71 }; |
57 | 72 |
58 } // namespace chromeos | 73 } // namespace chromeos |
59 | 74 |
60 #endif // CHROMEOS_DBUS_FAKE_CRAS_AUDIO_CLIENT_H_ | 75 #endif // CHROMEOS_DBUS_FAKE_CRAS_AUDIO_CLIENT_H_ |
OLD | NEW |