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_BOOTSTRAP_H_ | 5 #ifndef COMPONENTS_ARC_ARC_BRIDGE_BOOTSTRAP_H_ |
6 #define COMPONENTS_ARC_ARC_BRIDGE_BOOTSTRAP_H_ | 6 #define COMPONENTS_ARC_ARC_BRIDGE_BOOTSTRAP_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
12 #include "components/arc/common/arc_bridge.mojom.h" | 12 #include "components/arc/common/arc_bridge.mojom.h" |
13 | 13 |
14 namespace arc { | 14 namespace arc { |
15 | 15 |
16 // Starts the ARC instance and bootstraps the bridge connection. | 16 // Starts the ARC instance and bootstraps the bridge connection. |
17 // Clients should implement the Delegate to be notified upon communications | 17 // Clients should implement the Delegate to be notified upon communications |
18 // being available. | 18 // being available. |
19 class ArcBridgeBootstrap { | 19 class ArcBridgeBootstrap { |
20 public: | 20 public: |
21 class Delegate { | 21 class Delegate { |
22 public: | 22 public: |
23 virtual void OnConnectionEstablished(ArcBridgeInstancePtr instance_ptr) = 0; | 23 virtual void OnConnectionEstablished( |
| 24 mojom::ArcBridgeInstancePtr instance_ptr) = 0; |
24 virtual void OnStopped() = 0; | 25 virtual void OnStopped() = 0; |
25 }; | 26 }; |
26 | 27 |
27 // Creates a default instance of ArcBridgeBootstrap. | 28 // Creates a default instance of ArcBridgeBootstrap. |
28 static scoped_ptr<ArcBridgeBootstrap> Create(); | 29 static scoped_ptr<ArcBridgeBootstrap> Create(); |
29 virtual ~ArcBridgeBootstrap(); | 30 virtual ~ArcBridgeBootstrap(); |
30 | 31 |
31 // This must be called before calling Start() or Stop(). |delegate| is owned | 32 // This must be called before calling Start() or Stop(). |delegate| is owned |
32 // by the caller and must outlive this instance. | 33 // by the caller and must outlive this instance. |
33 void set_delegate(Delegate* delegate) { delegate_ = delegate; } | 34 void set_delegate(Delegate* delegate) { delegate_ = delegate; } |
(...skipping 12 matching lines...) Expand all Loading... |
46 // Owned by the caller. | 47 // Owned by the caller. |
47 Delegate* delegate_ = nullptr; | 48 Delegate* delegate_ = nullptr; |
48 | 49 |
49 private: | 50 private: |
50 DISALLOW_COPY_AND_ASSIGN(ArcBridgeBootstrap); | 51 DISALLOW_COPY_AND_ASSIGN(ArcBridgeBootstrap); |
51 }; | 52 }; |
52 | 53 |
53 } // namespace arc | 54 } // namespace arc |
54 | 55 |
55 #endif // COMPONENTS_ARC_ARC_BRIDGE_BOOTSTRAP_H_ | 56 #endif // COMPONENTS_ARC_ARC_BRIDGE_BOOTSTRAP_H_ |
OLD | NEW |