Chromium Code Reviews| Index: chrome/browser/resources/settings/people_page/easy_unlock_turn_off_dialog.js |
| diff --git a/chrome/browser/resources/settings/people_page/easy_unlock_turn_off_dialog.js b/chrome/browser/resources/settings/people_page/easy_unlock_turn_off_dialog.js |
| index cec540ad8915c5718805090aa7545dd1c4c48949..b0c8e0e398808b86c0d4091d5d55641be61c4619 100644 |
| --- a/chrome/browser/resources/settings/people_page/easy_unlock_turn_off_dialog.js |
| +++ b/chrome/browser/resources/settings/people_page/easy_unlock_turn_off_dialog.js |
| @@ -28,45 +28,36 @@ Polymer({ |
| properties: { |
| /** @private {!settings.EasyUnlockBrowserProxy} */ |
| - browserProxy_: Object, |
| + browserProxy_: { |
|
dpapad
2016/11/30 20:07:44
FWIW, we've started being OK with declaring browse
tommycli
2016/11/30 20:19:29
Done.
|
| + type: Object, |
| + value: function() { |
| + return settings.EasyUnlockBrowserProxyImpl.getInstance(); |
| + } |
| + }, |
| /** @private {!EasyUnlockTurnOffStatus} */ |
| status_: { |
| type: String, |
| value: EasyUnlockTurnOffStatus.UNKNOWN, |
| }, |
| - |
| - /** @private {?WebUIListener} */ |
| - turnOffStatusWebUiListener_: { |
| - type: Object, |
| - value: null, |
| - }, |
| }, |
| /** @override */ |
| - ready: function() { |
| - this.browserProxy_ = settings.EasyUnlockBrowserProxyImpl.getInstance(); |
| - |
| + attached: function() { |
| this.addWebUIListener( |
| 'easy-unlock-enabled-status', |
| this.handleEasyUnlockEnabledStatusChanged_.bind(this)); |
| - }, |
| - /** |
| - * Opens the dialog. |
| - */ |
| - open: function() { |
| + this.addWebUIListener( |
| + 'easy-unlock-turn-off-flow-status', |
| + function(status) { this.status_ = status; }.bind(this)); |
| + |
| + // Since the dialog text depends on the status, defer opening until we have |
| + // retrieved the turn off status to prevent UI flicker. |
| this.getTurnOffStatus_().then(function(status) { |
| this.status_ = status; |
| this.$.dialog.showModal(); |
| }.bind(this)); |
| - |
| - // The turn off flow status listener should only be active when the dialog |
| - // is actually open. |
| - assert(this.turnOffStatusWebUiListener_ == null); |
| - this.turnOffStatusWebUiListener_ = cr.addWebUIListener( |
| - 'easy-unlock-turn-off-flow-status', |
| - function(status) { this.status_ = status; }.bind(this)); |
| }, |
| /** |
| @@ -94,11 +85,6 @@ Polymer({ |
| /** @private */ |
| onCancelTap_: function() { |
| - if (this.turnOffStatusWebUiListener_) { |
| - cr.removeWebUIListener(this.turnOffStatusWebUiListener_); |
| - this.turnOffStatusWebUiListener_ = null; |
| - } |
| - |
| this.browserProxy_.cancelTurnOffFlow(); |
| this.$.dialog.close(); |
| }, |