OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ARC_BRIDGE_SERVICE_IMPL_H_ | 5 #ifndef COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ |
6 #define COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ | 6 #define COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/files/scoped_file.h" | 12 #include "base/files/scoped_file.h" |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "components/arc/arc_bridge_bootstrap.h" | 15 #include "components/arc/arc_bridge_bootstrap.h" |
16 #include "components/arc/arc_bridge_service.h" | 16 #include "components/arc/arc_bridge_service.h" |
17 #include "mojo/public/cpp/bindings/binding.h" | 17 #include "mojo/public/cpp/bindings/binding.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class SequencedTaskRunner; | 20 class SequencedTaskRunner; |
21 class SingleThreadTaskRunner; | 21 class SingleThreadTaskRunner; |
22 } // namespace base | 22 } // namespace base |
23 | 23 |
24 namespace arc { | 24 namespace arc { |
25 | 25 |
26 // Real IPC based ArcBridgeService that is used in production. | 26 // Real IPC based ArcBridgeService that is used in production. |
27 class ArcBridgeServiceImpl : public ArcBridgeService, | 27 class ArcBridgeServiceImpl : public ArcBridgeService, |
28 public ArcBridgeBootstrap::Delegate, | 28 public ArcBridgeBootstrap::Delegate { |
29 public mojom::ArcBridgeHost { | |
30 public: | 29 public: |
31 explicit ArcBridgeServiceImpl(std::unique_ptr<ArcBridgeBootstrap> bootstrap); | 30 explicit ArcBridgeServiceImpl(std::unique_ptr<ArcBridgeBootstrap> bootstrap); |
32 ~ArcBridgeServiceImpl() override; | 31 ~ArcBridgeServiceImpl() override; |
33 | 32 |
34 void SetDetectedAvailability(bool available) override; | 33 void SetDetectedAvailability(bool available) override; |
35 | 34 |
36 void HandleStartup() override; | 35 void HandleStartup() override; |
37 | 36 |
38 void Shutdown() override; | 37 void Shutdown() override; |
39 | 38 |
40 // Normally, reconnecting after connection shutdown happens after a short | 39 // Normally, reconnecting after connection shutdown happens after a short |
41 // delay. When testing, however, we'd like it to happen immediately to avoid | 40 // delay. When testing, however, we'd like it to happen immediately to avoid |
42 // adding unnecessary delays. | 41 // adding unnecessary delays. |
43 void DisableReconnectDelayForTesting(); | 42 void DisableReconnectDelayForTesting(); |
44 | 43 |
45 // ArcHost: | |
46 void OnAppInstanceReady(mojom::AppInstancePtr app_ptr) override; | |
47 void OnAudioInstanceReady(mojom::AudioInstancePtr audio_ptr) override; | |
48 void OnAuthInstanceReady(mojom::AuthInstancePtr auth_ptr) override; | |
49 void OnBluetoothInstanceReady( | |
50 mojom::BluetoothInstancePtr bluetooth_ptr) override; | |
51 void OnClipboardInstanceReady( | |
52 mojom::ClipboardInstancePtr clipboard_ptr) override; | |
53 void OnCrashCollectorInstanceReady( | |
54 mojom::CrashCollectorInstancePtr crash_collector_ptr) override; | |
55 void OnFileSystemInstanceReady( | |
56 mojom::FileSystemInstancePtr file_system_ptr) override; | |
57 void OnImeInstanceReady(mojom::ImeInstancePtr ime_ptr) override; | |
58 void OnIntentHelperInstanceReady( | |
59 mojom::IntentHelperInstancePtr intent_helper_ptr) override; | |
60 void OnMetricsInstanceReady(mojom::MetricsInstancePtr metrics_ptr) override; | |
61 void OnNetInstanceReady(mojom::NetInstancePtr net_ptr) override; | |
62 void OnNotificationsInstanceReady( | |
63 mojom::NotificationsInstancePtr notifications_ptr) override; | |
64 void OnObbMounterInstanceReady( | |
65 mojom::ObbMounterInstancePtr obb_mounter_ptr) override; | |
66 void OnPolicyInstanceReady(mojom::PolicyInstancePtr policy_ptr) override; | |
67 void OnPowerInstanceReady(mojom::PowerInstancePtr power_ptr) override; | |
68 void OnProcessInstanceReady(mojom::ProcessInstancePtr process_ptr) override; | |
69 void OnStorageManagerInstanceReady( | |
70 mojom::StorageManagerInstancePtr storage_manager_ptr) override; | |
71 void OnVideoInstanceReady(mojom::VideoInstancePtr video_ptr) override; | |
72 void OnWindowManagerInstanceReady( | |
73 mojom::WindowManagerInstancePtr window_manager_ptr) override; | |
74 | |
75 private: | 44 private: |
76 friend class ArcBridgeTest; | 45 friend class ArcBridgeTest; |
77 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Restart); | 46 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Restart); |
78 | 47 |
79 // If all pre-requisites are true (ARC is available, it has been enabled, and | 48 // If all pre-requisites are true (ARC is available, it has been enabled, and |
80 // the session has started), and ARC is stopped, start ARC. If ARC is running | 49 // the session has started), and ARC is stopped, start ARC. If ARC is running |
81 // and the pre-requisites stop being true, stop ARC. | 50 // and the pre-requisites stop being true, stop ARC. |
82 void PrerequisitesChanged(); | 51 void PrerequisitesChanged(); |
83 | 52 |
84 // Stops the running instance. | 53 // Stops the running instance. |
(...skipping 25 matching lines...) Expand all Loading... |
110 | 79 |
111 // WeakPtrFactory to use callbacks. | 80 // WeakPtrFactory to use callbacks. |
112 base::WeakPtrFactory<ArcBridgeServiceImpl> weak_factory_; | 81 base::WeakPtrFactory<ArcBridgeServiceImpl> weak_factory_; |
113 | 82 |
114 DISALLOW_COPY_AND_ASSIGN(ArcBridgeServiceImpl); | 83 DISALLOW_COPY_AND_ASSIGN(ArcBridgeServiceImpl); |
115 }; | 84 }; |
116 | 85 |
117 } // namespace arc | 86 } // namespace arc |
118 | 87 |
119 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ | 88 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ |
OLD | NEW |