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

Unified 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: add select.css 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/chromeos/oobe.js
diff --git a/chrome/browser/resources/chromeos/oobe.js b/chrome/browser/resources/chromeos/oobe.js
new file mode 100644
index 0000000000000000000000000000000000000000..8fc2b7e607db1709de3d1fbbff4cc56e286de229
--- /dev/null
+++ b/chrome/browser/resources/chromeos/oobe.js
@@ -0,0 +1,88 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
Evan Stade 2011/06/07 03:25:46 file level comment. I honestly have no idea what O
Nikita (slow) 2011/06/07 17:03:36 Done.
+var steps = ["connect", "eula", "update"];
+
+cr.define('cr.ui', function() {
+
+ function Oobe() {
Evan Stade 2011/06/07 03:25:46 this seems wrong.
Nikita (slow) 2011/06/07 17:03:36 You mean when there're no parameters I may as well
Evan Stade 2011/06/08 19:56:07 yes
Nikita (slow) 2011/06/08 22:28:27 Done.
Nikita (slow) 2011/06/09 15:52:14 I've got cr.js:315, Uncaught TypeError: Cannot set
Evan Stade 2011/06/09 22:38:46 uh, ok then. I guess add a function comment then w
Nikita (slow) 2011/06/10 09:21:39 Done.
+ }
+
+ cr.addSingletonGetter(Oobe);
+
+ Oobe.localStrings_ = new LocalStrings();
+
+ Oobe.prototype = {
+ initialized_: false,
+ current_step_: 0,
Evan Stade 2011/06/07 03:25:46 these are c style var names, instead they should b
Nikita (slow) 2011/06/07 17:03:36 Done.
+
+ toggleStep_: function(next_step) {
Evan Stade 2011/06/07 03:25:46 comment your functions
Nikita (slow) 2011/06/07 17:03:36 Done.
+ if (next_step >= 0 && next_step < steps.length) {
+ var offset = next_step - this.current_step_;
+ var oldstep = $(steps[this.current_step_]);
+ var oldheader = $("h" + steps[this.current_step_]);
+ var newstep = $(steps[this.current_step_ + offset]);
+ var newheader = $("h" + steps[this.current_step_ + offset]);
+
+ newstep.classList.remove("hidden");
+
+ if (offset == 1) {
+ oldheader.classList.add("left");
+ oldstep.classList.add("left");
+ newheader.classList.remove("right");
+ newstep.classList.remove("right");
+ } else if (offset == -1) {
+ oldheader.classList.add("right");
+ oldstep.classList.add("right");
+ newheader.classList.remove("left");
+ newstep.classList.remove("left");
+ }
+
+ // Adjust inner container height based on new step's height.
+ $("inner-container").style.height =
+ $(steps[this.current_step_ + offset]).offsetHeight;
+
+ setTimeout(function(){oldstep.classList.add('hidden');}, 500);
+ this.current_step_ += offset;
+ $("oobe").className = steps[this.current_step_];
+ }
+ },
+ };
+
+ Oobe.initialize = function() {
+ this.initialized_ = true;
+
+ // Adjust inner container height based on first step's height
+ $("inner-container").style.height = $(steps[0]).offsetHeight;
+
+ $('continue-button').addEventListener('click', function(event) {
+ // TODO(nkostylev): Callback screen handler.
+ Oobe.toggleStep(1);
+ });
+ $('back-button').addEventListener('click', function(event) {
+ // TODO(nkostylev): Callback screen handler.
+ Oobe.toggleStep(0);
+ });
+ $('accept-button').addEventListener('click', function(event) {
+ // TODO(nkostylev): Callback screen handler.
+ Oobe.toggleStep(2);
+ });
+
+ chrome.send('screenStateInitialize');
+ };
+
+ Oobe.toggleStep = function(next_step) {
+ Oobe.getInstance().toggleStep_(next_step);
+ };
+
+ // Export
+ return {
+ Oobe: Oobe
+ };
+
Evan Stade 2011/06/07 03:25:46 don't need this line return
Nikita (slow) 2011/06/07 17:03:36 Done.
+});
+
+var Oobe = cr.ui.Oobe;
+
+document.addEventListener('DOMContentLoaded', cr.ui.Oobe.initialize);

Powered by Google App Engine
This is Rietveld 408576698