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.ShareServiceImpl; | |
9 import org.chromium.content.browser.ServiceRegistry; | 10 import org.chromium.content.browser.ServiceRegistry; |
11 import org.chromium.content.browser.ServiceRegistry.ImplementationFactory; | |
10 import org.chromium.content_public.browser.WebContents; | 12 import org.chromium.content_public.browser.WebContents; |
11 import org.chromium.mojom.payments.PaymentRequest; | 13 import org.chromium.mojom.payments.PaymentRequest; |
14 import org.chromium.mojom.webshare.ShareService; | |
12 | 15 |
13 /** | 16 /** |
14 * Registers mojo services exposed by Chrome in the given registry. | 17 * Registers mojo services exposed by Chrome in the given registry. |
15 */ | 18 */ |
16 class ChromeServiceRegistrar { | 19 class ChromeServiceRegistrar { |
20 private static class ShareServiceImplementationFactory | |
Sam McNally
2016/07/26 08:21:51
Why is this here?
Matt Giuca
2016/07/28 05:58:32
Follows the pattern here:
https://cs.chromium.org/
Sam McNally
2016/07/28 07:16:04
The pattern described by
"BatteryMonitorFactory ca
Matt Giuca
2016/07/28 07:40:42
I was looking at the VibrationManagerImplementatio
Matt Giuca
2016/07/28 07:56:09
Done.
| |
21 implements ImplementationFactory<ShareService> { | |
22 private final WebContents mWebContents; | |
23 | |
24 ShareServiceImplementationFactory(WebContents webContents) { | |
25 mWebContents = webContents; | |
26 } | |
27 | |
28 @Override | |
29 public ShareService createImpl() { | |
30 return new ShareServiceImpl(mWebContents); | |
31 } | |
32 } | |
33 | |
17 @CalledByNative | 34 @CalledByNative |
18 private static void registerRenderFrameMojoServices( | 35 private static void registerRenderFrameMojoServices( |
19 ServiceRegistry registry, WebContents webContents) { | 36 ServiceRegistry registry, WebContents webContents) { |
20 registry.addService(PaymentRequest.MANAGER, new PaymentRequestFactory(we bContents)); | 37 registry.addService(PaymentRequest.MANAGER, new PaymentRequestFactory(we bContents)); |
38 registry.addService( | |
39 ShareService.MANAGER, new ShareServiceImplementationFactory(webC ontents)); | |
21 } | 40 } |
22 } | 41 } |
OLD | NEW |