| OLD | NEW |
| 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; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 } | 41 } |
| 42 | 42 |
| 43 private static void ensureContentRegistrarsAreRegistered() { | 43 private static void ensureContentRegistrarsAreRegistered() { |
| 44 if (sHasRegisteredRegistrars) return; | 44 if (sHasRegisteredRegistrars) return; |
| 45 sHasRegisteredRegistrars = true; | 45 sHasRegisteredRegistrars = true; |
| 46 InterfaceRegistrar.Registry.addContextRegistrar(new ContentContextInterf
aceRegistrar()); | 46 InterfaceRegistrar.Registry.addContextRegistrar(new ContentContextInterf
aceRegistrar()); |
| 47 InterfaceRegistrar.Registry.addWebContentsRegistrar( | 47 InterfaceRegistrar.Registry.addWebContentsRegistrar( |
| 48 new ContentWebContentsInterfaceRegistrar()); | 48 new ContentWebContentsInterfaceRegistrar()); |
| 49 } | 49 } |
| 50 | 50 |
| 51 private static boolean sHasRegisteredRegistrars = false; | 51 private static boolean sHasRegisteredRegistrars; |
| 52 } | 52 } |
| 53 | 53 |
| 54 class ContentContextInterfaceRegistrar implements InterfaceRegistrar<Context> { | 54 class ContentContextInterfaceRegistrar implements InterfaceRegistrar<Context> { |
| 55 @Override | 55 @Override |
| 56 public void registerInterfaces(InterfaceRegistry registry, final Context app
licationContext) { | 56 public void registerInterfaces(InterfaceRegistry registry, final Context app
licationContext) { |
| 57 registry.addInterface( | 57 registry.addInterface( |
| 58 VibrationManager.MANAGER, new VibrationManagerImpl.Factory(appli
cationContext)); | 58 VibrationManager.MANAGER, new VibrationManagerImpl.Factory(appli
cationContext)); |
| 59 registry.addInterface( | 59 registry.addInterface( |
| 60 BatteryMonitor.MANAGER, new BatteryMonitorFactory(applicationCon
text)); | 60 BatteryMonitor.MANAGER, new BatteryMonitorFactory(applicationCon
text)); |
| 61 registry.addInterface( | 61 registry.addInterface( |
| 62 FaceDetection.MANAGER, new FaceDetectionFactory(applicationConte
xt)); | 62 FaceDetection.MANAGER, new FaceDetectionFactory(applicationConte
xt)); |
| 63 // TODO(avayvod): Register the PresentationService implementation here. | 63 // TODO(avayvod): Register the PresentationService implementation here. |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 | 66 |
| 67 class ContentWebContentsInterfaceRegistrar implements InterfaceRegistrar<WebCont
ents> { | 67 class ContentWebContentsInterfaceRegistrar implements InterfaceRegistrar<WebCont
ents> { |
| 68 @Override | 68 @Override |
| 69 public void registerInterfaces(InterfaceRegistry registry, final WebContents
webContents) { | 69 public void registerInterfaces(InterfaceRegistry registry, final WebContents
webContents) { |
| 70 registry.addInterface(Nfc.MANAGER, new NfcFactory(webContents)); | 70 registry.addInterface(Nfc.MANAGER, new NfcFactory(webContents)); |
| 71 } | 71 } |
| 72 } | 72 } |
| OLD | NEW |