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 arc { | 16 namespace arc { |
17 | 17 |
18 // The Chrome-side service that handles ARC instances and ARC bridge creation. | 18 // 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 | 19 // This service handles the lifetime of ARC instances and sets up the |
20 // communication channel (the ARC bridge) used to send and receive messages. | 20 // communication channel (the ARC bridge) used to send and receive messages. |
21 class ArcBridgeService : public IPC::Listener { | 21 class ArcBridgeService : public IPC::Listener, |
| 22 public base::SupportsWeakPtr<ArcBridgeService> { |
22 public: | 23 public: |
23 // The possible states of the bridge. In the normal flow, the state changes | 24 // The possible states of the bridge. In the normal flow, the state changes |
24 // in the following sequence: | 25 // in the following sequence: |
25 // | 26 // |
26 // STOPPED | 27 // STOPPED |
27 // SetAvailable(true) + HandleStartup() -> SocketConnect() -> | 28 // SetAvailable(true) + HandleStartup() -> SocketConnect() -> |
28 // CONNECTING | 29 // CONNECTING |
29 // Connect() -> | 30 // Connect() -> |
30 // CONNECTED | 31 // CONNECTED |
31 // SocketConnectAfterSetSocketPermissions() -> | 32 // SocketConnectAfterSetSocketPermissions() -> |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 182 |
182 // WeakPtrFactory to use callbacks. | 183 // WeakPtrFactory to use callbacks. |
183 base::WeakPtrFactory<ArcBridgeService> weak_factory_; | 184 base::WeakPtrFactory<ArcBridgeService> weak_factory_; |
184 | 185 |
185 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService); | 186 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService); |
186 }; | 187 }; |
187 | 188 |
188 } // namespace arc | 189 } // namespace arc |
189 | 190 |
190 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ | 191 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ |
OLD | NEW |