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 "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
11 #include "components/arc/common/arc_message_types.h" | 11 #include "components/arc/common/arc_message_types.h" |
12 #include "ipc/ipc_channel_proxy.h" | 12 #include "ipc/ipc_channel_proxy.h" |
13 #include "ipc/ipc_listener.h" | 13 #include "ipc/ipc_listener.h" |
14 #include "ipc/ipc_message.h" | 14 #include "ipc/ipc_message.h" |
15 | 15 |
| 16 namespace base { |
| 17 class CommandLine; |
| 18 } |
| 19 |
16 namespace arc { | 20 namespace arc { |
17 | 21 |
18 // The Chrome-side service that handles ARC instances and ARC bridge creation. | 22 // The Chrome-side service that handles ARC instances and ARC bridge creation. |
19 // This service handles the lifetime of ARC instances and sets up the | 23 // This service handles the lifetime of ARC instances and sets up the |
20 // communication channel (the ARC bridge) used to send and receive messages. | 24 // communication channel (the ARC bridge) used to send and receive messages. |
21 class ArcBridgeService : public IPC::Listener { | 25 class ArcBridgeService : public IPC::Listener { |
22 public: | 26 public: |
23 // The possible states of the bridge. In the normal flow, the state changes | 27 // The possible states of the bridge. In the normal flow, the state changes |
24 // in the following sequence: | 28 // in the following sequence: |
25 // | 29 // |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 81 |
78 ArcBridgeService( | 82 ArcBridgeService( |
79 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner, | 83 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner, |
80 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner); | 84 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner); |
81 ~ArcBridgeService() override; | 85 ~ArcBridgeService() override; |
82 | 86 |
83 // Gets the global instance of the ARC Bridge Service. This can only be | 87 // Gets the global instance of the ARC Bridge Service. This can only be |
84 // called on the thread that this class was created on. | 88 // called on the thread that this class was created on. |
85 static ArcBridgeService* Get(); | 89 static ArcBridgeService* Get(); |
86 | 90 |
| 91 // Return true if ARC has been enabled through a commandline |
| 92 // switch. |
| 93 static bool GetEnabled(const base::CommandLine* command_line); |
| 94 |
87 // DetectAvailability() should be called once D-Bus is available. It will | 95 // DetectAvailability() should be called once D-Bus is available. It will |
88 // call CheckArcAvailability() on the session_manager. This can only be | 96 // call CheckArcAvailability() on the session_manager. This can only be |
89 // called on the thread that this class was created on. | 97 // called on the thread that this class was created on. |
90 void DetectAvailability(); | 98 void DetectAvailability(); |
91 | 99 |
92 // HandleStartup() should be called upon profile startup. This will only | 100 // HandleStartup() should be called upon profile startup. This will only |
93 // launch an instance if the instance service is available and it is enabled. | 101 // launch an instance if the instance service is available and it is enabled. |
94 // This can only be called on the thread that this class was created on. | 102 // This can only be called on the thread that this class was created on. |
95 void HandleStartup(); | 103 void HandleStartup(); |
96 | 104 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 189 |
182 // WeakPtrFactory to use callbacks. | 190 // WeakPtrFactory to use callbacks. |
183 base::WeakPtrFactory<ArcBridgeService> weak_factory_; | 191 base::WeakPtrFactory<ArcBridgeService> weak_factory_; |
184 | 192 |
185 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService); | 193 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService); |
186 }; | 194 }; |
187 | 195 |
188 } // namespace arc | 196 } // namespace arc |
189 | 197 |
190 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ | 198 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ |
OLD | NEW |