| 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 /** | 5 /** |
| 6 * @fileoverview A helper object used by the "Google Play Store" (ARC) section | 6 * @fileoverview A helper object used by the "Google Play Store" (ARC) section |
| 7 * to retrieve information about android apps. | 7 * to retrieve information about android apps. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 /** | 10 /** |
| 11 * Type definition of AndroidAppsInfo entry. |playStoreEnabled| indicates that | 11 * Type definition of AndroidAppsInfo entry. |playStoreEnabled| indicates that |
| 12 * Play Store is enabled. |settingsAppAvailable| indicates that Android settings | 12 * Play Store is enabled. |settingsAppAvailable| indicates that Android settings |
| 13 * app is registered in the system. | 13 * app is registered in the system. |
| 14 * @typedef {{ | 14 * @typedef {{ |
| 15 * playStoreEnabled: boolean, | 15 * playStoreEnabled: boolean, |
| 16 * settingsAppAvailable: boolean, | 16 * settingsAppAvailable: boolean, |
| 17 * }} | 17 * }} |
| 18 * @see chrome/browser/ui/webui/settings/chromeos/android_apps_handler.cc | 18 * @see chrome/browser/ui/webui/settings/chromeos/android_apps_handler.cc |
| 19 */ | 19 */ |
| 20 var AndroidAppsInfo; | 20 var AndroidAppsInfo; |
| 21 | 21 |
| 22 cr.define('settings', function() { | 22 cr.define('settings', function() { |
| 23 /** @interface */ | 23 /** @interface */ |
| 24 function AndroidAppsBrowserProxy() {} | 24 class AndroidAppsBrowserProxy { |
| 25 | 25 requestAndroidAppsInfo() {} |
| 26 AndroidAppsBrowserProxy.prototype = { | |
| 27 requestAndroidAppsInfo: function() {}, | |
| 28 | 26 |
| 29 /** | 27 /** |
| 30 * @param {boolean} keyboardAction True if the app was opened using a | 28 * @param {boolean} keyboardAction True if the app was opened using a |
| 31 * keyboard action. | 29 * keyboard action. |
| 32 */ | 30 */ |
| 33 showAndroidAppsSettings: function(keyboardAction) {}, | 31 showAndroidAppsSettings(keyboardAction) {} |
| 34 }; | 32 } |
| 35 | 33 |
| 36 /** | 34 /** |
| 37 * @constructor | |
| 38 * @implements {settings.AndroidAppsBrowserProxy} | 35 * @implements {settings.AndroidAppsBrowserProxy} |
| 39 */ | 36 */ |
| 40 function AndroidAppsBrowserProxyImpl() {} | 37 class AndroidAppsBrowserProxyImpl { |
| 38 /** @override */ |
| 39 requestAndroidAppsInfo() { |
| 40 chrome.send('requestAndroidAppsInfo'); |
| 41 } |
| 42 |
| 43 /** @override */ |
| 44 showAndroidAppsSettings(keyboardAction) { |
| 45 chrome.send('showAndroidAppsSettings', [keyboardAction]); |
| 46 } |
| 47 } |
| 41 | 48 |
| 42 // The singleton instance_ can be replaced with a test version of this wrapper | 49 // The singleton instance_ can be replaced with a test version of this wrapper |
| 43 // during testing. | 50 // during testing. |
| 44 cr.addSingletonGetter(AndroidAppsBrowserProxyImpl); | 51 cr.addSingletonGetter(AndroidAppsBrowserProxyImpl); |
| 45 | 52 |
| 46 AndroidAppsBrowserProxyImpl.prototype = { | |
| 47 /** @override */ | |
| 48 requestAndroidAppsInfo: function() { | |
| 49 chrome.send('requestAndroidAppsInfo'); | |
| 50 }, | |
| 51 | |
| 52 /** @override */ | |
| 53 showAndroidAppsSettings: function(keyboardAction) { | |
| 54 chrome.send('showAndroidAppsSettings', [keyboardAction]); | |
| 55 }, | |
| 56 }; | |
| 57 | |
| 58 return { | 53 return { |
| 59 AndroidAppsBrowserProxy: AndroidAppsBrowserProxy, | 54 AndroidAppsBrowserProxy: AndroidAppsBrowserProxy, |
| 60 AndroidAppsBrowserProxyImpl: AndroidAppsBrowserProxyImpl, | 55 AndroidAppsBrowserProxyImpl: AndroidAppsBrowserProxyImpl, |
| 61 }; | 56 }; |
| 62 }); | 57 }); |
| OLD | NEW |