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