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 dialog allowing the user to turn off the Easy Unlock feature. | 6 * @fileoverview A dialog allowing the user to turn off the Easy Unlock feature. |
7 */ | 7 */ |
8 | 8 |
9 cr.exportPath('settings'); | 9 cr.exportPath('settings'); |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 browserProxy_: null, | 40 browserProxy_: null, |
41 | 41 |
42 /** @override */ | 42 /** @override */ |
43 attached: function() { | 43 attached: function() { |
44 this.browserProxy_ = settings.EasyUnlockBrowserProxyImpl.getInstance(); | 44 this.browserProxy_ = settings.EasyUnlockBrowserProxyImpl.getInstance(); |
45 | 45 |
46 this.addWebUIListener( | 46 this.addWebUIListener( |
47 'easy-unlock-enabled-status', | 47 'easy-unlock-enabled-status', |
48 this.handleEasyUnlockEnabledStatusChanged_.bind(this)); | 48 this.handleEasyUnlockEnabledStatusChanged_.bind(this)); |
49 | 49 |
50 this.addWebUIListener('easy-unlock-turn-off-flow-status', function(status) { | 50 this.addWebUIListener('easy-unlock-turn-off-flow-status', status => { |
51 this.status_ = status; | 51 this.status_ = status; |
52 }.bind(this)); | 52 }); |
53 | 53 |
54 // Since the dialog text depends on the status, defer opening until we have | 54 // Since the dialog text depends on the status, defer opening until we have |
55 // retrieved the turn off status to prevent UI flicker. | 55 // retrieved the turn off status to prevent UI flicker. |
56 this.getTurnOffStatus_().then(function(status) { | 56 this.getTurnOffStatus_().then(status => { |
57 this.status_ = status; | 57 this.status_ = status; |
58 this.$.dialog.showModal(); | 58 this.$.dialog.showModal(); |
59 }.bind(this)); | 59 }); |
60 }, | 60 }, |
61 | 61 |
62 /** | 62 /** |
63 * @return {!Promise<!settings.EasyUnlockTurnOffStatus>} | 63 * @return {!Promise<!settings.EasyUnlockTurnOffStatus>} |
64 * @private | 64 * @private |
65 */ | 65 */ |
66 getTurnOffStatus_: function() { | 66 getTurnOffStatus_: function() { |
67 return navigator.onLine ? | 67 return navigator.onLine ? |
68 this.browserProxy_.getTurnOffFlowStatus() : | 68 this.browserProxy_.getTurnOffFlowStatus() : |
69 Promise.resolve(settings.EasyUnlockTurnOffStatus.OFFLINE); | 69 Promise.resolve(settings.EasyUnlockTurnOffStatus.OFFLINE); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 * @return {boolean} | 182 * @return {boolean} |
183 * @private | 183 * @private |
184 */ | 184 */ |
185 isTurnOffButtonEnabled_: function(status) { | 185 isTurnOffButtonEnabled_: function(status) { |
186 return status == settings.EasyUnlockTurnOffStatus.IDLE || | 186 return status == settings.EasyUnlockTurnOffStatus.IDLE || |
187 status == settings.EasyUnlockTurnOffStatus.SERVER_ERROR; | 187 status == settings.EasyUnlockTurnOffStatus.SERVER_ERROR; |
188 }, | 188 }, |
189 }); | 189 }); |
190 | 190 |
191 })(); | 191 })(); |
OLD | NEW |