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

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/InterfaceRegistrarImpl.java

Issue 2706403014: Add Android implementation of navigator.getInstalledRelatedApps. (Closed)
Patch Set: Fixed iframes (now has the correct origin of the frame, not the tab). Created 3 years, 9 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 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 package org.chromium.content.browser; 5 package org.chromium.content.browser;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 8
9 import org.chromium.base.annotations.CalledByNative; 9 import org.chromium.base.annotations.CalledByNative;
10 import org.chromium.base.annotations.JNINamespace; 10 import org.chromium.base.annotations.JNINamespace;
11 import org.chromium.content.browser.installedapp.InstalledAppProviderFactory;
11 import org.chromium.content.browser.shapedetection.FaceDetectionProviderImpl; 12 import org.chromium.content.browser.shapedetection.FaceDetectionProviderImpl;
12 import org.chromium.content_public.browser.InterfaceRegistrar; 13 import org.chromium.content_public.browser.InterfaceRegistrar;
13 import org.chromium.content_public.browser.RenderFrameHost; 14 import org.chromium.content_public.browser.RenderFrameHost;
14 import org.chromium.content_public.browser.WebContents; 15 import org.chromium.content_public.browser.WebContents;
15 import org.chromium.device.BatteryMonitor; 16 import org.chromium.device.BatteryMonitor;
16 import org.chromium.device.battery.BatteryMonitorFactory; 17 import org.chromium.device.battery.BatteryMonitorFactory;
17 import org.chromium.device.mojom.VibrationManager; 18 import org.chromium.device.mojom.VibrationManager;
18 import org.chromium.device.nfc.mojom.Nfc; 19 import org.chromium.device.nfc.mojom.Nfc;
19 import org.chromium.device.vibration.VibrationManagerImpl; 20 import org.chromium.device.vibration.VibrationManagerImpl;
21 import org.chromium.installedapp.mojom.InstalledAppProvider;
20 import org.chromium.mojo.system.impl.CoreImpl; 22 import org.chromium.mojo.system.impl.CoreImpl;
21 import org.chromium.services.service_manager.InterfaceRegistry; 23 import org.chromium.services.service_manager.InterfaceRegistry;
22 import org.chromium.shape_detection.mojom.FaceDetectionProvider; 24 import org.chromium.shape_detection.mojom.FaceDetectionProvider;
23 25
24 @JNINamespace("content") 26 @JNINamespace("content")
25 class InterfaceRegistrarImpl { 27 class InterfaceRegistrarImpl {
26 28
27 private static boolean sHasRegisteredRegistrars; 29 private static boolean sHasRegisteredRegistrars;
28 30
29 @CalledByNative 31 @CalledByNative
(...skipping 23 matching lines...) Expand all
53 CoreImpl.getInstance().acquireNativeHandle(nativeHandle).toMessa gePipeHandle()); 55 CoreImpl.getInstance().acquireNativeHandle(nativeHandle).toMessa gePipeHandle());
54 InterfaceRegistrar.Registry.applyRenderFrameHostRegistrars(registry, ren derFrameHost); 56 InterfaceRegistrar.Registry.applyRenderFrameHostRegistrars(registry, ren derFrameHost);
55 } 57 }
56 58
57 private static void ensureContentRegistrarsAreRegistered() { 59 private static void ensureContentRegistrarsAreRegistered() {
58 if (sHasRegisteredRegistrars) return; 60 if (sHasRegisteredRegistrars) return;
59 sHasRegisteredRegistrars = true; 61 sHasRegisteredRegistrars = true;
60 InterfaceRegistrar.Registry.addContextRegistrar(new ContentContextInterf aceRegistrar()); 62 InterfaceRegistrar.Registry.addContextRegistrar(new ContentContextInterf aceRegistrar());
61 InterfaceRegistrar.Registry.addWebContentsRegistrar( 63 InterfaceRegistrar.Registry.addWebContentsRegistrar(
62 new ContentWebContentsInterfaceRegistrar()); 64 new ContentWebContentsInterfaceRegistrar());
65 InterfaceRegistrar.Registry.addRenderFrameHostRegistrar(
66 new ContentRenderFrameHostInterfaceRegistrar());
63 } 67 }
64 68
65 private static class ContentContextInterfaceRegistrar implements InterfaceRe gistrar<Context> { 69 private static class ContentContextInterfaceRegistrar implements InterfaceRe gistrar<Context> {
66 @Override 70 @Override
67 public void registerInterfaces( 71 public void registerInterfaces(
68 InterfaceRegistry registry, final Context applicationContext) { 72 InterfaceRegistry registry, final Context applicationContext) {
69 registry.addInterface( 73 registry.addInterface(
70 VibrationManager.MANAGER, new VibrationManagerImpl.Factory(a pplicationContext)); 74 VibrationManager.MANAGER, new VibrationManagerImpl.Factory(a pplicationContext));
71 registry.addInterface( 75 registry.addInterface(
72 BatteryMonitor.MANAGER, new BatteryMonitorFactory(applicatio nContext)); 76 BatteryMonitor.MANAGER, new BatteryMonitorFactory(applicatio nContext));
73 registry.addInterface(FaceDetectionProvider.MANAGER, 77 registry.addInterface(FaceDetectionProvider.MANAGER,
74 new FaceDetectionProviderImpl.Factory(applicationContext)); 78 new FaceDetectionProviderImpl.Factory(applicationContext));
75 // TODO(avayvod): Register the PresentationService implementation he re. 79 // TODO(avayvod): Register the PresentationService implementation he re.
76 } 80 }
77 } 81 }
78 82
79 private static class ContentWebContentsInterfaceRegistrar 83 private static class ContentWebContentsInterfaceRegistrar
80 implements InterfaceRegistrar<WebContents> { 84 implements InterfaceRegistrar<WebContents> {
81 @Override 85 @Override
82 public void registerInterfaces(InterfaceRegistry registry, final WebCont ents webContents) { 86 public void registerInterfaces(InterfaceRegistry registry, final WebCont ents webContents) {
83 registry.addInterface(Nfc.MANAGER, new NfcFactory(webContents)); 87 registry.addInterface(Nfc.MANAGER, new NfcFactory(webContents));
84 } 88 }
85 } 89 }
90
91 private static class ContentRenderFrameHostInterfaceRegistrar
92 implements InterfaceRegistrar<RenderFrameHost> {
93 @Override
94 public void registerInterfaces(
95 InterfaceRegistry registry, final RenderFrameHost renderFrameHos t) {
96 registry.addInterface(
97 InstalledAppProvider.MANAGER, new InstalledAppProviderFactor y(renderFrameHost));
98 }
99 }
86 } 100 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698