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 { |
29 public: | 30 public: |
30 explicit ArcBridgeServiceImpl(std::unique_ptr<ArcBridgeBootstrap> bootstrap); | 31 explicit ArcBridgeServiceImpl(std::unique_ptr<ArcBridgeBootstrap> bootstrap); |
31 ~ArcBridgeServiceImpl() override; | 32 ~ArcBridgeServiceImpl() override; |
32 | 33 |
33 void SetDetectedAvailability(bool available) override; | 34 void SetDetectedAvailability(bool available) override; |
34 | 35 |
35 void HandleStartup() override; | 36 void HandleStartup() override; |
36 | 37 |
37 void Shutdown() override; | 38 void Shutdown() override; |
38 | 39 |
39 // Normally, reconnecting after connection shutdown happens after a short | 40 // Normally, reconnecting after connection shutdown happens after a short |
40 // delay. When testing, however, we'd like it to happen immediately to avoid | 41 // delay. When testing, however, we'd like it to happen immediately to avoid |
41 // adding unnecessary delays. | 42 // adding unnecessary delays. |
42 void DisableReconnectDelayForTesting(); | 43 void DisableReconnectDelayForTesting(); |
43 | 44 |
| 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 |
44 private: | 75 private: |
45 friend class ArcBridgeTest; | 76 friend class ArcBridgeTest; |
46 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Restart); | 77 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Restart); |
47 | 78 |
48 // If all pre-requisites are true (ARC is available, it has been enabled, and | 79 // If all pre-requisites are true (ARC is available, it has been enabled, and |
49 // the session has started), and ARC is stopped, start ARC. If ARC is running | 80 // the session has started), and ARC is stopped, start ARC. If ARC is running |
50 // and the pre-requisites stop being true, stop ARC. | 81 // and the pre-requisites stop being true, stop ARC. |
51 void PrerequisitesChanged(); | 82 void PrerequisitesChanged(); |
52 | 83 |
53 // Stops the running instance. | 84 // Stops the running instance. |
(...skipping 25 matching lines...) Expand all Loading... |
79 | 110 |
80 // WeakPtrFactory to use callbacks. | 111 // WeakPtrFactory to use callbacks. |
81 base::WeakPtrFactory<ArcBridgeServiceImpl> weak_factory_; | 112 base::WeakPtrFactory<ArcBridgeServiceImpl> weak_factory_; |
82 | 113 |
83 DISALLOW_COPY_AND_ASSIGN(ArcBridgeServiceImpl); | 114 DISALLOW_COPY_AND_ASSIGN(ArcBridgeServiceImpl); |
84 }; | 115 }; |
85 | 116 |
86 } // namespace arc | 117 } // namespace arc |
87 | 118 |
88 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ | 119 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ |
OLD | NEW |