Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: components/arc/arc_bridge_bootstrap.h

Issue 2133653002: arc: Notify ARC instance failures via callbacks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address hidehiko's comments. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/sequenced_task_runner.h" 11 #include "base/sequenced_task_runner.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "components/arc/arc_bridge_service.h"
13 #include "components/arc/common/arc_bridge.mojom.h" 14 #include "components/arc/common/arc_bridge.mojom.h"
14 15
15 namespace arc { 16 namespace arc {
16 17
17 // Starts the ARC instance and bootstraps the bridge connection. 18 // Starts the ARC instance and bootstraps the bridge connection.
18 // Clients should implement the Delegate to be notified upon communications 19 // Clients should implement the Delegate to be notified upon communications
19 // being available. 20 // being available.
20 class ArcBridgeBootstrap { 21 class ArcBridgeBootstrap {
21 public: 22 public:
22 class Delegate { 23 class Delegate {
23 public: 24 public:
25 // Called when the connection with ARC instance has been established.
24 virtual void OnConnectionEstablished( 26 virtual void OnConnectionEstablished(
25 mojom::ArcBridgeInstancePtr instance_ptr) = 0; 27 mojom::ArcBridgeInstancePtr instance_ptr) = 0;
26 virtual void OnStopped() = 0; 28
29 // Called when ARC instance is stopped.
30 virtual void OnStopped(ArcBridgeService::StopReason reason) = 0;
27 }; 31 };
28 32
29 // Creates a default instance of ArcBridgeBootstrap. 33 // Creates a default instance of ArcBridgeBootstrap.
30 static std::unique_ptr<ArcBridgeBootstrap> Create(); 34 static std::unique_ptr<ArcBridgeBootstrap> Create();
31 virtual ~ArcBridgeBootstrap() = default; 35 virtual ~ArcBridgeBootstrap() = default;
32 36
33 // This must be called before calling Start() or Stop(). |delegate| is owned 37 // This must be called before calling Start() or Stop(). |delegate| is owned
34 // by the caller and must outlive this instance. 38 // by the caller and must outlive this instance.
35 void set_delegate(Delegate* delegate) { delegate_ = delegate; } 39 void set_delegate(Delegate* delegate) { delegate_ = delegate; }
36 40
(...skipping 11 matching lines...) Expand all
48 // Owned by the caller. 52 // Owned by the caller.
49 Delegate* delegate_ = nullptr; 53 Delegate* delegate_ = nullptr;
50 54
51 private: 55 private:
52 DISALLOW_COPY_AND_ASSIGN(ArcBridgeBootstrap); 56 DISALLOW_COPY_AND_ASSIGN(ArcBridgeBootstrap);
53 }; 57 };
54 58
55 } // namespace arc 59 } // namespace arc
56 60
57 #endif // COMPONENTS_ARC_ARC_BRIDGE_BOOTSTRAP_H_ 61 #endif // COMPONENTS_ARC_ARC_BRIDGE_BOOTSTRAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698