| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.app.Activity; | 7 import android.app.Activity; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 | 9 |
| 10 import org.chromium.base.annotations.CalledByNative; | 10 import org.chromium.base.annotations.CalledByNative; |
| 11 import org.chromium.base.annotations.JNINamespace; | 11 import org.chromium.base.annotations.JNINamespace; |
| 12 import org.chromium.content.browser.InterfaceRegistry.ImplementationFactory; | 12 import org.chromium.content.browser.InterfaceRegistry.ImplementationFactory; |
| 13 import org.chromium.content_public.browser.WebContents; | 13 import org.chromium.content_public.browser.WebContents; |
| 14 import org.chromium.device.BatteryMonitor; |
| 15 import org.chromium.device.VibrationManager; |
| 14 import org.chromium.device.battery.BatteryMonitorFactory; | 16 import org.chromium.device.battery.BatteryMonitorFactory; |
| 15 import org.chromium.device.nfc.NfcImpl; | 17 import org.chromium.device.nfc.NfcImpl; |
| 18 import org.chromium.device.nfc.mojom.Nfc; |
| 16 import org.chromium.device.vibration.VibrationManagerImpl; | 19 import org.chromium.device.vibration.VibrationManagerImpl; |
| 17 import org.chromium.mojom.device.BatteryMonitor; | |
| 18 import org.chromium.mojom.device.VibrationManager; | |
| 19 import org.chromium.mojom.device.nfc.Nfc; | |
| 20 import org.chromium.ui.base.WindowAndroid; | 20 import org.chromium.ui.base.WindowAndroid; |
| 21 | 21 |
| 22 /** | 22 /** |
| 23 * Registers interfaces exposed by the browser in the given registry. | 23 * Registers interfaces exposed by the browser in the given registry. |
| 24 */ | 24 */ |
| 25 @JNINamespace("content") | 25 @JNINamespace("content") |
| 26 class InterfaceRegistrar { | 26 class InterfaceRegistrar { |
| 27 // BatteryMonitorFactory can't implement ImplementationFactory itself, as we
don't depend on | 27 // BatteryMonitorFactory can't implement ImplementationFactory itself, as we
don't depend on |
| 28 // /content in /device. Hence we use BatteryMonitorImplementationFactory as
a wrapper. | 28 // /content in /device. Hence we use BatteryMonitorImplementationFactory as
a wrapper. |
| 29 private static class BatteryMonitorImplementationFactory | 29 private static class BatteryMonitorImplementationFactory |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 static void exposeInterfacesToFrame(InterfaceRegistry registry, | 113 static void exposeInterfacesToFrame(InterfaceRegistry registry, |
| 114 Context applicationContext, WebContents contents) { | 114 Context applicationContext, WebContents contents) { |
| 115 assert applicationContext != null; | 115 assert applicationContext != null; |
| 116 registry.addInterface(VibrationManager.MANAGER, | 116 registry.addInterface(VibrationManager.MANAGER, |
| 117 new VibrationManagerImplementationFactory(applicationContext)); | 117 new VibrationManagerImplementationFactory(applicationContext)); |
| 118 registry.addInterface(Nfc.MANAGER, | 118 registry.addInterface(Nfc.MANAGER, |
| 119 new NfcImplementationFactory(applicationContext, contents)); | 119 new NfcImplementationFactory(applicationContext, contents)); |
| 120 // TODO(avayvod): Register the PresentationService implementation here. | 120 // TODO(avayvod): Register the PresentationService implementation here. |
| 121 } | 121 } |
| 122 } | 122 } |
| OLD | NEW |