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

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

Issue 7058048: [cros] Layout for OOBE WebUI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 years, 6 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 /**
6 * @fileoverview Out of the box experience flow (OOBE).
7 * This is the main code for the OOBE WebUI implementation.
8 */
9
10 const steps = ['connect', 'eula', 'update'];
11
12 cr.define('cr.ui', function() {
13 function Oobe() {
14 }
15
16 cr.addSingletonGetter(Oobe);
17
18 Oobe.localStrings_ = new LocalStrings();
19
20 Oobe.prototype = {
21 /**
22 * Current OOBE step, index in the steps array.
23 * @type {number}
24 */
25 currentStep_: 0,
26
27 /**
28 * Switches to the next OOBE step.
29 * @param {number} nextStep Index of the next step.
30 */
31 toggleStep_: function(nextStep) {
32 var offset = nextStep - this.currentStep_;
33 var oldstep = $(steps[this.currentStep_]);
34 var oldheader = $('header-' + steps[this.currentStep_]);
35 var newstep = $(steps[this.currentStep_ + offset]);
Evan Stade 2011/06/09 22:38:46 again you are using offset here, and twice more be
Nikita (slow) 2011/06/10 09:21:39 Done.
36 var newheader = $('header-' + steps[this.currentStep_ + offset]);
37
38 newstep.classList.remove('hidden');
39
40 // TODO(nkostylev): Support offset other than -1/1.
41 if (offset == 1) {
42 oldheader.classList.add('left');
43 oldstep.classList.add('left');
44 newheader.classList.remove('right');
45 newstep.classList.remove('right');
46 } else if (offset == -1) {
47 oldheader.classList.add('right');
48 oldstep.classList.add('right');
49 newheader.classList.remove('left');
50 newstep.classList.remove('left');
51 }
52
53 // Adjust inner container height based on new step's height.
54 $('inner-container').style.height =
55 $(steps[this.currentStep_ + offset]).offsetHeight;
Evan Stade 2011/06/09 22:38:46 isn't this newstep?
Nikita (slow) 2011/06/10 09:21:39 Done.
56
57 oldstep.addEventListener('webkitTransitionEnd', function f(e) {
58 oldstep.removeEventListener('webkitTransitionEnd', f);
59 oldstep.classList.add('hidden');
60 });
61 this.currentStep_ = nextStep;
62 $('oobe').className = steps[this.currentStep_];
63 },
64 };
65
66 /**
67 * Initializes the OOBE flow. This will cause all C++ handlers to
68 * be invoked to do final setup.
69 */
70 Oobe.initialize = function() {
71 // Adjust inner container height based on first step's height
72 $('inner-container').style.height = $(steps[0]).offsetHeight;
73
74 $('continue-button').addEventListener('click', function(event) {
75 // TODO(nkostylev): Callback screen handler.
76 Oobe.toggleStep(1);
Evan Stade 2011/06/09 22:38:46 don't you need to getInstance?
Nikita (slow) 2011/06/10 09:21:39 No, Oobe.toggleStep() is defined separately and it
77 });
78 $('back-button').addEventListener('click', function(event) {
79 // TODO(nkostylev): Callback screen handler.
80 Oobe.toggleStep(0);
81 });
82 $('accept-button').addEventListener('click', function(event) {
83 // TODO(nkostylev): Callback screen handler.
84 Oobe.toggleStep(2);
85 });
86
87 chrome.send('screenStateInitialize');
88 };
89
90 /**
91 * Switches to the next OOBE step.
92 * @param {number} nextStep Index of the next step.
93 */
94 Oobe.toggleStep = function(nextStep) {
95 Oobe.getInstance().toggleStep_(nextStep);
96 };
97
98 // Export
99 return {
100 Oobe: Oobe
101 };
102 });
103
104 var Oobe = cr.ui.Oobe;
105
106 document.addEventListener('DOMContentLoaded', cr.ui.Oobe.initialize);
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/oobe.html ('k') | chrome/browser/resources/chromeos/proxy_settings.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698