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

Side by Side Diff: chrome/browser/resources/chromeos/login/screen_error_message.js

Issue 1411423006: Simplifed logic of showing/hiding cancel buttons on login screens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small fix. Created 5 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 Offline message screen implementation. 6 * @fileoverview Offline message screen implementation.
7 */ 7 */
8 8
9 login.createScreen('ErrorMessageScreen', 'error-message', function() { 9 login.createScreen('ErrorMessageScreen', 'error-message', function() {
10 var CONTEXT_KEY_ERROR_STATE_CODE = 'error-state-code'; 10 var CONTEXT_KEY_ERROR_STATE_CODE = 'error-state-code';
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 'setErrorState', 82 'setErrorState',
83 'showConnectingIndicator' 83 'showConnectingIndicator'
84 ], 84 ],
85 85
86 // Error screen initial UI state. 86 // Error screen initial UI state.
87 ui_state_: ERROR_SCREEN_UI_STATE.UNKNOWN, 87 ui_state_: ERROR_SCREEN_UI_STATE.UNKNOWN,
88 88
89 // Error screen initial error state. 89 // Error screen initial error state.
90 error_state_: ERROR_STATE.UNKNOWN, 90 error_state_: ERROR_STATE.UNKNOWN,
91 91
92 // Whether the screen can be cancelled.
93 cancelable_: false,
94 get cancelable() {
95 return this.cancelable_;
96 },
97 set cancelable(value) {
98 this.cancelable_ = value;
99 $('error-close-button').hidden = !value;
100 },
101
92 /** @override */ 102 /** @override */
93 decorate: function() { 103 decorate: function() {
94 cr.ui.DropDown.decorate($('offline-networks-list')); 104 cr.ui.DropDown.decorate($('offline-networks-list'));
95 this.updateLocalizedContent(); 105 this.updateLocalizedContent();
96 106
97 var self = this; 107 var self = this;
98 this.context.addObserver(CONTEXT_KEY_ERROR_STATE_CODE, 108 this.context.addObserver(CONTEXT_KEY_ERROR_STATE_CODE,
99 function(error_state) { 109 function(error_state) {
100 self.setErrorState(error_state); 110 self.setErrorState(error_state);
101 }); 111 });
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 }, 225 },
216 226
217 /** 227 /**
218 * Event handler that is invoked just before the screen in shown. 228 * Event handler that is invoked just before the screen in shown.
219 * @param {Object} data Screen init payload. 229 * @param {Object} data Screen init payload.
220 */ 230 */
221 onBeforeShow: function(data) { 231 onBeforeShow: function(data) {
222 cr.ui.Oobe.clearErrors(); 232 cr.ui.Oobe.clearErrors();
223 cr.ui.DropDown.show('offline-networks-list', false); 233 cr.ui.DropDown.show('offline-networks-list', false);
224 $('login-header-bar').signinUIState = SIGNIN_UI_STATE.ERROR; 234 $('login-header-bar').signinUIState = SIGNIN_UI_STATE.ERROR;
225 $('error-close-button').hidden = !$('login-header-bar').allowCancel; 235 this.cancelable = $('pod-row').pods.length;
226 }, 236 },
227 237
228 /** 238 /**
229 * Event handler that is invoked just before the screen is hidden. 239 * Event handler that is invoked just before the screen is hidden.
230 */ 240 */
231 onBeforeHide: function() { 241 onBeforeHide: function() {
232 cr.ui.DropDown.hide('offline-networks-list'); 242 cr.ui.DropDown.hide('offline-networks-list');
233 $('login-header-bar').signinUIState = SIGNIN_UI_STATE.HIDDEN; 243 $('login-header-bar').signinUIState = SIGNIN_UI_STATE.HIDDEN;
234 }, 244 },
235 245
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 */ 426 */
417 showConnectingIndicator: function(show) { 427 showConnectingIndicator: function(show) {
418 this.classList.toggle('show-connecting-indicator', show); 428 this.classList.toggle('show-connecting-indicator', show);
419 this.onContentChange_(); 429 this.onContentChange_();
420 }, 430 },
421 431
422 /** 432 /**
423 * Cancels error screen and drops to user pods. 433 * Cancels error screen and drops to user pods.
424 */ 434 */
425 cancel: function() { 435 cancel: function() {
426 if ($('login-header-bar').allowCancel) 436 if (this.cancelable)
427 Oobe.showUserPods(); 437 Oobe.showUserPods();
428 } 438 }
429 }; 439 };
430 }); 440 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698