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 <iosfwd> | 8 #include <iosfwd> |
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" | |
14 #include "base/macros.h" | 13 #include "base/macros.h" |
15 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
16 #include "base/values.h" | 15 #include "base/values.h" |
17 #include "components/arc/arc_session_observer.h" | 16 #include "components/arc/arc_session_observer.h" |
18 #include "components/arc/instance_holder.h" | 17 #include "components/arc/instance_holder.h" |
19 | 18 |
20 namespace base { | 19 namespace base { |
21 class CommandLine; | 20 class CommandLine; |
22 } // namespace base | 21 } // namespace base |
23 | 22 |
24 namespace arc { | 23 namespace arc { |
25 | |
26 class ArcBridgeTest; | |
27 | |
28 namespace mojom { | 24 namespace mojom { |
29 | 25 |
30 // Instead of including components/arc/common/arc_bridge.mojom.h, list all the | 26 // Instead of including components/arc/common/arc_bridge.mojom.h, list all the |
31 // instance classes here for faster build. | 27 // instance classes here for faster build. |
32 class AppInstance; | 28 class AppInstance; |
33 class AudioInstance; | 29 class AudioInstance; |
34 class AuthInstance; | 30 class AuthInstance; |
35 class BluetoothInstance; | 31 class BluetoothInstance; |
36 class BootPhaseMonitorInstance; | 32 class BootPhaseMonitorInstance; |
37 class ClipboardInstance; | 33 class ClipboardInstance; |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 // Observer::OnBridgeStopped(). | 210 // Observer::OnBridgeStopped(). |
215 void SetStopReason(ArcSessionObserver::StopReason stop_reason); | 211 void SetStopReason(ArcSessionObserver::StopReason stop_reason); |
216 | 212 |
217 base::ObserverList<ArcSessionObserver>& observer_list() { | 213 base::ObserverList<ArcSessionObserver>& observer_list() { |
218 return observer_list_; | 214 return observer_list_; |
219 } | 215 } |
220 | 216 |
221 bool CalledOnValidThread(); | 217 bool CalledOnValidThread(); |
222 | 218 |
223 private: | 219 private: |
224 friend class ArcBridgeTest; | |
225 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Basic); | |
226 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Prerequisites); | |
227 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, StopMidStartup); | |
228 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Restart); | |
229 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, OnBridgeStopped); | |
230 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Shutdown); | |
231 | |
232 base::ObserverList<ArcSessionObserver> observer_list_; | 220 base::ObserverList<ArcSessionObserver> observer_list_; |
233 | 221 |
234 base::ThreadChecker thread_checker_; | 222 base::ThreadChecker thread_checker_; |
235 | 223 |
236 // The current state of the bridge. | 224 // The current state of the bridge. |
237 ArcBridgeService::State state_; | 225 ArcBridgeService::State state_; |
238 | 226 |
239 // The reason the bridge is stopped. | 227 // The reason the bridge is stopped. |
240 ArcSessionObserver::StopReason stop_reason_; | 228 ArcSessionObserver::StopReason stop_reason_; |
241 | 229 |
242 // WeakPtrFactory to use callbacks. | 230 // WeakPtrFactory to use callbacks. |
243 base::WeakPtrFactory<ArcBridgeService> weak_factory_; | 231 base::WeakPtrFactory<ArcBridgeService> weak_factory_; |
244 | 232 |
245 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService); | 233 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService); |
246 }; | 234 }; |
247 | 235 |
248 } // namespace arc | 236 } // namespace arc |
249 | 237 |
250 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ | 238 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ |
OLD | NEW |