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

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

Issue 7541047: CrOS OOBE: Fix OOBE step CSS class updating when jumping. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nits. Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 Out of the box experience flow (OOBE). 6 * @fileoverview Out of the box experience flow (OOBE).
7 * This is the main code for the OOBE WebUI implementation. 7 * This is the main code for the OOBE WebUI implementation.
8 */ 8 */
9 9
10 var localStrings = new LocalStrings(); 10 var localStrings = new LocalStrings();
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 if (buttons) { 74 if (buttons) {
75 var buttonStrip = $('button-strip'); 75 var buttonStrip = $('button-strip');
76 for (var i = 0; i < buttons.length; ++i) { 76 for (var i = 0; i < buttons.length; ++i) {
77 var button = buttons[i]; 77 var button = buttons[i];
78 buttonStrip.appendChild(button); 78 buttonStrip.appendChild(button);
79 } 79 }
80 } 80 }
81 }, 81 },
82 82
83 /** 83 /**
84 * Updates a step's css classes to reflect left, current, or right position.
85 * @param {number} stepIndex step index.
86 * @param {string} state one of 'left', 'current', 'right'.
87 */
88 updateStep_: function(stepIndex, state) {
89 var stepId = this.screens_[stepIndex];
90 var step = $(stepId);
91 var header = $('header-' + stepId);
92 var states = [ 'left', 'right', 'current' ];
93 for (var i = 0; i < states.length; ++i) {
94 if (states[i] != state) {
95 step.classList.remove(states[i]);
96 header.classList.remove(states[i]);
97 }
98 }
99 step.classList.add(state);
100 header.classList.add(state);
101 },
102
103 /**
84 * Switches to the next OOBE step. 104 * Switches to the next OOBE step.
85 * @param {number} nextStepIndex Index of the next step. 105 * @param {number} nextStepIndex Index of the next step.
86 */ 106 */
87 toggleStep_: function(nextStepIndex, screenData) { 107 toggleStep_: function(nextStepIndex, screenData) {
88 var currentStepId = this.screens_[this.currentStep_]; 108 var currentStepId = this.screens_[this.currentStep_];
89 var nextStepId = this.screens_[nextStepIndex]; 109 var nextStepId = this.screens_[nextStepIndex];
90 var oldStep = $(currentStepId); 110 var oldStep = $(currentStepId);
91 var oldHeader = $('header-' + currentStepId);
92 var newStep = $(nextStepId); 111 var newStep = $(nextStepId);
93 var newHeader = $('header-' + nextStepId); 112 var newHeader = $('header-' + nextStepId);
94 113
95 if (newStep.onBeforeShow) 114 if (newStep.onBeforeShow)
96 newStep.onBeforeShow(screenData); 115 newStep.onBeforeShow(screenData);
97 116
98 newStep.classList.remove('hidden'); 117 newStep.classList.remove('hidden');
99 118
100 if (Oobe.isOobeUI()) { 119 if (Oobe.isOobeUI()) {
101 // Start gliding animation for OOBE steps. 120 // Start gliding animation for OOBE steps.
102 if (nextStepIndex > this.currentStep_) { 121 if (nextStepIndex > this.currentStep_) {
103 oldHeader.classList.add('left'); 122 for (var i = this.currentStep_; i < nextStepIndex; ++i)
104 oldStep.classList.add('left'); 123 this.updateStep_(i, 'left');
105 newHeader.classList.remove('right'); 124 this.updateStep_(nextStepIndex, 'current');
106 newStep.classList.remove('right');
107 } else if (nextStepIndex < this.currentStep_) { 125 } else if (nextStepIndex < this.currentStep_) {
108 oldHeader.classList.add('right'); 126 for (var i = this.currentStep_; i > nextStepIndex; --i)
109 oldStep.classList.add('right'); 127 this.updateStep_(i, 'right');
110 newHeader.classList.remove('left'); 128 this.updateStep_(nextStepIndex, 'current');
111 newStep.classList.remove('left');
112 } 129 }
113 } else { 130 } else {
114 // Start fading animation for login display. 131 // Start fading animation for login display.
115 oldStep.classList.add('faded'); 132 oldStep.classList.add('faded');
116 newStep.classList.remove('faded'); 133 newStep.classList.remove('faded');
117 } 134 }
118 135
119 // Adjust inner container height based on new step's height. 136 // Adjust inner container height based on new step's height.
120 $('inner-container').style.height = newStep.offsetHeight + 'px'; 137 $('inner-container').style.height = newStep.offsetHeight + 'px';
121 138
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 document.onselectstart = function(e) { 543 document.onselectstart = function(e) {
527 e.preventDefault(); 544 e.preventDefault();
528 } 545 }
529 546
530 // Disable dragging. 547 // Disable dragging.
531 document.ondragstart = function(e) { 548 document.ondragstart = function(e) {
532 e.preventDefault(); 549 e.preventDefault();
533 } 550 }
534 551
535 document.addEventListener('DOMContentLoaded', cr.ui.Oobe.initialize); 552 document.addEventListener('DOMContentLoaded', cr.ui.Oobe.initialize);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698