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 * @typedef {{ | 6 * @typedef {{ |
7 * fontList: Array<{0: string, 1: (string|undefined), 2: (string|undefined)}>, | 7 * fontList: Array<{0: string, 1: (string|undefined), 2: (string|undefined)}>, |
8 * extensionUrl: string | 8 * extensionUrl: string |
9 * }} | 9 * }} |
10 */ | 10 */ |
11 var FontsData; | 11 var FontsData; |
12 | 12 |
13 cr.define('settings', function() { | 13 cr.define('settings', function() { |
14 /** @interface */ | 14 /** @interface */ |
15 function FontsBrowserProxy() {} | 15 class FontsBrowserProxy { |
16 | |
17 FontsBrowserProxy.prototype = { | |
18 /** | 16 /** |
19 * @return {!Promise<!FontsData>} Fonts and the advanced font settings | 17 * @return {!Promise<!FontsData>} Fonts and the advanced font settings |
20 * extension URL. | 18 * extension URL. |
21 */ | 19 */ |
22 fetchFontsData: assertNotReached, | 20 fetchFontsData() {} |
23 | 21 |
24 observeAdvancedFontExtensionAvailable: assertNotReached, | 22 observeAdvancedFontExtensionAvailable() {} |
25 | 23 |
26 openAdvancedFontSettings: assertNotReached, | 24 openAdvancedFontSettings() {} |
scottchen
2017/06/27 21:14:10
for future readers:
Had a discussion with @dpapad
| |
27 }; | 25 } |
28 | 26 |
29 /** | 27 /** |
30 * @implements {settings.FontsBrowserProxy} | 28 * @implements {settings.FontsBrowserProxy} |
31 * @constructor | |
32 */ | 29 */ |
33 function FontsBrowserProxyImpl() {} | 30 class FontsBrowserProxyImpl { |
31 /** @override */ | |
32 fetchFontsData() { | |
33 return cr.sendWithPromise('fetchFontsData'); | |
34 } | |
35 | |
36 /** @override */ | |
37 observeAdvancedFontExtensionAvailable() { | |
38 chrome.send('observeAdvancedFontExtensionAvailable'); | |
39 } | |
40 | |
41 /** @override */ | |
42 openAdvancedFontSettings() { | |
43 chrome.send('openAdvancedFontSettings'); | |
44 } | |
45 } | |
34 | 46 |
35 cr.addSingletonGetter(FontsBrowserProxyImpl); | 47 cr.addSingletonGetter(FontsBrowserProxyImpl); |
36 | 48 |
37 FontsBrowserProxyImpl.prototype = { | |
38 /** @override */ | |
39 fetchFontsData: function() { | |
40 return cr.sendWithPromise('fetchFontsData'); | |
41 }, | |
42 | |
43 /** @override */ | |
44 observeAdvancedFontExtensionAvailable: function() { | |
45 chrome.send('observeAdvancedFontExtensionAvailable'); | |
46 }, | |
47 | |
48 /** @override */ | |
49 openAdvancedFontSettings: function() { | |
50 chrome.send('openAdvancedFontSettings'); | |
51 } | |
52 }; | |
53 | |
54 return { | 49 return { |
55 FontsBrowserProxy: FontsBrowserProxy, | 50 FontsBrowserProxy: FontsBrowserProxy, |
56 FontsBrowserProxyImpl: FontsBrowserProxyImpl, | 51 FontsBrowserProxyImpl: FontsBrowserProxyImpl, |
57 }; | 52 }; |
58 }); | 53 }); |
OLD | NEW |