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

Side by Side Diff: services/shape_detection/shape_detection_service.cc

Issue 2861263002: Shape Detection: move Java Face detection classes to //services/shape_detection (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « services/shape_detection/android/java/src/org/chromium/shape_detection/InterfaceRegistrar.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "services/shape_detection/shape_detection_service.h" 5 #include "services/shape_detection/shape_detection_service.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "services/service_manager/public/cpp/service_context.h" 8 #include "services/service_manager/public/cpp/service_context.h"
9 #include "services/shape_detection/barcode_detection_impl.h" 9 #include "services/shape_detection/barcode_detection_impl.h"
10 #include "services/shape_detection/face_detection_provider_impl.h" 10 #include "services/shape_detection/face_detection_provider_impl.h"
(...skipping 17 matching lines...) Expand all
28 28
29 void ShapeDetectionService::OnStart() { 29 void ShapeDetectionService::OnStart() {
30 ref_factory_.reset(new service_manager::ServiceContextRefFactory( 30 ref_factory_.reset(new service_manager::ServiceContextRefFactory(
31 base::Bind(&service_manager::ServiceContext::RequestQuit, 31 base::Bind(&service_manager::ServiceContext::RequestQuit,
32 base::Unretained(context())))); 32 base::Unretained(context()))));
33 33
34 #if defined(OS_ANDROID) 34 #if defined(OS_ANDROID)
35 registry_.AddInterface( 35 registry_.AddInterface(
36 GetJavaInterfaces()->CreateInterfaceFactory<mojom::BarcodeDetection>()); 36 GetJavaInterfaces()->CreateInterfaceFactory<mojom::BarcodeDetection>());
37 registry_.AddInterface( 37 registry_.AddInterface(
38 GetJavaInterfaces()
39 ->CreateInterfaceFactory<mojom::FaceDetectionProvider>());
40 registry_.AddInterface(
38 GetJavaInterfaces()->CreateInterfaceFactory<mojom::TextDetection>()); 41 GetJavaInterfaces()->CreateInterfaceFactory<mojom::TextDetection>());
39 #else 42 #else
40 registry_.AddInterface(base::Bind(&BarcodeDetectionImpl::Create)); 43 registry_.AddInterface(base::Bind(&BarcodeDetectionImpl::Create));
41 registry_.AddInterface(base::Bind(&TextDetectionImpl::Create)); 44 registry_.AddInterface(base::Bind(&TextDetectionImpl::Create));
45 registry_.AddInterface(base::Bind(&FaceDetectionProviderImpl::Create));
42 #endif 46 #endif
43
44 registry_.AddInterface(base::Bind(&FaceDetectionProviderImpl::Create));
45 } 47 }
46 48
47 void ShapeDetectionService::OnBindInterface( 49 void ShapeDetectionService::OnBindInterface(
48 const service_manager::BindSourceInfo& source_info, 50 const service_manager::BindSourceInfo& source_info,
49 const std::string& interface_name, 51 const std::string& interface_name,
50 mojo::ScopedMessagePipeHandle interface_pipe) { 52 mojo::ScopedMessagePipeHandle interface_pipe) {
51 registry_.BindInterface(source_info, interface_name, 53 registry_.BindInterface(source_info, interface_name,
52 std::move(interface_pipe)); 54 std::move(interface_pipe));
53 } 55 }
54 56
55 #if defined(OS_ANDROID) 57 #if defined(OS_ANDROID)
56 service_manager::InterfaceProvider* ShapeDetectionService::GetJavaInterfaces() { 58 service_manager::InterfaceProvider* ShapeDetectionService::GetJavaInterfaces() {
57 if (!java_interface_provider_) { 59 if (!java_interface_provider_) {
58 service_manager::mojom::InterfaceProviderPtr provider; 60 service_manager::mojom::InterfaceProviderPtr provider;
59 Java_InterfaceRegistrar_createInterfaceRegistryForContext( 61 Java_InterfaceRegistrar_createInterfaceRegistryForContext(
60 base::android::AttachCurrentThread(), 62 base::android::AttachCurrentThread(),
61 mojo::MakeRequest(&provider).PassMessagePipe().release().value(), 63 mojo::MakeRequest(&provider).PassMessagePipe().release().value(),
62 base::android::GetApplicationContext()); 64 base::android::GetApplicationContext());
63 java_interface_provider_ = 65 java_interface_provider_ =
64 base::MakeUnique<service_manager::InterfaceProvider>(); 66 base::MakeUnique<service_manager::InterfaceProvider>();
65 java_interface_provider_->Bind(std::move(provider)); 67 java_interface_provider_->Bind(std::move(provider));
66 } 68 }
67 return java_interface_provider_.get(); 69 return java_interface_provider_.get();
68 } 70 }
69 #endif 71 #endif
70 72
71 } // namespace shape_detection 73 } // namespace shape_detection
OLDNEW
« no previous file with comments | « services/shape_detection/android/java/src/org/chromium/shape_detection/InterfaceRegistrar.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698