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

Side by Side Diff: services/shape_detection/android/java/src/org/chromium/shape_detection/InterfaceRegistrar.java

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 package org.chromium.shape_detection; 5 package org.chromium.shape_detection;
6 6
7 import android.content.Context; 7 import org.chromium.base.ContextUtils;
8
9 import org.chromium.base.annotations.CalledByNative; 8 import org.chromium.base.annotations.CalledByNative;
10 import org.chromium.base.annotations.JNINamespace; 9 import org.chromium.base.annotations.JNINamespace;
11 import org.chromium.mojo.system.impl.CoreImpl; 10 import org.chromium.mojo.system.impl.CoreImpl;
12 import org.chromium.services.service_manager.InterfaceRegistry; 11 import org.chromium.services.service_manager.InterfaceRegistry;
13 import org.chromium.shape_detection.mojom.BarcodeDetection; 12 import org.chromium.shape_detection.mojom.BarcodeDetection;
14 import org.chromium.shape_detection.mojom.FaceDetectionProvider; 13 import org.chromium.shape_detection.mojom.FaceDetectionProvider;
15 import org.chromium.shape_detection.mojom.TextDetection; 14 import org.chromium.shape_detection.mojom.TextDetection;
16 15
17 @JNINamespace("shape_detection") 16 @JNINamespace("shape_detection")
18 class InterfaceRegistrar { 17 class InterfaceRegistrar {
19 @CalledByNative 18 @CalledByNative
20 static void createInterfaceRegistryForContext(int nativeHandle, Context appl icationContext) { 19 static void createInterfaceRegistryForContext(int nativeHandle) {
21 // Note: The bindings code manages the lifetime of this object, so it 20 // Note: The bindings code manages the lifetime of this object, so it
22 // is not necessary to hold on to a reference to it explicitly. 21 // is not necessary to hold on to a reference to it explicitly.
22 // TODO(wnwen): Move references to getApplicationContext lower.
23 InterfaceRegistry registry = InterfaceRegistry.create( 23 InterfaceRegistry registry = InterfaceRegistry.create(
24 CoreImpl.getInstance().acquireNativeHandle(nativeHandle).toMessa gePipeHandle()); 24 CoreImpl.getInstance().acquireNativeHandle(nativeHandle).toMessa gePipeHandle());
25 registry.addInterface( 25 registry.addInterface(BarcodeDetection.MANAGER,
26 BarcodeDetection.MANAGER, new BarcodeDetectionImpl.Factory(appli cationContext)); 26 new BarcodeDetectionImpl.Factory(ContextUtils.getApplicationCont ext()));
27 registry.addInterface(FaceDetectionProvider.MANAGER, 27 registry.addInterface(FaceDetectionProvider.MANAGER,
28 new FaceDetectionProviderImpl.Factory(applicationContext)); 28 new FaceDetectionProviderImpl.Factory(ContextUtils.getApplicatio nContext()));
29 registry.addInterface( 29 registry.addInterface(TextDetection.MANAGER,
30 TextDetection.MANAGER, new TextDetectionImpl.Factory(application Context)); 30 new TextDetectionImpl.Factory(ContextUtils.getApplicationContext ()));
31 } 31 }
32 } 32 }
OLDNEW
« no previous file with comments | « services/device/time_zone_monitor/time_zone_monitor_android.cc ('k') | services/shape_detection/shape_detection_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698