OLD | NEW |
(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 cr.define('cr.ui', function() { |
| 6 |
| 7 function Oobe() { |
| 8 } |
| 9 |
| 10 cr.addSingletonGetter(Oobe); |
| 11 |
| 12 // State of the screen. |
| 13 Oobe.SCREEN_LOADING = -1; |
| 14 Oobe.SCREEN_NONE = 0, |
| 15 Oobe.SCREEN_WELCOME = 1, |
| 16 Oobe.SCREEN_EULA = 2; |
| 17 Oobe.SCREEN_UPDATE = 3; |
| 18 |
| 19 Oobe.localStrings_ = new LocalStrings(); |
| 20 |
| 21 Oobe.prototype = { |
| 22 initialized_: false, |
| 23 state_: Oobe.SCREEN_LOADING, |
| 24 |
| 25 changeState_: function(screenInfo) { |
| 26 var newState = screenInfo.state; |
| 27 this.hideAll_(); |
| 28 switch(newState) { |
| 29 case Oobe.SCREEN_LOADING: |
| 30 break; |
| 31 case Oobe.SCREEN_NONE: |
| 32 break; |
| 33 case Oobe.SCREEN_WELCOME: |
| 34 $('welcome-screen').hidden = false; |
| 35 break; |
| 36 case Oobe.SCREEN_EULA: |
| 37 $('eula-screen').hidden = false; |
| 38 break; |
| 39 case Oobe.SCREEN_UPDATE: |
| 40 break; |
| 41 } |
| 42 this.state_ = newState; |
| 43 }, |
| 44 |
| 45 hideAll_: function() { |
| 46 $('welcome-screen').hidden = true; |
| 47 $('eula-screen').hidden = true; |
| 48 }, |
| 49 }; |
| 50 |
| 51 Oobe.initialize = function() { |
| 52 this.initialized_ = true; |
| 53 |
| 54 $('continue').addEventListener('click', function(event) { |
| 55 // TODO |
| 56 }); |
| 57 $('back').addEventListener('click', function(event) { |
| 58 // TODO |
| 59 }); |
| 60 $('accept').addEventListener('click', function(event) { |
| 61 // TODO |
| 62 }); |
| 63 chrome.send('screenStateInitialize'); |
| 64 }; |
| 65 |
| 66 Oobe.screenStateChanged = function(screenInfo) { |
| 67 Oobe.getInstance().changeState_(screenInfo); |
| 68 }; |
| 69 |
| 70 // Export |
| 71 return { |
| 72 Oobe: Oobe |
| 73 }; |
| 74 |
| 75 }); |
| 76 |
| 77 var Oobe = cr.ui.Oobe; |
| 78 |
| 79 document.addEventListener('DOMContentLoaded', cr.ui.Oobe.initialize); |
OLD | NEW |