OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_ARC_AUDIO_ARC_AUDIO_BRIDGE_H_ | 5 #ifndef COMPONENTS_ARC_AUDIO_ARC_AUDIO_BRIDGE_H_ |
6 #define COMPONENTS_ARC_AUDIO_ARC_AUDIO_BRIDGE_H_ | 6 #define COMPONENTS_ARC_AUDIO_ARC_AUDIO_BRIDGE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "chromeos/audio/cras_audio_handler.h" | 11 #include "chromeos/audio/cras_audio_handler.h" |
12 #include "components/arc/arc_bridge_service.h" | 12 #include "components/arc/arc_bridge_service.h" |
13 #include "components/arc/arc_service.h" | 13 #include "components/arc/arc_service.h" |
| 14 #include "components/arc/instance_holder.h" |
14 #include "mojo/public/cpp/bindings/binding.h" | 15 #include "mojo/public/cpp/bindings/binding.h" |
15 | 16 |
16 namespace arc { | 17 namespace arc { |
17 | 18 |
18 class ArcAudioBridge : public ArcService, | 19 class ArcAudioBridge : public ArcService, |
19 public ArcBridgeService::Observer, | 20 public InstanceHolder<mojom::AudioInstance>::Observer, |
20 public mojom::AudioHost, | 21 public mojom::AudioHost, |
21 public chromeos::CrasAudioHandler::AudioObserver { | 22 public chromeos::CrasAudioHandler::AudioObserver { |
22 public: | 23 public: |
23 explicit ArcAudioBridge(ArcBridgeService* bridge_service); | 24 explicit ArcAudioBridge(ArcBridgeService* bridge_service); |
24 ~ArcAudioBridge() override; | 25 ~ArcAudioBridge() override; |
25 | 26 |
26 // ArcBridgeService::Observer overrides. | 27 // InstanceHolder<mojom::AudioInstance>::Observer overrides. |
27 void OnAudioInstanceReady() override; | 28 void OnInstanceReady(mojom::AudioInstance*, uint32_t version) override; |
28 | 29 |
29 // mojom::AudioHost overrides. | 30 // mojom::AudioHost overrides. |
30 void ShowVolumeControls() override; | 31 void ShowVolumeControls() override; |
31 | 32 |
32 private: | 33 private: |
33 mojo::Binding<mojom::AudioHost> binding_; | 34 mojo::Binding<mojom::AudioHost> binding_; |
34 | 35 |
35 chromeos::CrasAudioHandler* cras_audio_handler_ = nullptr; | 36 chromeos::CrasAudioHandler* cras_audio_handler_ = nullptr; |
36 | 37 |
37 // chromeos::CrasAudioHandler::AudioObserver overrides. | 38 // chromeos::CrasAudioHandler::AudioObserver overrides. |
38 void OnAudioNodesChanged() override; | 39 void OnAudioNodesChanged() override; |
39 | 40 |
40 void SendSwitchState(bool headphone_inserted, bool microphone_inserted); | 41 void SendSwitchState(bool headphone_inserted, bool microphone_inserted); |
41 | 42 |
42 DISALLOW_COPY_AND_ASSIGN(ArcAudioBridge); | 43 DISALLOW_COPY_AND_ASSIGN(ArcAudioBridge); |
43 }; | 44 }; |
44 | 45 |
45 } // namespace arc | 46 } // namespace arc |
46 | 47 |
47 #endif // COMPONENTS_ARC_AUDIO_ARC_AUDIO_BRIDGE_H_ | 48 #endif // COMPONENTS_ARC_AUDIO_ARC_AUDIO_BRIDGE_H_ |
OLD | NEW |