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

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: 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 if (buttons) { 70 if (buttons) {
71 var buttonStrip = $('button-strip'); 71 var buttonStrip = $('button-strip');
72 for (var i = 0; i < buttons.length; ++i) { 72 for (var i = 0; i < buttons.length; ++i) {
73 var button = buttons[i]; 73 var button = buttons[i];
74 buttonStrip.appendChild(button); 74 buttonStrip.appendChild(button);
75 } 75 }
76 } 76 }
77 }, 77 },
78 78
79 /** 79 /**
80 * Updates a step's css classes to reflect left, current, or right position.
81 * @param {number} stepIndex step index.
82 * @param {state} state one of 'left', 'current', 'right'.
xiyuan 2011/08/05 19:51:29 nit: {string}
Mattias Nissler (ping if slow) 2011/08/08 11:23:40 Done.
83 */
84 updateStep_: function(stepIndex, state) {
85 var stepId = this.screens_[stepIndex];
86 var step = $(stepId);
87 var header = $('header-' + stepId);
88 var states = [ 'left', 'right', 'current' ];
89 for (var i = 0; i < states.length; ++i) {
90 if (states[i] != state) {
91 step.classList.remove(states[i]);
92 header.classList.remove(states[i]);
93 }
94 }
95 step.classList.add(state);
96 header.classList.add(state);
97 },
98
99 /**
80 * Switches to the next OOBE step. 100 * Switches to the next OOBE step.
81 * @param {number} nextStepIndex Index of the next step. 101 * @param {number} nextStepIndex Index of the next step.
82 */ 102 */
83 toggleStep_: function(nextStepIndex, screenData) { 103 toggleStep_: function(nextStepIndex, screenData) {
84 var currentStepId = this.screens_[this.currentStep_]; 104 var currentStepId = this.screens_[this.currentStep_];
85 var nextStepId = this.screens_[nextStepIndex]; 105 var nextStepId = this.screens_[nextStepIndex];
86 var oldStep = $(currentStepId); 106 var oldStep = $(currentStepId);
87 var oldHeader = $('header-' + currentStepId);
88 var newStep = $(nextStepId); 107 var newStep = $(nextStepId);
89 var newHeader = $('header-' + nextStepId); 108 var newHeader = $('header-' + nextStepId);
90 109
91 if (newStep.onBeforeShow) 110 if (newStep.onBeforeShow)
92 newStep.onBeforeShow(screenData); 111 newStep.onBeforeShow(screenData);
93 112
94 newStep.classList.remove('hidden'); 113 newStep.classList.remove('hidden');
95 114
96 if (Oobe.isOobeUI()) { 115 if (Oobe.isOobeUI()) {
97 // Start gliding animation for OOBE steps. 116 // Start gliding animation for OOBE steps.
98 if (nextStepIndex > this.currentStep_) { 117 if (nextStepIndex > this.currentStep_) {
99 oldHeader.classList.add('left'); 118 for (var i = this.currentStep_; i < nextStepIndex; ++i)
100 oldStep.classList.add('left'); 119 this.updateStep_(i, 'left');
101 newHeader.classList.remove('right'); 120 this.updateStep_(nextStepIndex, 'current');
102 newStep.classList.remove('right');
103 } else if (nextStepIndex < this.currentStep_) { 121 } else if (nextStepIndex < this.currentStep_) {
104 oldHeader.classList.add('right'); 122 for (var i = this.currentStep_; i > nextStepIndex; --i)
105 oldStep.classList.add('right'); 123 this.updateStep_(i, 'right');
106 newHeader.classList.remove('left'); 124 this.updateStep_(nextStepIndex, 'current');
107 newStep.classList.remove('left');
108 } 125 }
109 } else { 126 } else {
110 // Start fading animation for login display. 127 // Start fading animation for login display.
111 oldStep.classList.add('faded'); 128 oldStep.classList.add('faded');
112 newStep.classList.remove('faded'); 129 newStep.classList.remove('faded');
113 } 130 }
114 131
115 // Adjust inner container height based on new step's height. 132 // Adjust inner container height based on new step's height.
116 $('inner-container').style.height = newStep.offsetHeight + 'px'; 133 $('inner-container').style.height = newStep.offsetHeight + 'px';
117 134
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 document.onselectstart = function(e) { 557 document.onselectstart = function(e) {
541 e.preventDefault(); 558 e.preventDefault();
542 } 559 }
543 560
544 // Disable dragging. 561 // Disable dragging.
545 document.ondragstart = function(e) { 562 document.ondragstart = function(e) {
546 e.preventDefault(); 563 e.preventDefault();
547 } 564 }
548 565
549 document.addEventListener('DOMContentLoaded', cr.ui.Oobe.initialize); 566 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