| 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 from the "Default Browser" section | 6 * @fileoverview A helper object used from the "Default Browser" section |
| 7 * to interact with the browser. | 7 * to interact with the browser. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 /** | 10 /** |
| 11 * @typedef {{ | 11 * @typedef {{ |
| 12 * canBeDefault: boolean, | 12 * canBeDefault: boolean, |
| 13 * isDefault: boolean, | 13 * isDefault: boolean, |
| 14 * isDisabledByPolicy: boolean, | 14 * isDisabledByPolicy: boolean, |
| 15 * isUnknownError: boolean, | 15 * isUnknownError: boolean, |
| 16 * }}; | 16 * }}; |
| 17 */ | 17 */ |
| 18 var DefaultBrowserInfo; | 18 var DefaultBrowserInfo; |
| 19 | 19 |
| 20 cr.define('settings', function() { | 20 cr.define('settings', function() { |
| 21 /** @interface */ | 21 /** @interface */ |
| 22 function DefaultBrowserBrowserProxy() {} | 22 class DefaultBrowserBrowserProxy { |
| 23 | |
| 24 DefaultBrowserBrowserProxy.prototype = { | |
| 25 /** | 23 /** |
| 26 * Get the initial DefaultBrowserInfo and begin sending updates to | 24 * Get the initial DefaultBrowserInfo and begin sending updates to |
| 27 * 'settings.updateDefaultBrowserState'. | 25 * 'settings.updateDefaultBrowserState'. |
| 28 * @return {!Promise<DefaultBrowserInfo>} | 26 * @return {!Promise<DefaultBrowserInfo>} |
| 29 */ | 27 */ |
| 30 requestDefaultBrowserState: function() {}, | 28 requestDefaultBrowserState() {} |
| 31 | 29 |
| 32 /* | 30 /* |
| 33 * Try to set the current browser as the default browser. The new status of | 31 * Try to set the current browser as the default browser. The new status of |
| 34 * the settings will be sent to 'settings.updateDefaultBrowserState'. | 32 * the settings will be sent to 'settings.updateDefaultBrowserState'. |
| 35 */ | 33 */ |
| 36 setAsDefaultBrowser: function() {}, | 34 setAsDefaultBrowser() {} |
| 37 }; | 35 } |
| 38 | 36 |
| 39 /** | 37 /** |
| 40 * @constructor | |
| 41 * @implements {settings.DefaultBrowserBrowserProxy} | 38 * @implements {settings.DefaultBrowserBrowserProxy} |
| 42 */ | 39 */ |
| 43 function DefaultBrowserBrowserProxyImpl() {} | 40 class DefaultBrowserBrowserProxyImpl { |
| 44 cr.addSingletonGetter(DefaultBrowserBrowserProxyImpl); | |
| 45 | |
| 46 DefaultBrowserBrowserProxyImpl.prototype = { | |
| 47 /** @override */ | 41 /** @override */ |
| 48 requestDefaultBrowserState: function() { | 42 requestDefaultBrowserState() { |
| 49 return cr.sendWithPromise( | 43 return cr.sendWithPromise( |
| 50 'SettingsDefaultBrowser.requestDefaultBrowserState'); | 44 'SettingsDefaultBrowser.requestDefaultBrowserState'); |
| 51 }, | 45 } |
| 52 | 46 |
| 53 /** @override */ | 47 /** @override */ |
| 54 setAsDefaultBrowser: function() { | 48 setAsDefaultBrowser() { |
| 55 chrome.send('SettingsDefaultBrowser.setAsDefaultBrowser'); | 49 chrome.send('SettingsDefaultBrowser.setAsDefaultBrowser'); |
| 56 }, | 50 } |
| 57 }; | 51 } |
| 52 |
| 53 cr.addSingletonGetter(DefaultBrowserBrowserProxyImpl); |
| 58 | 54 |
| 59 return { | 55 return { |
| 60 DefaultBrowserBrowserProxy: DefaultBrowserBrowserProxy, | 56 DefaultBrowserBrowserProxy: DefaultBrowserBrowserProxy, |
| 61 DefaultBrowserBrowserProxyImpl: DefaultBrowserBrowserProxyImpl, | 57 DefaultBrowserBrowserProxyImpl: DefaultBrowserBrowserProxyImpl, |
| 62 }; | 58 }; |
| 63 }); | 59 }); |
| OLD | NEW |