Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: chrome/browser/resources/settings/appearance_page/appearance_browser_proxy.js

Issue 2954863003: MD Settings: Convert all browser proxies to use ES6 class syntax. (Closed)
Patch Set: Remove @constructor annotations. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 AppearanceBrowserProxy() {} 7 class AppearanceBrowserProxy {
8
9 AppearanceBrowserProxy.prototype = {
10 /** @return {!Promise<number>} */ 8 /** @return {!Promise<number>} */
11 getDefaultZoom: assertNotReached, 9 getDefaultZoom() {}
12 10
13 /** 11 /**
14 * @param {string} themeId 12 * @param {string} themeId
15 * @return {!Promise<!chrome.management.ExtensionInfo>} Theme info. 13 * @return {!Promise<!chrome.management.ExtensionInfo>} Theme info.
16 */ 14 */
17 getThemeInfo: assertNotReached, 15 getThemeInfo(themeId) {}
18 16
19 /** @return {boolean} Whether the current profile is supervised. */ 17 /** @return {boolean} Whether the current profile is supervised. */
20 isSupervised: assertNotReached, 18 isSupervised() {}
21 19
22 // <if expr="chromeos"> 20 // <if expr="chromeos">
23 openWallpaperManager: assertNotReached, 21 openWallpaperManager() {}
22
24 // </if> 23 // </if>
25 24
26 useDefaultTheme: assertNotReached, 25 useDefaultTheme() {}
27 26
28 // <if expr="is_linux and not chromeos"> 27 // <if expr="is_linux and not chromeos">
29 useSystemTheme: assertNotReached, 28 useSystemTheme() {}
29
30 // </if> 30 // </if>
31 31
32 /** 32 /**
33 * @param {string} url The url of which to check validity. 33 * @param {string} url The url of which to check validity.
34 * @return {!Promise<boolean>} 34 * @return {!Promise<boolean>}
35 */ 35 */
36 validateStartupPage: assertNotReached, 36 validateStartupPage(url) {}
37 }; 37 }
38 38
39 /** 39 /**
40 * @implements {settings.AppearanceBrowserProxy} 40 * @implements {settings.AppearanceBrowserProxy}
41 * @constructor
42 */ 41 */
43 function AppearanceBrowserProxyImpl() {} 42 class AppearanceBrowserProxyImpl {
43 /** @override */
44 getDefaultZoom() {
45 return new Promise(function(resolve) {
46 chrome.settingsPrivate.getDefaultZoom(resolve);
47 });
48 }
49
50 /** @override */
51 getThemeInfo(themeId) {
52 return new Promise(function(resolve) {
53 chrome.management.get(themeId, resolve);
54 });
55 }
56
57 /** @override */
58 isSupervised() {
59 return loadTimeData.getBoolean('isSupervised');
60 }
61
62 // <if expr="chromeos">
63 /** @override */
64 openWallpaperManager() {
65 chrome.send('openWallpaperManager');
66 }
67
68 // </if>
69
70 /** @override */
71 useDefaultTheme() {
72 chrome.send('useDefaultTheme');
73 }
74
75 // <if expr="is_linux and not chromeos">
76 /** @override */
77 useSystemTheme() {
78 chrome.send('useSystemTheme');
79 }
80
81 // </if>
82
83 /** @override */
84 validateStartupPage(url) {
85 return cr.sendWithPromise('validateStartupPage', url);
86 }
87 }
44 88
45 cr.addSingletonGetter(AppearanceBrowserProxyImpl); 89 cr.addSingletonGetter(AppearanceBrowserProxyImpl);
46 90
47 AppearanceBrowserProxyImpl.prototype = {
48 /** @override */
49 getDefaultZoom: function() {
50 return new Promise(function(resolve) {
51 chrome.settingsPrivate.getDefaultZoom(resolve);
52 });
53 },
54
55 /** @override */
56 getThemeInfo: function(themeId) {
57 return new Promise(function(resolve) {
58 chrome.management.get(themeId, resolve);
59 });
60 },
61
62 /** @override */
63 isSupervised: function() {
64 return loadTimeData.getBoolean('isSupervised');
65 },
66
67 // <if expr="chromeos">
68 /** @override */
69 openWallpaperManager: function() {
70 chrome.send('openWallpaperManager');
71 },
72 // </if>
73
74 /** @override */
75 useDefaultTheme: function() {
76 chrome.send('useDefaultTheme');
77 },
78
79 // <if expr="is_linux and not chromeos">
80 /** @override */
81 useSystemTheme: function() {
82 chrome.send('useSystemTheme');
83 },
84 // </if>
85
86 /** @override */
87 validateStartupPage: function(url) {
88 return cr.sendWithPromise('validateStartupPage', url);
89 },
90 };
91
92 return { 91 return {
93 AppearanceBrowserProxy: AppearanceBrowserProxy, 92 AppearanceBrowserProxy: AppearanceBrowserProxy,
94 AppearanceBrowserProxyImpl: AppearanceBrowserProxyImpl, 93 AppearanceBrowserProxyImpl: AppearanceBrowserProxyImpl,
95 }; 94 };
96 }); 95 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698