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

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

Issue 2617663002: WIP: run clang-format-js on lots of things (Closed)
Patch Set: merge Created 3 years, 11 months 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
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 f63503e857564a57642e183ba7f5741048c6e513..857b58ebd3787f5d9f6dd47b999d24d8be7ab403 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
@@ -23,169 +23,171 @@ settings.EasyUnlockTurnOffStatus = {
(function() {
-Polymer({
- is: 'easy-unlock-turn-off-dialog',
+ Polymer({
+ is: 'easy-unlock-turn-off-dialog',
- behaviors: [I18nBehavior, WebUIListenerBehavior],
+ behaviors: [I18nBehavior, WebUIListenerBehavior],
- properties: {
- /** @private {!settings.EasyUnlockTurnOffStatus} */
- status_: {
- type: String,
- value: settings.EasyUnlockTurnOffStatus.UNKNOWN,
+ properties: {
+ /** @private {!settings.EasyUnlockTurnOffStatus} */
+ status_: {
+ type: String,
+ value: settings.EasyUnlockTurnOffStatus.UNKNOWN,
+ },
},
- },
- /** @private {settings.EasyUnlockBrowserProxy} */
- browserProxy_: null,
+ /** @private {settings.EasyUnlockBrowserProxy} */
+ browserProxy_: null,
+
+ /** @override */
+ attached: function() {
+ this.browserProxy_ = settings.EasyUnlockBrowserProxyImpl.getInstance();
+
+ this.addWebUIListener(
+ 'easy-unlock-enabled-status',
+ this.handleEasyUnlockEnabledStatusChanged_.bind(this));
+
+ 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));
+ },
- /** @override */
- attached: function() {
- this.browserProxy_ = settings.EasyUnlockBrowserProxyImpl.getInstance();
+ /**
+ * @return {!Promise<!settings.EasyUnlockTurnOffStatus>}
+ * @private
+ */
+ getTurnOffStatus_: function() {
+ return navigator.onLine ?
+ this.browserProxy_.getTurnOffFlowStatus() :
+ Promise.resolve(settings.EasyUnlockTurnOffStatus.OFFLINE);
+ },
- this.addWebUIListener(
- 'easy-unlock-enabled-status',
- this.handleEasyUnlockEnabledStatusChanged_.bind(this));
+ /**
+ * This dialog listens for Easy Unlock to become disabled. This signals
+ * that the turnoff process has succeeded. Regardless of whether the turnoff
+ * was initiated from this tab or another, this closes the dialog.
+ * @param {boolean} easyUnlockEnabled
+ * @private
+ */
+ handleEasyUnlockEnabledStatusChanged_: function(easyUnlockEnabled) {
+ var dialog = /** @type {!CrDialogElement} */ this.$.dialog;
+ if (!easyUnlockEnabled && dialog.open)
+ this.onCancelTap_();
+ },
- this.addWebUIListener(
- 'easy-unlock-turn-off-flow-status',
- function(status) { this.status_ = status; }.bind(this));
+ /** @private */
+ onCancelTap_: function() {
+ this.browserProxy_.cancelTurnOffFlow();
+ this.$.dialog.close();
+ },
- // 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));
- },
+ /** @private */
+ onTurnOffTap_: function() {
+ this.browserProxy_.startTurnOffFlow();
+ },
- /**
- * @return {!Promise<!settings.EasyUnlockTurnOffStatus>}
- * @private
- */
- getTurnOffStatus_: function() {
- return navigator.onLine ?
- this.browserProxy_.getTurnOffFlowStatus() :
- Promise.resolve(settings.EasyUnlockTurnOffStatus.OFFLINE);
- },
-
- /**
- * This dialog listens for Easy Unlock to become disabled. This signals
- * that the turnoff process has succeeded. Regardless of whether the turnoff
- * was initiated from this tab or another, this closes the dialog.
- * @param {boolean} easyUnlockEnabled
- * @private
- */
- handleEasyUnlockEnabledStatusChanged_: function(easyUnlockEnabled) {
- var dialog = /** @type {!CrDialogElement} */ this.$.dialog;
- if (!easyUnlockEnabled && dialog.open)
- this.onCancelTap_();
- },
-
- /** @private */
- onCancelTap_: function() {
- this.browserProxy_.cancelTurnOffFlow();
- this.$.dialog.close();
- },
-
- /** @private */
- onTurnOffTap_: function() {
- this.browserProxy_.startTurnOffFlow();
- },
-
- /**
+ /**
* @param {!settings.EasyUnlockTurnOffStatus} status
* @return {string}
* @private
*/
- getTitleText_: function(status) {
- switch (status) {
- case settings.EasyUnlockTurnOffStatus.OFFLINE:
- return this.i18n('easyUnlockTurnOffOfflineTitle');
- case settings.EasyUnlockTurnOffStatus.UNKNOWN:
- case settings.EasyUnlockTurnOffStatus.IDLE:
- case settings.EasyUnlockTurnOffStatus.PENDING:
- return this.i18n('easyUnlockTurnOffTitle');
- case settings.EasyUnlockTurnOffStatus.SERVER_ERROR:
- return this.i18n('easyUnlockTurnOffErrorTitle');
- }
- assertNotReached();
- },
-
- /**
+ getTitleText_: function(status) {
+ switch (status) {
+ case settings.EasyUnlockTurnOffStatus.OFFLINE:
+ return this.i18n('easyUnlockTurnOffOfflineTitle');
+ case settings.EasyUnlockTurnOffStatus.UNKNOWN:
+ case settings.EasyUnlockTurnOffStatus.IDLE:
+ case settings.EasyUnlockTurnOffStatus.PENDING:
+ return this.i18n('easyUnlockTurnOffTitle');
+ case settings.EasyUnlockTurnOffStatus.SERVER_ERROR:
+ return this.i18n('easyUnlockTurnOffErrorTitle');
+ }
+ assertNotReached();
+ },
+
+ /**
* @param {!settings.EasyUnlockTurnOffStatus} status
* @return {string}
* @private
*/
- getDescriptionText_: function(status) {
- switch (status) {
- case settings.EasyUnlockTurnOffStatus.OFFLINE:
- return this.i18n('easyUnlockTurnOffOfflineMessage');
- case settings.EasyUnlockTurnOffStatus.UNKNOWN:
- case settings.EasyUnlockTurnOffStatus.IDLE:
- case settings.EasyUnlockTurnOffStatus.PENDING:
- return this.i18n('easyUnlockTurnOffDescription');
- case settings.EasyUnlockTurnOffStatus.SERVER_ERROR:
- return this.i18n('easyUnlockTurnOffErrorMessage');
- }
- assertNotReached();
- },
-
- /**
+ getDescriptionText_: function(status) {
+ switch (status) {
+ case settings.EasyUnlockTurnOffStatus.OFFLINE:
+ return this.i18n('easyUnlockTurnOffOfflineMessage');
+ case settings.EasyUnlockTurnOffStatus.UNKNOWN:
+ case settings.EasyUnlockTurnOffStatus.IDLE:
+ case settings.EasyUnlockTurnOffStatus.PENDING:
+ return this.i18n('easyUnlockTurnOffDescription');
+ case settings.EasyUnlockTurnOffStatus.SERVER_ERROR:
+ return this.i18n('easyUnlockTurnOffErrorMessage');
+ }
+ assertNotReached();
+ },
+
+ /**
* @param {!settings.EasyUnlockTurnOffStatus} status
* @return {string}
* @private
*/
- getTurnOffButtonText_: function(status) {
- switch (status) {
- case settings.EasyUnlockTurnOffStatus.OFFLINE:
- return '';
- case settings.EasyUnlockTurnOffStatus.UNKNOWN:
- case settings.EasyUnlockTurnOffStatus.IDLE:
- case settings.EasyUnlockTurnOffStatus.PENDING:
- return this.i18n('easyUnlockTurnOffButton');
- case settings.EasyUnlockTurnOffStatus.SERVER_ERROR:
- return this.i18n('easyUnlockTurnOffRetryButton');
- }
- assertNotReached();
- },
-
- /**
+ getTurnOffButtonText_: function(status) {
+ switch (status) {
+ case settings.EasyUnlockTurnOffStatus.OFFLINE:
+ return '';
+ case settings.EasyUnlockTurnOffStatus.UNKNOWN:
+ case settings.EasyUnlockTurnOffStatus.IDLE:
+ case settings.EasyUnlockTurnOffStatus.PENDING:
+ return this.i18n('easyUnlockTurnOffButton');
+ case settings.EasyUnlockTurnOffStatus.SERVER_ERROR:
+ return this.i18n('easyUnlockTurnOffRetryButton');
+ }
+ assertNotReached();
+ },
+
+ /**
* @param {!settings.EasyUnlockTurnOffStatus} status
* @return {boolean}
* @private
*/
- isButtonBarHidden_: function(status) {
- return status == settings.EasyUnlockTurnOffStatus.OFFLINE;
- },
+ isButtonBarHidden_: function(status) {
+ return status == settings.EasyUnlockTurnOffStatus.OFFLINE;
+ },
- /**
+ /**
* @param {!settings.EasyUnlockTurnOffStatus} status
* @return {boolean}
* @private
*/
- isSpinnerActive_: function(status) {
- return status == settings.EasyUnlockTurnOffStatus.PENDING;
- },
+ isSpinnerActive_: function(status) {
+ return status == settings.EasyUnlockTurnOffStatus.PENDING;
+ },
- /**
+ /**
* @param {!settings.EasyUnlockTurnOffStatus} status
* @return {boolean}
* @private
*/
- isCancelButtonHidden_: function(status) {
- return status == settings.EasyUnlockTurnOffStatus.SERVER_ERROR;
- },
+ isCancelButtonHidden_: function(status) {
+ return status == settings.EasyUnlockTurnOffStatus.SERVER_ERROR;
+ },
- /**
+ /**
* @param {!settings.EasyUnlockTurnOffStatus} status
* @return {boolean}
* @private
*/
- isTurnOffButtonEnabled_: function(status) {
- return status == settings.EasyUnlockTurnOffStatus.IDLE ||
- status == settings.EasyUnlockTurnOffStatus.SERVER_ERROR;
- },
-});
+ isTurnOffButtonEnabled_: function(status) {
+ return status == settings.EasyUnlockTurnOffStatus.IDLE ||
+ status == settings.EasyUnlockTurnOffStatus.SERVER_ERROR;
+ },
+ });
})();

Powered by Google App Engine
This is Rietveld 408576698