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

Unified Diff: chrome/browser/resources/settings/people_page/easy_unlock_turn_off_dialog.js

Issue 2539733004: MD Settings: Overhaul Easy Unlock Turn Off Dialog. (Closed)
Patch Set: fix copy pasta Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/settings/people_page/people_page.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..0dd1da59ae4850187fe440313130567b157918f0 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
@@ -27,46 +27,34 @@ Polymer({
behaviors: [I18nBehavior, WebUIListenerBehavior],
properties: {
- /** @private {!settings.EasyUnlockBrowserProxy} */
- browserProxy_: Object,
-
/** @private {!EasyUnlockTurnOffStatus} */
status_: {
type: String,
value: EasyUnlockTurnOffStatus.UNKNOWN,
},
-
- /** @private {?WebUIListener} */
- turnOffStatusWebUiListener_: {
- type: Object,
- value: null,
- },
},
+ /** @private {settings.EasyUnlockBrowserProxy} */
+ browserProxy_: null,
+
/** @override */
- ready: function() {
+ attached: function() {
this.browserProxy_ = settings.EasyUnlockBrowserProxyImpl.getInstance();
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 +82,6 @@ Polymer({
/** @private */
onCancelTap_: function() {
- if (this.turnOffStatusWebUiListener_) {
- cr.removeWebUIListener(this.turnOffStatusWebUiListener_);
- this.turnOffStatusWebUiListener_ = null;
- }
-
this.browserProxy_.cancelTurnOffFlow();
this.$.dialog.close();
},
« no previous file with comments | « no previous file | chrome/browser/resources/settings/people_page/people_page.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698