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 LifetimeBrowserProxy() {} | 7 class LifetimeBrowserProxy { |
8 | |
9 LifetimeBrowserProxy.prototype = { | |
10 // Triggers a browser restart. | 8 // Triggers a browser restart. |
11 restart: function() {}, | 9 restart() {} |
12 | 10 |
13 // Triggers a browser relaunch. | 11 // Triggers a browser relaunch. |
14 relaunch: function() {}, | 12 relaunch() {} |
15 | 13 |
16 // <if expr="chromeos"> | 14 // <if expr="chromeos"> |
17 // First signs out current user and then performs a restart. | 15 // First signs out current user and then performs a restart. |
18 signOutAndRestart: function() {}, | 16 signOutAndRestart() {} |
19 | 17 |
20 // Triggers a factory reset. | 18 // Triggers a factory reset. |
21 factoryReset: function() {}, | 19 factoryReset() {} |
22 // </if> | 20 // </if> |
23 }; | 21 } |
24 | 22 |
25 /** | 23 /** |
26 * @constructor | |
27 * @implements {settings.LifetimeBrowserProxy} | 24 * @implements {settings.LifetimeBrowserProxy} |
28 */ | 25 */ |
29 function LifetimeBrowserProxyImpl() {} | 26 class LifetimeBrowserProxyImpl { |
30 cr.addSingletonGetter(LifetimeBrowserProxyImpl); | |
31 | |
32 LifetimeBrowserProxyImpl.prototype = { | |
33 /** @override */ | 27 /** @override */ |
34 restart: function() { | 28 restart() { |
35 chrome.send('restart'); | 29 chrome.send('restart'); |
36 }, | 30 } |
37 | 31 |
38 /** @override */ | 32 /** @override */ |
39 relaunch: function() { | 33 relaunch() { |
40 chrome.send('relaunch'); | 34 chrome.send('relaunch'); |
41 }, | 35 } |
42 | 36 |
43 // <if expr="chromeos"> | 37 // <if expr="chromeos"> |
44 /** @override */ | 38 /** @override */ |
45 signOutAndRestart: function() { | 39 signOutAndRestart() { |
46 chrome.send('signOutAndRestart'); | 40 chrome.send('signOutAndRestart'); |
47 }, | 41 } |
48 | 42 |
49 /** @override */ | 43 /** @override */ |
50 factoryReset: function() { | 44 factoryReset() { |
51 chrome.send('factoryReset'); | 45 chrome.send('factoryReset'); |
52 }, | 46 } |
53 // </if> | 47 // </if> |
54 }; | 48 } |
| 49 |
| 50 cr.addSingletonGetter(LifetimeBrowserProxyImpl); |
55 | 51 |
56 return { | 52 return { |
57 LifetimeBrowserProxy: LifetimeBrowserProxy, | 53 LifetimeBrowserProxy: LifetimeBrowserProxy, |
58 LifetimeBrowserProxyImpl: LifetimeBrowserProxyImpl, | 54 LifetimeBrowserProxyImpl: LifetimeBrowserProxyImpl, |
59 }; | 55 }; |
60 }); | 56 }); |
OLD | NEW |