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 cr.define('settings', function() { | 5 cr.define('settings', function() { |
6 /** @interface */ | 6 /** @interface */ |
7 function ExtensionControlBrowserProxy() {} | 7 class ExtensionControlBrowserProxy { |
8 | |
9 ExtensionControlBrowserProxy.prototype = { | |
10 // TODO(dbeam): should be be returning !Promise<boolean> to indicate whether | 8 // TODO(dbeam): should be be returning !Promise<boolean> to indicate whether |
11 // it succeeded? | 9 // it succeeded? |
12 /** @param {string} extensionId */ | 10 /** @param {string} extensionId */ |
13 disableExtension: assertNotReached, | 11 disableExtension(extensionId) {} |
14 | 12 |
15 /** @param {string} extensionId */ | 13 /** @param {string} extensionId */ |
16 manageExtension: assertNotReached, | 14 manageExtension(extensionId) {} |
17 }; | 15 } |
18 | 16 |
19 /** | 17 /** |
20 * @implements {settings.ExtensionControlBrowserProxy} | 18 * @implements {settings.ExtensionControlBrowserProxy} |
21 * @constructor | |
22 */ | 19 */ |
23 function ExtensionControlBrowserProxyImpl() {} | 20 class ExtensionControlBrowserProxyImpl { |
24 cr.addSingletonGetter(ExtensionControlBrowserProxyImpl); | |
25 | |
26 ExtensionControlBrowserProxyImpl.prototype = { | |
27 /** @override */ | 21 /** @override */ |
28 disableExtension: function(extensionId) { | 22 disableExtension(extensionId) { |
29 chrome.send('disableExtension', [extensionId]); | 23 chrome.send('disableExtension', [extensionId]); |
30 }, | 24 } |
31 | 25 |
32 /** @override */ | 26 /** @override */ |
33 manageExtension: function(extensionId) { | 27 manageExtension(extensionId) { |
34 window.open('chrome://extensions?id=' + extensionId); | 28 window.open('chrome://extensions?id=' + extensionId); |
35 }, | 29 } |
36 }; | 30 } |
| 31 |
| 32 cr.addSingletonGetter(ExtensionControlBrowserProxyImpl); |
37 | 33 |
38 return { | 34 return { |
39 ExtensionControlBrowserProxy: ExtensionControlBrowserProxy, | 35 ExtensionControlBrowserProxy: ExtensionControlBrowserProxy, |
40 ExtensionControlBrowserProxyImpl: ExtensionControlBrowserProxyImpl, | 36 ExtensionControlBrowserProxyImpl: ExtensionControlBrowserProxyImpl, |
41 }; | 37 }; |
42 }); | 38 }); |
OLD | NEW |