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

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

Issue 2847523002: Android: Remove GetApplicationContext part 4 (Closed)
Patch Set: Rebase and fix build 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
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"
11 #include "services/shape_detection/text_detection_impl.h" 11 #include "services/shape_detection/text_detection_impl.h"
12 12
13 #if defined(OS_ANDROID) 13 #if defined(OS_ANDROID)
14 #include "base/android/context_utils.h"
15 #include "base/android/jni_android.h" 14 #include "base/android/jni_android.h"
16 #include "jni/InterfaceRegistrar_jni.h" 15 #include "jni/InterfaceRegistrar_jni.h"
17 #endif 16 #endif
18 17
19 namespace shape_detection { 18 namespace shape_detection {
20 19
21 std::unique_ptr<service_manager::Service> ShapeDetectionService::Create() { 20 std::unique_ptr<service_manager::Service> ShapeDetectionService::Create() {
22 return base::MakeUnique<ShapeDetectionService>(); 21 return base::MakeUnique<ShapeDetectionService>();
23 } 22 }
24 23
(...skipping 28 matching lines...) Expand all
53 registry_.BindInterface(source_info, interface_name, 52 registry_.BindInterface(source_info, interface_name,
54 std::move(interface_pipe)); 53 std::move(interface_pipe));
55 } 54 }
56 55
57 #if defined(OS_ANDROID) 56 #if defined(OS_ANDROID)
58 service_manager::InterfaceProvider* ShapeDetectionService::GetJavaInterfaces() { 57 service_manager::InterfaceProvider* ShapeDetectionService::GetJavaInterfaces() {
59 if (!java_interface_provider_) { 58 if (!java_interface_provider_) {
60 service_manager::mojom::InterfaceProviderPtr provider; 59 service_manager::mojom::InterfaceProviderPtr provider;
61 Java_InterfaceRegistrar_createInterfaceRegistryForContext( 60 Java_InterfaceRegistrar_createInterfaceRegistryForContext(
62 base::android::AttachCurrentThread(), 61 base::android::AttachCurrentThread(),
63 mojo::MakeRequest(&provider).PassMessagePipe().release().value(), 62 mojo::MakeRequest(&provider).PassMessagePipe().release().value());
64 base::android::GetApplicationContext());
65 java_interface_provider_ = 63 java_interface_provider_ =
66 base::MakeUnique<service_manager::InterfaceProvider>(); 64 base::MakeUnique<service_manager::InterfaceProvider>();
67 java_interface_provider_->Bind(std::move(provider)); 65 java_interface_provider_->Bind(std::move(provider));
68 } 66 }
69 return java_interface_provider_.get(); 67 return java_interface_provider_.get();
70 } 68 }
71 #endif 69 #endif
72 70
73 } // namespace shape_detection 71 } // namespace shape_detection
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698