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

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

Issue 2756863002: ChromeOS: Powerwash UI update (Closed)
Patch Set: Minor change: help link visibility Created 3 years, 8 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 Device reset screen implementation. 6 * @fileoverview Device reset screen implementation.
7 */ 7 */
8 8
9 login.createScreen('ResetScreen', 'reset', function() { 9 login.createScreen('ResetScreen', 'reset', function() {
10 var USER_ACTION_CANCEL_RESET = 'cancel-reset'; 10 var USER_ACTION_CANCEL_RESET = 'cancel-reset';
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 announceAccessibleMessage( 75 announceAccessibleMessage(
76 loadTimeData.getString('resetRevertSpinnerMessage')); 76 loadTimeData.getString('resetRevertSpinnerMessage'));
77 } 77 }
78 } 78 }
79 ); 79 );
80 80
81 this.context.addObserver( 81 this.context.addObserver(
82 CONTEXT_KEY_IS_OFFICIAL_BUILD, 82 CONTEXT_KEY_IS_OFFICIAL_BUILD,
83 function(isOfficial) { 83 function(isOfficial) {
84 $('powerwash-help-link').setAttribute('hidden', !isOfficial); 84 $('powerwash-help-link').setAttribute('hidden', !isOfficial);
85 $('oobe-reset-md').isOfficial_ = isOfficial;
85 } 86 }
86 ); 87 );
87 this.context.addObserver( 88 this.context.addObserver(
88 CONTEXT_KEY_ROLLBACK_CHECKED, 89 CONTEXT_KEY_ROLLBACK_CHECKED,
89 function(rollbackChecked) { 90 function(rollbackChecked) {
90 self.setRollbackOptionView(); 91 self.setRollbackOptionView();
91 } 92 }
92 ); 93 );
93 this.context.addObserver( 94 this.context.addObserver(
94 CONTEXT_KEY_ROLLBACK_AVAILABLE, 95 CONTEXT_KEY_ROLLBACK_AVAILABLE,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 buttons.push(cancelButton); 158 buttons.push(cancelButton);
158 159
159 return buttons; 160 return buttons;
160 }, 161 },
161 162
162 /** 163 /**
163 * Returns a control which should receive an initial focus. 164 * Returns a control which should receive an initial focus.
164 */ 165 */
165 get defaultControl() { 166 get defaultControl() {
166 // choose 167 // choose
168 if (loadTimeData.getString('newOobeUI') == 'on')
jdufault 2017/04/06 01:04:52 create helper function for loadTimeData.getString(
Wenzhao (Colin) Zang 2017/04/07 02:55:36 Done.
169 return $('oobe-reset-md');
167 if (this.context.get(CONTEXT_KEY_SCREEN_STATE, 170 if (this.context.get(CONTEXT_KEY_SCREEN_STATE,
168 this.RESET_SCREEN_STATE.RESTART_REQUIRED) == 171 this.RESET_SCREEN_STATE.RESTART_REQUIRED) ==
169 this.RESET_SCREEN_STATE.RESTART_REQUIRED) 172 this.RESET_SCREEN_STATE.RESTART_REQUIRED)
170 return $('reset-restart-button'); 173 return $('reset-restart-button');
171 if (this.context.get(CONTEXT_KEY_IS_CONFIRMATIONAL_VIEW, false)) 174 if (this.context.get(CONTEXT_KEY_IS_CONFIRMATIONAL_VIEW, false))
172 return $('reset-confirm-commit'); 175 return $('reset-confirm-commit');
173 return $('reset-toconfirm-button'); 176 return $('reset-toconfirm-button');
174 }, 177 },
175 178
176 /** 179 /**
177 * Cancels the reset and drops the user back to the login screen. 180 * Cancels the reset and drops the user back to the login screen.
178 */ 181 */
179 cancel: function() { 182 cancel: function() {
180 if (this.context.get(CONTEXT_KEY_IS_CONFIRMATIONAL_VIEW, false)) { 183 if (this.context.get(CONTEXT_KEY_IS_CONFIRMATIONAL_VIEW, false)) {
181 $('reset').send(login.Screen.CALLBACK_USER_ACTED, 184 $('reset').send(login.Screen.CALLBACK_USER_ACTED,
182 USER_ACTION_RESET_CONFIRM_DISMISSED); 185 USER_ACTION_RESET_CONFIRM_DISMISSED);
183 return; 186 return;
184 } 187 }
185 this.send(login.Screen.CALLBACK_USER_ACTED, USER_ACTION_CANCEL_RESET); 188 this.send(login.Screen.CALLBACK_USER_ACTED, USER_ACTION_CANCEL_RESET);
186 }, 189 },
187 190
188 /** 191 /**
192 * This method takes care of switching to material-design OOBE.
193 * @private
194 */
195 setMDMode_: function() {
jdufault 2017/04/06 01:04:52 nit: showMdMode_
Wenzhao (Colin) Zang 2017/04/07 02:55:36 Since setMDMode_ is used in all other files, I wan
196 var useMDOobe = (loadTimeData.getString('newOobeUI') == 'on');
jdufault 2017/04/06 01:04:52 nit: useMdOobe
Wenzhao (Colin) Zang 2017/04/07 02:55:36 Acknowledged.
197 $('oobe-reset-md').hidden = !useMDOobe;
198 $('reset-confirm-overlay-md').hidden = !useMDOobe;
199 $('oobe-reset').hidden = useMDOobe;
200 $('reset-confirm-overlay').hidden = useMDOobe;
201 if (useMDOobe) {
202 $('reset').setAttribute('md-mode', 'true');
203 $('overlay-reset').setAttribute('md-mode', 'true');
204 } else {
205 $('reset').removeAttribute('md-mode');
206 $('overlay-reset').removeAttribute('md-mode');
207 }
208 },
209
210 /**
189 * Event handler that is invoked just before the screen in shown. 211 * Event handler that is invoked just before the screen in shown.
190 * @param {Object} data Screen init payload. 212 * @param {Object} data Screen init payload.
191 */ 213 */
192 onBeforeShow: function(data) { 214 onBeforeShow: function(data) {
215 this.setMDMode_();
193 }, 216 },
194 217
195 /** 218 /**
196 * Sets css style for corresponding state of the screen. 219 * Sets css style for corresponding state of the screen.
197 * @private 220 * @private
198 */ 221 */
199 setDialogView_: function(state) { 222 setDialogView_: function(state) {
200 state = this.ui_state; 223 state = this.ui_state;
201 var resetOverlay = $('reset-confirm-overlay'); 224 var resetOverlay = $('reset-confirm-overlay');
202 this.classList.toggle( 225 this.classList.toggle(
203 'revert-promise-view', 226 'revert-promise-view',
204 state == this.RESET_SCREEN_UI_STATE.REVERT_PROMISE); 227 state == this.RESET_SCREEN_UI_STATE.REVERT_PROMISE);
205 this.classList.toggle( 228 this.classList.toggle(
206 'restart-required-view', 229 'restart-required-view',
207 state == this.RESET_SCREEN_UI_STATE.RESTART_REQUIRED); 230 state == this.RESET_SCREEN_UI_STATE.RESTART_REQUIRED);
208 this.classList.toggle( 231 this.classList.toggle(
209 'powerwash-proposal-view', 232 'powerwash-proposal-view',
210 state == this.RESET_SCREEN_UI_STATE.POWERWASH_PROPOSAL); 233 state == this.RESET_SCREEN_UI_STATE.POWERWASH_PROPOSAL);
211 resetOverlay.classList.toggle( 234 resetOverlay.classList.toggle(
212 'powerwash-proposal-view', 235 'powerwash-proposal-view',
213 state == this.RESET_SCREEN_UI_STATE.POWERWASH_PROPOSAL); 236 state == this.RESET_SCREEN_UI_STATE.POWERWASH_PROPOSAL);
214 this.classList.toggle( 237 this.classList.toggle(
215 'rollback-proposal-view', 238 'rollback-proposal-view',
216 state == this.RESET_SCREEN_UI_STATE.ROLLBACK_PROPOSAL); 239 state == this.RESET_SCREEN_UI_STATE.ROLLBACK_PROPOSAL);
217 resetOverlay.classList.toggle( 240 resetOverlay.classList.toggle(
218 'rollback-proposal-view', 241 'rollback-proposal-view',
219 state == this.RESET_SCREEN_UI_STATE.ROLLBACK_PROPOSAL); 242 state == this.RESET_SCREEN_UI_STATE.ROLLBACK_PROPOSAL);
243 var resetMd = $('oobe-reset-md');
244 var resetOverlayMd = $('reset-confirm-overlay-md');
245 if (state == this.RESET_SCREEN_UI_STATE.RESTART_REQUIRED) {
246 resetMd.uiState_ = 1;
247 }
248 if (state == this.RESET_SCREEN_UI_STATE.POWERWASH_PROPOSAL) {
249 resetMd.uiState_ = 2;
250 resetOverlayMd.isPowerwashView_ = true;
251 }
252 if (state == this.RESET_SCREEN_UI_STATE.ROLLBACK_PROPOSAL) {
253 resetMd.uiState_ = 4;
254 resetOverlayMd.isPowerwashView_ = false;
255 }
256 if (state == this.RESET_SCREEN_UI_STATE.REVERT_PROMISE) {
257 resetMd.uiState_ = 8;
258 }
220 }, 259 },
221 260
222 setRollbackOptionView: function() { 261 setRollbackOptionView: function() {
223 if (this.context.get(CONTEXT_KEY_IS_CONFIRMATIONAL_VIEW, false)) 262 if (this.context.get(CONTEXT_KEY_IS_CONFIRMATIONAL_VIEW, false))
224 return; 263 return;
225 if (this.context.get(CONTEXT_KEY_SCREEN_STATE) != 264 if (this.context.get(CONTEXT_KEY_SCREEN_STATE) !=
226 this.RESET_SCREEN_STATE.POWERWASH_PROPOSAL) 265 this.RESET_SCREEN_STATE.POWERWASH_PROPOSAL)
227 return; 266 return;
228 267
229 if (this.context.get(CONTEXT_KEY_ROLLBACK_AVAILABLE, false) && 268 if (this.context.get(CONTEXT_KEY_ROLLBACK_AVAILABLE, false) &&
230 this.context.get(CONTEXT_KEY_ROLLBACK_CHECKED, false)) { 269 this.context.get(CONTEXT_KEY_ROLLBACK_CHECKED, false)) {
231 // show rollback option 270 // show rollback option
232 $('reset-toconfirm-button').textContent = loadTimeData.getString( 271 $('reset-toconfirm-button').textContent = loadTimeData.getString(
233 'resetButtonPowerwashAndRollback'); 272 'resetButtonPowerwashAndRollback');
234 this.ui_state = this.RESET_SCREEN_UI_STATE.ROLLBACK_PROPOSAL; 273 this.ui_state = this.RESET_SCREEN_UI_STATE.ROLLBACK_PROPOSAL;
235 } else { 274 } else {
236 // hide rollback option 275 // hide rollback option
237 $('reset-toconfirm-button').textContent = loadTimeData.getString( 276 $('reset-toconfirm-button').textContent = loadTimeData.getString(
238 'resetButtonPowerwash'); 277 'resetButtonPowerwash');
239 this.ui_state = this.RESET_SCREEN_UI_STATE.POWERWASH_PROPOSAL; 278 this.ui_state = this.RESET_SCREEN_UI_STATE.POWERWASH_PROPOSAL;
240 } 279 }
241 this.setDialogView_(); 280 this.setDialogView_();
242 } 281 }
243 }; 282 };
244 }); 283 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698