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 the People section to get the | 6 * @fileoverview A helper object used from the the People section to get the |
7 * profile info, which consists of the profile name and icon. Used for both | 7 * profile info, which consists of the profile name and icon. Used for both |
8 * Chrome browser and ChromeOS. | 8 * Chrome browser and ChromeOS. |
9 */ | 9 */ |
10 cr.exportPath('settings'); | 10 cr.exportPath('settings'); |
11 | 11 |
12 /** | 12 /** |
13 * An object describing the profile. | 13 * An object describing the profile. |
14 * @typedef {{ | 14 * @typedef {{ |
15 * name: string, | 15 * name: string, |
16 * iconUrl: string | 16 * iconUrl: string |
17 * }} | 17 * }} |
18 */ | 18 */ |
19 settings.ProfileInfo; | 19 settings.ProfileInfo; |
20 | 20 |
21 cr.define('settings', function() { | 21 cr.define('settings', function() { |
22 /** @interface */ | 22 /** @interface */ |
23 function ProfileInfoBrowserProxy() {} | 23 class ProfileInfoBrowserProxy { |
24 | |
25 ProfileInfoBrowserProxy.prototype = { | |
26 /** | 24 /** |
27 * Returns a Promise for the profile info. | 25 * Returns a Promise for the profile info. |
28 * @return {!Promise<!settings.ProfileInfo>} | 26 * @return {!Promise<!settings.ProfileInfo>} |
29 */ | 27 */ |
30 getProfileInfo: function() {}, | 28 getProfileInfo() {} |
31 | 29 |
32 /** | 30 /** |
33 * Requests the profile stats count. The result is returned by the | 31 * Requests the profile stats count. The result is returned by the |
34 * 'profile-stats-count-ready' WebUI listener event. | 32 * 'profile-stats-count-ready' WebUI listener event. |
35 */ | 33 */ |
36 getProfileStatsCount: function() {}, | 34 getProfileStatsCount() {} |
37 | 35 |
38 /** | 36 /** |
39 * Returns a Promise that's true if the profile manages supervised users. | 37 * Returns a Promise that's true if the profile manages supervised users. |
40 * @return {!Promise<boolean>} | 38 * @return {!Promise<boolean>} |
41 */ | 39 */ |
42 getProfileManagesSupervisedUsers: function() {}, | 40 getProfileManagesSupervisedUsers() {} |
43 }; | 41 } |
44 | 42 |
45 /** | 43 /** |
46 * @constructor | |
47 * @implements {ProfileInfoBrowserProxy} | 44 * @implements {ProfileInfoBrowserProxy} |
48 */ | 45 */ |
49 function ProfileInfoBrowserProxyImpl() {} | 46 class ProfileInfoBrowserProxyImpl { |
50 cr.addSingletonGetter(ProfileInfoBrowserProxyImpl); | |
51 | |
52 ProfileInfoBrowserProxyImpl.prototype = { | |
53 /** @override */ | 47 /** @override */ |
54 getProfileInfo: function() { | 48 getProfileInfo() { |
55 return cr.sendWithPromise('getProfileInfo'); | 49 return cr.sendWithPromise('getProfileInfo'); |
56 }, | 50 } |
57 | 51 |
58 /** @override */ | 52 /** @override */ |
59 getProfileStatsCount: function() { | 53 getProfileStatsCount() { |
60 chrome.send('getProfileStatsCount'); | 54 chrome.send('getProfileStatsCount'); |
61 }, | 55 } |
62 | 56 |
63 /** @override */ | 57 /** @override */ |
64 getProfileManagesSupervisedUsers: function() { | 58 getProfileManagesSupervisedUsers() { |
65 return cr.sendWithPromise('getProfileManagesSupervisedUsers'); | 59 return cr.sendWithPromise('getProfileManagesSupervisedUsers'); |
66 }, | 60 } |
67 }; | 61 } |
| 62 |
| 63 cr.addSingletonGetter(ProfileInfoBrowserProxyImpl); |
68 | 64 |
69 return { | 65 return { |
70 ProfileInfoBrowserProxyImpl: ProfileInfoBrowserProxyImpl, | 66 ProfileInfoBrowserProxyImpl: ProfileInfoBrowserProxyImpl, |
71 }; | 67 }; |
72 }); | 68 }); |
OLD | NEW |