OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 SERVICES_SERVICE_MANAGER_TESTS_LIFECYCLE_APP_CLIENT_H_ | 5 #ifndef SERVICES_SERVICE_MANAGER_TESTS_LIFECYCLE_APP_CLIENT_H_ |
6 #define SERVICES_SERVICE_MANAGER_TESTS_LIFECYCLE_APP_CLIENT_H_ | 6 #define SERVICES_SERVICE_MANAGER_TESTS_LIFECYCLE_APP_CLIENT_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 class AppClient : public Service, | 22 class AppClient : public Service, |
23 public InterfaceFactory<mojom::LifecycleControl>, | 23 public InterfaceFactory<mojom::LifecycleControl>, |
24 public mojom::LifecycleControl { | 24 public mojom::LifecycleControl { |
25 public: | 25 public: |
26 AppClient(); | 26 AppClient(); |
27 ~AppClient() override; | 27 ~AppClient() override; |
28 | 28 |
29 void set_runner(ServiceRunner* runner) { runner_ = runner; } | 29 void set_runner(ServiceRunner* runner) { runner_ = runner; } |
30 | 30 |
31 // Serivce: | 31 // Service: |
32 void OnStart(ServiceContext* context) override; | |
33 bool OnConnect(const ServiceInfo& remote_info, | 32 bool OnConnect(const ServiceInfo& remote_info, |
34 InterfaceRegistry* registry) override; | 33 InterfaceRegistry* registry) override; |
35 bool OnStop() override; | 34 bool OnStop() override; |
36 | 35 |
37 // InterfaceFactory<LifecycleControl>: | 36 // InterfaceFactory<LifecycleControl>: |
38 void Create(const Identity& remote_identity, | 37 void Create(const Identity& remote_identity, |
39 mojom::LifecycleControlRequest request) override; | 38 mojom::LifecycleControlRequest request) override; |
40 | 39 |
41 // LifecycleControl: | 40 // LifecycleControl: |
42 void Ping(const PingCallback& callback) override; | 41 void Ping(const PingCallback& callback) override; |
43 void GracefulQuit() override; | 42 void GracefulQuit() override; |
44 void Crash() override; | 43 void Crash() override; |
45 void CloseServiceManagerConnection() override; | 44 void CloseServiceManagerConnection() override; |
46 | 45 |
47 private: | 46 private: |
48 class ServiceImpl; | 47 class ServiceImpl; |
49 | 48 |
50 void BindingLost(); | 49 void BindingLost(); |
51 | 50 |
52 ServiceContext* context_; | |
53 ServiceRunner* runner_ = nullptr; | 51 ServiceRunner* runner_ = nullptr; |
54 mojo::BindingSet<mojom::LifecycleControl> bindings_; | 52 mojo::BindingSet<mojom::LifecycleControl> bindings_; |
55 | 53 |
56 DISALLOW_COPY_AND_ASSIGN(AppClient); | 54 DISALLOW_COPY_AND_ASSIGN(AppClient); |
57 }; | 55 }; |
58 | 56 |
59 } // namespace test | 57 } // namespace test |
60 } // namespace service_manager | 58 } // namespace service_manager |
61 | 59 |
62 #endif // SERVICES_SERVICE_MANAGER_TESTS_LIFECYCLE_APP_CLIENT_H_ | 60 #endif // SERVICES_SERVICE_MANAGER_TESTS_LIFECYCLE_APP_CLIENT_H_ |
OLD | NEW |