| 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_H_ | 5 #ifndef COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ |
| 6 #define COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ | 6 #define COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 class PowerInstance; | 41 class PowerInstance; |
| 42 class PrintInstance; | 42 class PrintInstance; |
| 43 class ProcessInstance; | 43 class ProcessInstance; |
| 44 class StorageManagerInstance; | 44 class StorageManagerInstance; |
| 45 class TtsInstance; | 45 class TtsInstance; |
| 46 class VideoInstance; | 46 class VideoInstance; |
| 47 class WallpaperInstance; | 47 class WallpaperInstance; |
| 48 | 48 |
| 49 } // namespace mojom | 49 } // namespace mojom |
| 50 | 50 |
| 51 class ArcSessionObserver; | 51 // Holds Mojo channels which proxy to ARC side implementation. The actual |
| 52 class ArcSessionRunner; | 52 // instances are set/removed via ArcBridgeHostImpl. |
| 53 | |
| 54 // The Chrome-side service that handles ARC instances and ARC bridge creation. | |
| 55 // This service handles the lifetime of ARC instances and sets up the | |
| 56 // communication channel (the ARC bridge) used to send and receive messages. | |
| 57 class ArcBridgeService { | 53 class ArcBridgeService { |
| 58 public: | 54 public: |
| 59 ArcBridgeService(); | 55 ArcBridgeService(); |
| 60 virtual ~ArcBridgeService(); | 56 ~ArcBridgeService(); |
| 61 | 57 |
| 62 // Return true if ARC has been enabled through a commandline | 58 // Returns true if ARC has been enabled through a commandline switch. |
| 63 // switch. | |
| 64 static bool GetEnabled(const base::CommandLine* command_line); | 59 static bool GetEnabled(const base::CommandLine* command_line); |
| 65 | 60 |
| 66 // Return true if ARC is available on the current board. | 61 // Returns true if ARC is available on the current board. |
| 67 static bool GetAvailable(const base::CommandLine* command_line); | 62 static bool GetAvailable(const base::CommandLine* command_line); |
| 68 | 63 |
| 69 // Initializes the ArcSessionRunner with the given instance. | |
| 70 // This must be called before following proxy methods. | |
| 71 void InitializeArcSessionRunner( | |
| 72 std::unique_ptr<ArcSessionRunner> arc_session_runner); | |
| 73 | |
| 74 // Proxies the method to ArcSessionRunner. See details in the | |
| 75 // ArcSessionRunner's comment. | |
| 76 // TODO(hidehiko): Move the ownership from ArcBridgeService to | |
| 77 // ArcSessionManager, and remove these methods. | |
| 78 void AddObserver(ArcSessionObserver* observer); | |
| 79 void RemoveObserver(ArcSessionObserver* observer); | |
| 80 void RequestStart(); | |
| 81 void RequestStop(); | |
| 82 void OnShutdown(); | |
| 83 bool ready() const; | |
| 84 bool stopped() const; | |
| 85 | |
| 86 InstanceHolder<mojom::AppInstance>* app() { return &app_; } | 64 InstanceHolder<mojom::AppInstance>* app() { return &app_; } |
| 87 InstanceHolder<mojom::AudioInstance>* audio() { return &audio_; } | 65 InstanceHolder<mojom::AudioInstance>* audio() { return &audio_; } |
| 88 InstanceHolder<mojom::AuthInstance>* auth() { return &auth_; } | 66 InstanceHolder<mojom::AuthInstance>* auth() { return &auth_; } |
| 89 InstanceHolder<mojom::BluetoothInstance>* bluetooth() { return &bluetooth_; } | 67 InstanceHolder<mojom::BluetoothInstance>* bluetooth() { return &bluetooth_; } |
| 90 InstanceHolder<mojom::BootPhaseMonitorInstance>* boot_phase_monitor() { | 68 InstanceHolder<mojom::BootPhaseMonitorInstance>* boot_phase_monitor() { |
| 91 return &boot_phase_monitor_; | 69 return &boot_phase_monitor_; |
| 92 } | 70 } |
| 93 InstanceHolder<mojom::ClipboardInstance>* clipboard() { return &clipboard_; } | 71 InstanceHolder<mojom::ClipboardInstance>* clipboard() { return &clipboard_; } |
| 94 InstanceHolder<mojom::CrashCollectorInstance>* crash_collector() { | 72 InstanceHolder<mojom::CrashCollectorInstance>* crash_collector() { |
| 95 return &crash_collector_; | 73 return &crash_collector_; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 118 InstanceHolder<mojom::PrintInstance>* print() { return &print_; } | 96 InstanceHolder<mojom::PrintInstance>* print() { return &print_; } |
| 119 InstanceHolder<mojom::ProcessInstance>* process() { return &process_; } | 97 InstanceHolder<mojom::ProcessInstance>* process() { return &process_; } |
| 120 InstanceHolder<mojom::StorageManagerInstance>* storage_manager() { | 98 InstanceHolder<mojom::StorageManagerInstance>* storage_manager() { |
| 121 return &storage_manager_; | 99 return &storage_manager_; |
| 122 } | 100 } |
| 123 InstanceHolder<mojom::TtsInstance>* tts() { return &tts_; } | 101 InstanceHolder<mojom::TtsInstance>* tts() { return &tts_; } |
| 124 InstanceHolder<mojom::VideoInstance>* video() { return &video_; } | 102 InstanceHolder<mojom::VideoInstance>* video() { return &video_; } |
| 125 InstanceHolder<mojom::WallpaperInstance>* wallpaper() { return &wallpaper_; } | 103 InstanceHolder<mojom::WallpaperInstance>* wallpaper() { return &wallpaper_; } |
| 126 | 104 |
| 127 private: | 105 private: |
| 128 // Instance holders. | |
| 129 InstanceHolder<mojom::AppInstance> app_; | 106 InstanceHolder<mojom::AppInstance> app_; |
| 130 InstanceHolder<mojom::AudioInstance> audio_; | 107 InstanceHolder<mojom::AudioInstance> audio_; |
| 131 InstanceHolder<mojom::AuthInstance> auth_; | 108 InstanceHolder<mojom::AuthInstance> auth_; |
| 132 InstanceHolder<mojom::BluetoothInstance> bluetooth_; | 109 InstanceHolder<mojom::BluetoothInstance> bluetooth_; |
| 133 InstanceHolder<mojom::BootPhaseMonitorInstance> boot_phase_monitor_; | 110 InstanceHolder<mojom::BootPhaseMonitorInstance> boot_phase_monitor_; |
| 134 InstanceHolder<mojom::ClipboardInstance> clipboard_; | 111 InstanceHolder<mojom::ClipboardInstance> clipboard_; |
| 135 InstanceHolder<mojom::CrashCollectorInstance> crash_collector_; | 112 InstanceHolder<mojom::CrashCollectorInstance> crash_collector_; |
| 136 InstanceHolder<mojom::EnterpriseReportingInstance> enterprise_reporting_; | 113 InstanceHolder<mojom::EnterpriseReportingInstance> enterprise_reporting_; |
| 137 InstanceHolder<mojom::FileSystemInstance> file_system_; | 114 InstanceHolder<mojom::FileSystemInstance> file_system_; |
| 138 InstanceHolder<mojom::ImeInstance> ime_; | 115 InstanceHolder<mojom::ImeInstance> ime_; |
| 139 InstanceHolder<mojom::IntentHelperInstance> intent_helper_; | 116 InstanceHolder<mojom::IntentHelperInstance> intent_helper_; |
| 140 InstanceHolder<mojom::KioskInstance> kiosk_; | 117 InstanceHolder<mojom::KioskInstance> kiosk_; |
| 141 InstanceHolder<mojom::MetricsInstance> metrics_; | 118 InstanceHolder<mojom::MetricsInstance> metrics_; |
| 142 InstanceHolder<mojom::NetInstance> net_; | 119 InstanceHolder<mojom::NetInstance> net_; |
| 143 InstanceHolder<mojom::NotificationsInstance> notifications_; | 120 InstanceHolder<mojom::NotificationsInstance> notifications_; |
| 144 InstanceHolder<mojom::ObbMounterInstance> obb_mounter_; | 121 InstanceHolder<mojom::ObbMounterInstance> obb_mounter_; |
| 145 InstanceHolder<mojom::PolicyInstance> policy_; | 122 InstanceHolder<mojom::PolicyInstance> policy_; |
| 146 InstanceHolder<mojom::PowerInstance> power_; | 123 InstanceHolder<mojom::PowerInstance> power_; |
| 147 InstanceHolder<mojom::PrintInstance> print_; | 124 InstanceHolder<mojom::PrintInstance> print_; |
| 148 InstanceHolder<mojom::ProcessInstance> process_; | 125 InstanceHolder<mojom::ProcessInstance> process_; |
| 149 InstanceHolder<mojom::StorageManagerInstance> storage_manager_; | 126 InstanceHolder<mojom::StorageManagerInstance> storage_manager_; |
| 150 InstanceHolder<mojom::TtsInstance> tts_; | 127 InstanceHolder<mojom::TtsInstance> tts_; |
| 151 InstanceHolder<mojom::VideoInstance> video_; | 128 InstanceHolder<mojom::VideoInstance> video_; |
| 152 InstanceHolder<mojom::WallpaperInstance> wallpaper_; | 129 InstanceHolder<mojom::WallpaperInstance> wallpaper_; |
| 153 | 130 |
| 154 std::unique_ptr<ArcSessionRunner> arc_session_runner_; | |
| 155 | |
| 156 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService); | 131 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService); |
| 157 }; | 132 }; |
| 158 | 133 |
| 159 } // namespace arc | 134 } // namespace arc |
| 160 | 135 |
| 161 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ | 136 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ |
| OLD | NEW |