1 // Copyright (c) 2012 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.
6 * @fileoverview Oobe network screen implementation.
9 login.createScreen('NetworkScreen', 'connect', function() {
12 'enableContinueButton',
18 * Dropdown element for networks selection.
23 decorate: function() {
24 Oobe.setupSelect($('language-select'),
25 loadTimeData.getValue('languageList'),
26 'networkOnLanguageChanged');
28 Oobe.setupSelect($('keyboard-select'),
29 loadTimeData.getValue('inputMethodsList'),
30 'networkOnInputMethodChanged');
32 Oobe.setupSelect($('timezone-select'),
33 loadTimeData.getValue('timezoneList'),
34 'networkOnTimezoneChanged');
36 this.dropdown_ = $('networks-list');
37 cr.ui.DropDown.decorate(this.dropdown_);
40 onBeforeShow: function(data) {
41 cr.ui.DropDown.show('networks-list', true, -1);
44 onBeforeHide: function() {
45 cr.ui.DropDown.hide('networks-list');
46 this.enableContinueButton(false);
50 * Header text of the screen.
54 return loadTimeData.getString('networkScreenTitle');
58 * Buttons in oobe wizard's button strip.
59 * @type {array} Array of Buttons.
64 var continueButton = this.ownerDocument.createElement('button');
65 continueButton.disabled = true;
66 continueButton.id = 'continue-button';
67 continueButton.textContent = loadTimeData.getString('continueButton');
68 continueButton.classList.add('preserve-disabled-state');
69 continueButton.addEventListener('click', function(e) {
70 chrome.send('networkOnExit');
73 buttons.push(continueButton);
79 * Returns a control which should receive an initial focus.
81 get defaultControl() {
82 return $('language-select');
86 * Enables/disables continue button.
87 * @param {boolean} enable Should the button be enabled?
89 enableContinueButton: function(enable) {
90 $('continue-button').disabled = !enable;
94 * Sets the current timezone.
95 * @param {string} timezoneId The timezone ID to select.
97 setTimezone: function(timezoneId) {
98 $('timezone-select').value = timezoneId;
102 * Shows the network error message.
103 * @param {string} message Message to be shown.
105 showError: function(message) {
106 var error = document.createElement('div');
107 var messageDiv = document.createElement('div');
108 messageDiv.className = 'error-message-bubble';
109 messageDiv.textContent = message;
110 error.appendChild(messageDiv);
112 $('bubble').showContentForElement($('networks-list'),
113 cr.ui.Bubble.Attachment.BOTTOM,