| 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.chrome.browser.mojo; | 5 package org.chromium.chrome.browser.mojo; |
| 6 | 6 |
| 7 import org.chromium.base.annotations.CalledByNative; | 7 import org.chromium.base.annotations.CalledByNative; |
| 8 import org.chromium.chrome.browser.payments.PaymentRequestFactory; | 8 import org.chromium.chrome.browser.payments.PaymentRequestFactory; |
| 9 import org.chromium.chrome.browser.webshare.ShareServiceImplementationFactory; | 9 import org.chromium.chrome.browser.webshare.ShareServiceImplementationFactory; |
| 10 import org.chromium.content.browser.InterfaceRegistry; | 10 import org.chromium.content_public.browser.InterfaceRegistrar; |
| 11 import org.chromium.content_public.browser.WebContents; | 11 import org.chromium.content_public.browser.WebContents; |
| 12 import org.chromium.mojom.payments.PaymentRequest; | 12 import org.chromium.mojom.payments.PaymentRequest; |
| 13 import org.chromium.mojom.webshare.ShareService; | 13 import org.chromium.mojom.webshare.ShareService; |
| 14 import org.chromium.services.shell.InterfaceRegistry; |
| 14 | 15 |
| 15 /** | 16 /** Registers mojo interface implementations exposed to C++ code at the Chrome l
ayer. */ |
| 16 * Registers interfaces exposed by Chrome in the given registry. | |
| 17 */ | |
| 18 class ChromeInterfaceRegistrar { | 17 class ChromeInterfaceRegistrar { |
| 19 @CalledByNative | 18 @CalledByNative |
| 20 private static void exposeInterfacesToFrame( | 19 private static void registerMojoInterfaces() { |
| 21 InterfaceRegistry registry, WebContents webContents) { | 20 InterfaceRegistrar.Registry.addWebContentsRegistrar( |
| 21 new ChromeWebContentsInterfaceRegistrar()); |
| 22 } |
| 23 } |
| 24 |
| 25 class ChromeWebContentsInterfaceRegistrar implements InterfaceRegistrar<WebConte
nts> { |
| 26 @Override |
| 27 public void registerInterfaces(InterfaceRegistry registry, final WebContents
webContents) { |
| 22 registry.addInterface(PaymentRequest.MANAGER, new PaymentRequestFactory(
webContents)); | 28 registry.addInterface(PaymentRequest.MANAGER, new PaymentRequestFactory(
webContents)); |
| 23 registry.addInterface( | 29 registry.addInterface( |
| 24 ShareService.MANAGER, new ShareServiceImplementationFactory(webC
ontents)); | 30 ShareService.MANAGER, new ShareServiceImplementationFactory(webC
ontents)); |
| 25 } | 31 } |
| 26 } | 32 } |
| OLD | NEW |