OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_VOICE_INTERACTION_SERVICE_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_VOICE_INTERACTION_SERVICE_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "components/arc/arc_service.h" | |
10 #include "components/arc/common/voice_interaction.mojom.h" | |
11 #include "components/arc/instance_holder.h" | |
12 #include "mojo/public/cpp/bindings/binding.h" | |
13 #include "ui/base/accelerators/accelerator.h" | |
14 | |
15 namespace arc { | |
16 | |
17 class ArcVoiceInteractionService; | |
18 | |
19 class ArcHomeObserver | |
Luis Héctor Chávez
2017/03/08 15:22:40
This can be forward-declared in the private sectio
Muyuan
2017/03/09 00:41:03
Done.
| |
20 : public InstanceHolder<mojom::VoiceInteractionArcHomeInstance>::Observer { | |
21 ArcVoiceInteractionService* service_; | |
22 | |
23 public: | |
Luis Héctor Chávez
2017/03/08 15:22:40
in Chromium/Google, the order is public, protected
Muyuan
2017/03/09 00:41:03
Done.
| |
24 explicit ArcHomeObserver(ArcVoiceInteractionService* service) | |
25 : service_(service) {} | |
26 void OnInstanceReady() override; | |
27 void OnInstanceClosed() override; | |
28 | |
29 DISALLOW_COPY_AND_ASSIGN(ArcHomeObserver); | |
30 }; | |
31 | |
32 class CaptureObserver | |
33 : public InstanceHolder<mojom::VoiceInteractionCaptureInstance>::Observer { | |
34 ArcVoiceInteractionService* service_; | |
35 | |
36 public: | |
37 explicit CaptureObserver(ArcVoiceInteractionService* service) | |
38 : service_(service) {} | |
39 void OnInstanceReady() override; | |
40 void OnInstanceClosed() override; | |
41 | |
42 DISALLOW_COPY_AND_ASSIGN(CaptureObserver); | |
43 }; | |
44 | |
45 // Lives on the UI thread. | |
46 class ArcVoiceInteractionService : public ArcService, | |
47 public mojom::VoiceInteractionHost, | |
48 public ui::AcceleratorTarget { | |
49 public: | |
50 explicit ArcVoiceInteractionService(ArcBridgeService* bridge_service); | |
51 ~ArcVoiceInteractionService() override; | |
52 | |
53 void OnCaptureInstanceReady(); | |
54 void OnCaptureInstanceClosed(); | |
55 | |
56 void OnArcHomeInstanceReady(); | |
57 void OnArcHomeInstanceClosed(); | |
58 | |
59 // ui::AcceleratorTarget overrides. | |
60 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; | |
61 bool CanHandleAccelerators() const override; | |
62 | |
63 // mojom::VoiceInteractionHost overrides. | |
64 void GetVoiceInteractionStructure( | |
65 const GetVoiceInteractionStructureCallback& callback) override; | |
66 void CaptureFocusedWindow( | |
67 const CaptureFocusedWindowCallback& callback) override; | |
68 | |
69 private: | |
70 std::unique_ptr<ArcHomeObserver> home_observer_; | |
71 std::unique_ptr<CaptureObserver> capture_observer_; | |
72 | |
73 mojo::Binding<mojom::VoiceInteractionHost> home_binding_; | |
74 mojo::Binding<mojom::VoiceInteractionHost> capture_binding_; | |
75 | |
76 DISALLOW_COPY_AND_ASSIGN(ArcVoiceInteractionService); | |
77 }; | |
78 | |
79 } // namespace arc | |
80 | |
81 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_VOICE_INTERACTION_SERVICE_H_ | |
OLD | NEW |