OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_SHAPE_DETECTION_SHAPE_DETECTION_SERVICE_H_ | 5 #ifndef SERVICES_SHAPE_DETECTION_SHAPE_DETECTION_SERVICE_H_ |
6 #define SERVICES_SHAPE_DETECTION_SHAPE_DETECTION_SERVICE_H_ | 6 #define SERVICES_SHAPE_DETECTION_SHAPE_DETECTION_SERVICE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "services/service_manager/public/cpp/binder_registry.h" | 12 #include "services/service_manager/public/cpp/binder_registry.h" |
13 #include "services/service_manager/public/cpp/interface_provider.h" | |
13 #include "services/service_manager/public/cpp/service.h" | 14 #include "services/service_manager/public/cpp/service.h" |
14 #include "services/service_manager/public/cpp/service_context_ref.h" | 15 #include "services/service_manager/public/cpp/service_context_ref.h" |
15 | 16 |
16 namespace shape_detection { | 17 namespace shape_detection { |
17 | 18 |
18 class ShapeDetectionService : public service_manager::Service { | 19 class ShapeDetectionService : public service_manager::Service { |
19 public: | 20 public: |
20 // Factory function for use as an embedded service. | 21 // Factory function for use as an embedded service. |
21 static std::unique_ptr<service_manager::Service> Create(); | 22 static std::unique_ptr<service_manager::Service> Create(); |
22 | 23 |
23 ShapeDetectionService(); | 24 ShapeDetectionService(); |
24 ~ShapeDetectionService() override; | 25 ~ShapeDetectionService() override; |
25 | 26 |
26 void OnStart() override; | 27 void OnStart() override; |
27 void OnBindInterface(const service_manager::BindSourceInfo& source_info, | 28 void OnBindInterface(const service_manager::BindSourceInfo& source_info, |
28 const std::string& interface_name, | 29 const std::string& interface_name, |
29 mojo::ScopedMessagePipeHandle interface_pipe) override; | 30 mojo::ScopedMessagePipeHandle interface_pipe) override; |
31 private: | |
32 #if defined(OS_ANDROID) | |
33 // Binds |java_interface_provider_| to an interface registry that exposes | |
34 // factories for the interfaces that are provided via Java on Android. | |
35 service_manager::InterfaceProvider* GetJavaInterfaces(); | |
30 | 36 |
31 private: | 37 bool java_interface_provider_initialized_ = false; |
38 // InterfaceProvider that is bound to the Java-side interface registry. | |
39 service_manager::InterfaceProvider java_interface_provider_; | |
Ken Rockot(use gerrit already)
2017/05/04 17:19:50
nit: Just use a unique_ptr<InterfaceProvider> inst
mcasas
2017/05/04 17:58:50
Yeah! I thought I recall somewhere (maybe "Do's a
| |
40 #endif | |
41 | |
32 std::unique_ptr<service_manager::ServiceContextRefFactory> ref_factory_; | 42 std::unique_ptr<service_manager::ServiceContextRefFactory> ref_factory_; |
33 service_manager::BinderRegistry registry_; | 43 service_manager::BinderRegistry registry_; |
34 | 44 |
35 DISALLOW_COPY_AND_ASSIGN(ShapeDetectionService); | 45 DISALLOW_COPY_AND_ASSIGN(ShapeDetectionService); |
36 }; | 46 }; |
37 | 47 |
38 } // namespace shape_detection | 48 } // namespace shape_detection |
39 | 49 |
40 #endif // SERVICES_SHAPE_DETECTION_SHAPE_DETECTION_SERVICE_H_ | 50 #endif // SERVICES_SHAPE_DETECTION_SHAPE_DETECTION_SERVICE_H_ |
OLD | NEW |