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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } | 113 } |
114 InstanceHolder<mojom::PolicyInstance>* policy() { return &policy_; } | 114 InstanceHolder<mojom::PolicyInstance>* policy() { return &policy_; } |
115 InstanceHolder<mojom::PowerInstance>* power() { return &power_; } | 115 InstanceHolder<mojom::PowerInstance>* power() { return &power_; } |
116 InstanceHolder<mojom::PrintInstance>* print() { return &print_; } | 116 InstanceHolder<mojom::PrintInstance>* print() { return &print_; } |
117 InstanceHolder<mojom::ProcessInstance>* process() { return &process_; } | 117 InstanceHolder<mojom::ProcessInstance>* process() { return &process_; } |
118 InstanceHolder<mojom::StorageManagerInstance>* storage_manager() { | 118 InstanceHolder<mojom::StorageManagerInstance>* storage_manager() { |
119 return &storage_manager_; | 119 return &storage_manager_; |
120 } | 120 } |
121 InstanceHolder<mojom::TtsInstance>* tts() { return &tts_; } | 121 InstanceHolder<mojom::TtsInstance>* tts() { return &tts_; } |
122 InstanceHolder<mojom::VideoInstance>* video() { return &video_; } | 122 InstanceHolder<mojom::VideoInstance>* video() { return &video_; } |
123 InstanceHolder<mojom::WallpaperInstance>* wallpaper() { return &wallpaper_; } | |
124 | 123 |
125 // Gets if ARC is currently running. | 124 // Gets if ARC is currently running. |
126 bool ready() const { return state() == State::READY; } | 125 bool ready() const { return state() == State::READY; } |
127 | 126 |
128 // Gets if ARC is currently stopped. This is not exactly !ready() since there | 127 // Gets if ARC is currently stopped. This is not exactly !ready() since there |
129 // are transient states between ready() and stopped(). | 128 // are transient states between ready() and stopped(). |
130 bool stopped() const { return state() == State::STOPPED; } | 129 bool stopped() const { return state() == State::STOPPED; } |
131 | 130 |
132 protected: | 131 protected: |
133 // The possible states of the bridge. In the normal flow, the state changes | 132 // The possible states of the bridge. In the normal flow, the state changes |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 InstanceHolder<mojom::NetInstance> net_; | 181 InstanceHolder<mojom::NetInstance> net_; |
183 InstanceHolder<mojom::NotificationsInstance> notifications_; | 182 InstanceHolder<mojom::NotificationsInstance> notifications_; |
184 InstanceHolder<mojom::ObbMounterInstance> obb_mounter_; | 183 InstanceHolder<mojom::ObbMounterInstance> obb_mounter_; |
185 InstanceHolder<mojom::PolicyInstance> policy_; | 184 InstanceHolder<mojom::PolicyInstance> policy_; |
186 InstanceHolder<mojom::PowerInstance> power_; | 185 InstanceHolder<mojom::PowerInstance> power_; |
187 InstanceHolder<mojom::PrintInstance> print_; | 186 InstanceHolder<mojom::PrintInstance> print_; |
188 InstanceHolder<mojom::ProcessInstance> process_; | 187 InstanceHolder<mojom::ProcessInstance> process_; |
189 InstanceHolder<mojom::StorageManagerInstance> storage_manager_; | 188 InstanceHolder<mojom::StorageManagerInstance> storage_manager_; |
190 InstanceHolder<mojom::TtsInstance> tts_; | 189 InstanceHolder<mojom::TtsInstance> tts_; |
191 InstanceHolder<mojom::VideoInstance> video_; | 190 InstanceHolder<mojom::VideoInstance> video_; |
192 InstanceHolder<mojom::WallpaperInstance> wallpaper_; | |
193 | 191 |
194 // Gets the current state of the bridge service. | 192 // Gets the current state of the bridge service. |
195 State state() const { return state_; } | 193 State state() const { return state_; } |
196 | 194 |
197 // Changes the current state and notifies all observers. | 195 // Changes the current state and notifies all observers. |
198 void SetState(State state); | 196 void SetState(State state); |
199 | 197 |
200 // Sets the reason the bridge is stopped. This function must be always called | 198 // Sets the reason the bridge is stopped. This function must be always called |
201 // before SetState(State::STOPPED) to report a correct reason with | 199 // before SetState(State::STOPPED) to report a correct reason with |
202 // Observer::OnBridgeStopped(). | 200 // Observer::OnBridgeStopped(). |
(...skipping 23 matching lines...) Expand all Loading... |
226 | 224 |
227 // WeakPtrFactory to use callbacks. | 225 // WeakPtrFactory to use callbacks. |
228 base::WeakPtrFactory<ArcBridgeService> weak_factory_; | 226 base::WeakPtrFactory<ArcBridgeService> weak_factory_; |
229 | 227 |
230 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService); | 228 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService); |
231 }; | 229 }; |
232 | 230 |
233 } // namespace arc | 231 } // namespace arc |
234 | 232 |
235 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ | 233 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ |
OLD | NEW |