summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/resources/chromeos/choose_mobile_network.js8
-rw-r--r--chrome/browser/resources/chromeos/image_burner.js214
-rw-r--r--chrome/browser/resources/chromeos/keyboard_overlay.js82
-rw-r--r--chrome/browser/resources/chromeos/mobile_setup.js134
-rw-r--r--chrome/browser/resources/chromeos/sim_unlock.js30
-rw-r--r--chrome/browser/resources/chromeos/user_images_grid.js10
6 files changed, 312 insertions, 166 deletions
diff --git a/chrome/browser/resources/chromeos/choose_mobile_network.js b/chrome/browser/resources/chromeos/choose_mobile_network.js
index 606ee87..d9442f5 100644
--- a/chrome/browser/resources/chromeos/choose_mobile_network.js
+++ b/chrome/browser/resources/chromeos/choose_mobile_network.js
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -49,7 +49,7 @@ cr.define('mobile', function() {
connect_: function() {
for (var i in this.networks_) {
if ($('network' + i).checked) {
- chrome.send('connect', [ this.networks_[i].networkId ]);
+ chrome.send('connect', [this.networks_[i].networkId]);
ChooseNetwork.close();
return;
}
@@ -79,7 +79,7 @@ cr.define('mobile', function() {
$('connect').addEventListener('click', function(event) {
ChooseNetwork.connect();
});
- chrome.send('pageReady', []);
+ chrome.send('pageReady');
};
ChooseNetwork.showNetworks = function(networks) {
@@ -94,7 +94,7 @@ cr.define('mobile', function() {
var ChooseNetwork = mobile.ChooseNetwork;
-document.addEventListener('DOMContentLoaded', function () {
+document.addEventListener('DOMContentLoaded', function() {
// TODO(dpolukhin): refactor spinner code&css to be reusable.
// Setup css canvas 'spinner-circle'
(function() {
diff --git a/chrome/browser/resources/chromeos/image_burner.js b/chrome/browser/resources/chromeos/image_burner.js
index b81f578..0a48abe 100644
--- a/chrome/browser/resources/chromeos/image_burner.js
+++ b/chrome/browser/resources/chromeos/image_burner.js
@@ -1,53 +1,64 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
var localStrings;
var browserBridge;
-// Class that keeps track of current burn process state.
+/**
+ * Class that keeps track of current burn process state.
+ * @param {Object} strings Localized state strings.
+ * @constructor
+ */
function State(strings) {
this.setStrings(strings);
this.changeState(State.StatesEnum.DEVICE_NONE);
}
+/**
+ * State Enum object.
+ */
State.StatesEnum = {
- DEVICE_NONE : {
- cssState : "device-detected-none",
+ DEVICE_NONE: {
+ cssState: 'device-detected-none',
},
- DEVICE_USB : {
- cssState : "device-detected-usb warning",
+ DEVICE_USB: {
+ cssState: 'device-detected-usb warning',
},
- DEVICE_SD : {
- cssState : "device-detected-sd warning",
+ DEVICE_SD: {
+ cssState: 'device-detected-sd warning',
},
- DEVICE_MUL : {
- cssState: "device-detected-mul warning",
+ DEVICE_MUL: {
+ cssState: 'device-detected-mul warning',
},
- ERROR_NO_NETWORK : {
- cssState : "warning-no-conf",
+ ERROR_NO_NETWORK: {
+ cssState: 'warning-no-conf',
},
- ERROR_DEVICE_TOO_SMALL : {
- cssState : "warning-no-conf",
+ ERROR_DEVICE_TOO_SMALL: {
+ cssState: 'warning-no-conf',
},
- PROGRESS_DOWNLOAD : {
- cssState : "progress progress-canceble",
+ PROGRESS_DOWNLOAD: {
+ cssState: 'progress progress-canceble',
},
- PROGRESS_UNZIP : {
- cssState : "progress progress-canceble",
+ PROGRESS_UNZIP: {
+ cssState: 'progress progress-canceble',
},
- PROGRESS_BURN : {
- cssState : "progress",
+ PROGRESS_BURN: {
+ cssState: 'progress',
},
- FAIL : {
- cssState : "error",
+ FAIL: {
+ cssState: 'error',
},
- SUCCESS : {
- cssState : "success",
+ SUCCESS: {
+ cssState: 'success',
},
};
State.prototype = {
+ /**
+ * Sets the state strings.
+ * @param {Object} strings Localized state strings.
+ */
setStrings: function(strings) {
State.StatesEnum.DEVICE_NONE.statusText =
strings.getString('statusDevicesNone');
@@ -74,6 +85,10 @@ State.prototype = {
State.StatesEnum.SUCCESS.warningText = strings.getString('warningSuccess');
},
+ /**
+ * Changes the current state to new state.
+ * @param {Object} newState Specifies the new state object.
+ */
changeState: function(newState) {
if (newState == this.state)
return;
@@ -83,9 +98,8 @@ State.prototype = {
$('status-text').textContent = this.state.statusText;
- if (newState.warningText) {
+ if (newState.warningText)
$('warning-text').textContent = this.state.warningText;
- }
if (this.isInitialState() && this.state != State.StatesEnum.DEVICE_NONE) {
$('warning-button').textContent = localStrings.getString('confirmButton');
@@ -95,38 +109,61 @@ State.prototype = {
}
},
+ /**
+ * Reset to initial state.
+ * @param {number} deviceCount Device count information.
+ */
gotoInitialState: function(deviceCount) {
- if (deviceCount == 0) {
+ if (deviceCount == 0)
this.changeState(State.StatesEnum.DEVICE_NONE);
- } else if (deviceCount == 1) {
+ else if (deviceCount == 1)
this.changeState(State.StatesEnum.DEVICE_USB);
- } else {
+ else
this.changeState(State.StatesEnum.DEVICE_MUL);
- }
},
+ /**
+ * Returns true if the device is in initial state.
+ * @return {boolean} True if the device is in initial state else false.
+ */
isInitialState: function() {
- return (this.state == State.StatesEnum.DEVICE_NONE ||
- this.state == State.StatesEnum.DEVICE_USB ||
- this.state == State.StatesEnum.DEVICE_SD ||
- this.state == State.StatesEnum.DEVICE_MUL);
+ return this.state == State.StatesEnum.DEVICE_NONE ||
+ this.state == State.StatesEnum.DEVICE_USB ||
+ this.state == State.StatesEnum.DEVICE_SD ||
+ this.state == State.StatesEnum.DEVICE_MUL;
},
+ /**
+ * Returns true if device state matches the given state name.
+ * @param {string} stateName Given state name.
+ * @return {boolean} True if the device state matches the given state name.
+ */
equals: function(stateName) {
return this.state == stateName;
}
};
-// Class that keeps track of available devices.
+/**
+ * Class that keeps track of available devices.
+ * @constructor
+ */
function DeviceSelection() {
this.deviceCount = 0;
-};
+}
DeviceSelection.prototype = {
+ /**
+ * Clears the given selection list.
+ * @param {Array} list Device selection list.
+ */
clearSelectList: function(list) {
list.innerHtml = '';
},
+ /**
+ * Shows the currently selected device.
+ * @return {number} Selected device count.
+ */
showDeviceSelection: function() {
if (this.deviceCount == 0) {
this.selectedDevice = undefined;
@@ -137,6 +174,12 @@ DeviceSelection.prototype = {
return this.deviceCount;
},
+ /**
+ * Handles device selected event.
+ * @param {string} label Device label.
+ * @param {string} filePath File path.
+ * @param {string} devicePath Selected device path.
+ */
onDeviceSelected: function(label, filePath, devicePath) {
$('warning-button').onclick =
browserBridge.sendBurnImageMessage.bind(browserBridge, filePath,
@@ -148,12 +191,21 @@ DeviceSelection.prototype = {
localStrings.getStringF('warningDevices', label);
},
+ /**
+ * Selects the specified device based on the specified path.
+ * @param {string} path Device path.
+ */
selectDevice: function(path) {
var element = $('radio ' + path);
element.checked = true;
element.onclick.apply(element);
},
+ /**
+ * Creates a new device element.
+ * @param {Object} device Specifies new device information.
+ * @return {HTMLLIElement} New device element.
+ */
createNewDeviceElement: function(device) {
var element = document.createElement('li');
var radioButton = document.createElement('input');
@@ -178,6 +230,11 @@ DeviceSelection.prototype = {
return element;
},
+ /**
+ * Updates the list of selected devices.
+ * @param {Array} devices List of devices.
+ * @return {number} Device count.
+ */
getDevicesCallback: function(devices) {
var selectListDOM = $('device-selection');
this.clearSelectList(selectListDOM);
@@ -194,6 +251,12 @@ DeviceSelection.prototype = {
return this.deviceCount;
},
+ /**
+ * Handles device added event.
+ * @param {Object} device Device information.
+ * @param {boolean} allowSelect True to update the selected device info.
+ * @return {number} Device count.
+ */
deviceAdded: function(device, allowSelect) {
var selectListDOM = $('device-selection');
selectListDOM.appendChild(this.createNewDeviceElement(device));
@@ -203,6 +266,12 @@ DeviceSelection.prototype = {
return this.deviceCount;
},
+ /**
+ * Handles device removed event.
+ * @param {string} devicePath Selected device path.
+ * @param {boolean} allowSelect True to update the selected device info.
+ * @return {number} Device count.
+ */
deviceRemoved: function(devicePath, allowSelect) {
var deviceSelectElement = $('select ' + devicePath);
deviceSelectElement.parentNode.removeChild(deviceSelectElement);
@@ -221,7 +290,10 @@ DeviceSelection.prototype = {
}
};
-// Class that handles communication with chrome.
+/**
+ * Class that handles communication with chrome.
+ * @constructor
+ */
function BrowserBridge() {
this.currentState = new State(localStrings);
this.devices = new DeviceSelection();
@@ -230,21 +302,26 @@ function BrowserBridge() {
this.progressElement = $('progress-div');
this.progressText = $('progress-text');
this.progressTimeLeftText = $('pending-time');
-};
+}
BrowserBridge.prototype = {
sendCancelMessage: function() {
- chrome.send("cancelBurnImage");
+ chrome.send('cancelBurnImage');
},
sendGetDevicesMessage: function() {
- chrome.send("getDevices");
+ chrome.send('getDevices');
},
sendWebuiInitializedMessage: function() {
- chrome.send("webuiInitialized");
+ chrome.send('webuiInitialized');
},
+ /**
+ * Sends the burn image message to c++ code.
+ * @param {string} filePath Specifies the file path.
+ * @param {string} devicePath Specifies the device path.
+ */
sendBurnImageMessage: function(filePath, devicePath) {
chrome.send('burnImage', [devicePath, filePath]);
},
@@ -253,12 +330,21 @@ BrowserBridge.prototype = {
this.currentState.changeState(State.StatesEnum.SUCCESS);
},
+ /**
+ * Update the device state to report a failure and display an error message to
+ * the user.
+ * @param {string} errorMessage Specifies the warning text message.
+ */
reportFail: function(errorMessage) {
this.currentState.changeState(State.StatesEnum.FAIL);
$('warning-text').textContent = errorMessage;
$('warning-button').onclick = this.onBurnRetry.bind(this);
},
+ /**
+ * Handles device added event.
+ * @param {Object} device Device information.
+ */
deviceAdded: function(device) {
var inInitialState = this.currentState.isInitialState();
var deviceCount = this.devices.deviceAdded(device, inInitialState);
@@ -266,6 +352,10 @@ BrowserBridge.prototype = {
this.currentState.gotoInitialState(deviceCount);
},
+ /**
+ * Handles device removed event.
+ * @param {Object} device Device information.
+ */
deviceRemoved: function(device) {
var inInitialState = this.currentState.isInitialState();
var deviceCount = this.devices.deviceRemoved(device, inInitialState);
@@ -273,33 +363,41 @@ BrowserBridge.prototype = {
this.currentState.gotoInitialState(deviceCount);
},
+ /**
+ * Gets device callbacks and update the current state.
+ * @param {Array} devices List of devices.
+ */
getDevicesCallback: function(devices) {
var deviceCount = this.devices.getDevicesCallback(devices);
this.currentState.gotoInitialState(deviceCount);
this.sendWebuiInitializedMessage();
},
- updateProgress: function(update_signal) {
- if (update_signal.progressType == 'download' &&
+ /**
+ * Updates the progress information based on the signal received.
+ * @param {Object} updateSignal Specifies the signal information.
+ */
+ updateProgress: function(updateSignal) {
+ if (updateSignal.progressType == 'download' &&
!this.currentState.equals(State.StatesEnum.PROGRESS_DOWNLOAD)) {
this.currentState.changeState(State.StatesEnum.PROGRESS_DOWNLOAD);
- } else if (update_signal.progressType == 'unzip' &&
+ } else if (updateSignal.progressType == 'unzip' &&
!this.currentState.equals(State.StatesEnum.PROGRESS_UNZIP)) {
this.currentState.changeState(State.StatesEnum.PROGRESS_UNZIP);
- } else if (update_signal.progressType == 'burn' &&
+ } else if (updateSignal.progressType == 'burn' &&
!this.currentState.equals(State.StatesEnum.PROGRESS_BURN)) {
this.currentState.changeState(State.StatesEnum.PROGRESS_BURN);
}
- if (!(update_signal.amountTotal > 0)) {
+ if (!(updateSignal.amountTotal > 0)) {
this.progressElement.removeAttribute('value');
} else {
- this.progressElement.value = update_signal.amountFinished;
- this.progressElement.max = update_signal.amountTotal;
+ this.progressElement.value = updateSignal.amountFinished;
+ this.progressElement.max = updateSignal.amountTotal;
}
- this.progressText.textContent = update_signal.progressText;
- this.progressTimeLeftText.textContent = update_signal.timeLeftText;
+ this.progressText.textContent = updateSignal.progressText;
+ this.progressTimeLeftText.textContent = updateSignal.timeLeftText;
},
reportNoNetwork: function() {
@@ -313,14 +411,20 @@ BrowserBridge.prototype = {
}
},
- reportDeviceTooSmall: function(device_size) {
+ /**
+ * Updates the current state to report device too small error.
+ * @param {number} deviceSize Received device size.
+ */
+ reportDeviceTooSmall: function(deviceSize) {
this.currentState.changeState(State.StatesEnum.ERROR_DEVICE_TOO_SMALL);
$('warning-text').textContent =
- localStrings.getStringF('warningNoSpace', device_size);
+ localStrings.getStringF('warningNoSpace', deviceSize);
},
- // Processes click on "Retry" button in FAIL state.
- onBurnRetry: function () {
+ /**
+ * Processes click on 'Retry' button in FAIL state.
+ */
+ onBurnRetry: function() {
var deviceCount = this.devices.showDeviceSelection();
this.currentState.gotoInitialState(deviceCount);
}
@@ -330,7 +434,7 @@ document.addEventListener('DOMContentLoaded', function() {
localStrings = new LocalStrings();
browserBridge = new BrowserBridge();
- jstProcess(new JsEvalContext(templateData), $("more-info-link"));
+ jstProcess(new JsEvalContext(templateData), $('more-info-link'));
$('cancel-button').onclick =
browserBridge.sendCancelMessage.bind(browserBridge);
diff --git a/chrome/browser/resources/chromeos/keyboard_overlay.js b/chrome/browser/resources/chromeos/keyboard_overlay.js
index d2c745f..a5a03fb 100644
--- a/chrome/browser/resources/chromeos/keyboard_overlay.js
+++ b/chrome/browser/resources/chromeos/keyboard_overlay.js
@@ -37,13 +37,14 @@ var LABEL_TO_IDENTIFIER = {
'alt': '38',
'caps lock': '3A',
'disabled': 'DISABLED'
-}
+};
var keyboardOverlayId = 'en_US';
var identifierMap = {};
/**
* Returns layouts data.
+ * @return {Object} Keyboard layout data.
*/
function getLayouts() {
return keyboardOverlayData['layouts'];
@@ -51,6 +52,7 @@ function getLayouts() {
/**
* Returns shortcut data.
+ * @return {Object} Keyboard shortcut data.
*/
function getShortcutData() {
return keyboardOverlayData['shortcut'];
@@ -58,6 +60,7 @@ function getShortcutData() {
/**
* Returns the keyboard overlay ID.
+ * @return {string} Keyboard overlay ID.
*/
function getKeyboardOverlayId() {
return keyboardOverlayId;
@@ -65,6 +68,7 @@ function getKeyboardOverlayId() {
/**
* Returns keyboard glyph data.
+ * @return {Object} Keyboard glyph data.
*/
function getKeyboardGlyphData() {
return keyboardOverlayData['keyboardGlyph'][getKeyboardOverlayId()];
@@ -72,6 +76,8 @@ function getKeyboardGlyphData() {
/**
* Converts a single hex number to a character.
+ * @param {string} hex Hexadecimal string.
+ * @return {string} Unicode values of hexadecimal string.
*/
function hex2char(hex) {
if (!hex) {
@@ -93,11 +99,13 @@ function hex2char(hex) {
/**
* Returns a list of modifiers from the key event.
+ * @param {Event} e The key event.
+ * @return {Array} List of modifiers based on key event.
*/
function getModifiers(e) {
- if (!e) {
+ if (!e)
return [];
- }
+
var isKeyDown = (e.type == 'keydown');
var keyCodeToModifier = {
16: 'SHIFT',
@@ -111,9 +119,9 @@ function getModifiers(e) {
// if e.keyCode is one of Shift, Ctrl and Alt, isPressed should
// be changed because the key currently pressed
// does not affect the values of e.shiftKey, e.ctrlKey and e.altKey
- if(modifierWithKeyCode){
+ if (modifierWithKeyCode)
isPressed[modifierWithKeyCode] = isKeyDown;
- }
+
// make the result array
return ['SHIFT', 'CTRL', 'ALT'].filter(
function(modifier) {
@@ -123,6 +131,9 @@ function getModifiers(e) {
/**
* Returns an ID of the key.
+ * @param {string} identifier Key identifier.
+ * @param {number} i Key number.
+ * @return {string} Key ID.
*/
function keyId(identifier, i) {
return identifier + '-key-' + i;
@@ -130,6 +141,9 @@ function keyId(identifier, i) {
/**
* Returns an ID of the text on the key.
+ * @param {string} identifier Key identifier.
+ * @param {number} i Key number.
+ * @return {string} Key text ID.
*/
function keyTextId(identifier, i) {
return identifier + '-key-text-' + i;
@@ -137,6 +151,9 @@ function keyTextId(identifier, i) {
/**
* Returns an ID of the shortcut text.
+ * @param {string} identifier Key identifier.
+ * @param {number} i Key number.
+ * @return {string} Key shortcut text ID.
*/
function shortcutTextId(identifier, i) {
return identifier + '-shortcut-text-' + i;
@@ -144,6 +161,9 @@ function shortcutTextId(identifier, i) {
/**
* Returns true if |list| contains |e|.
+ * @param {Array} list Container list.
+ * @param {string} e Element string.
+ * @return {boolean} Returns true if the list contains the element.
*/
function contains(list, e) {
return list.indexOf(e) != -1;
@@ -152,6 +172,9 @@ function contains(list, e) {
/**
* Returns a list of the class names corresponding to the identifier and
* modifiers.
+ * @param {string} identifier Key identifier.
+ * @param {Array} modifiers List of key modifiers.
+ * @return {Array} List of class names corresponding to specified params.
*/
function getKeyClasses(identifier, modifiers) {
var classes = ['keyboard-overlay-key'];
@@ -170,6 +193,8 @@ function getKeyClasses(identifier, modifiers) {
/**
* Returns true if a character is a ASCII character.
+ * @param {string} c A character to be checked.
+ * @return {boolean} True if the character is an ASCII character.
*/
function isAscii(c) {
var charCode = c.charCodeAt(0);
@@ -178,6 +203,8 @@ function isAscii(c) {
/**
* Returns a remapped identiifer based on the preference.
+ * @param {string} identifier Key identifier.
+ * @return {string} Remapped identifier.
*/
function remapIdentifier(identifier) {
return identifierMap[identifier] || identifier;
@@ -185,6 +212,9 @@ function remapIdentifier(identifier) {
/**
* Returns a label of the key.
+ * @param {string} keyData Key glyph data.
+ * @param {Array} modifiers Key Modifier list.
+ * @return {string} Label of the key.
*/
function getKeyLabel(keyData, modifiers) {
if (!keyData) {
@@ -195,7 +225,7 @@ function getKeyLabel(keyData, modifiers) {
}
var keyLabel = '';
for (var j = 1; j <= 9; j++) {
- var pos = keyData['p' + j];
+ var pos = keyData['p' + j];
if (!pos) {
continue;
}
@@ -215,26 +245,32 @@ function getKeyLabel(keyData, modifiers) {
* Returns a normalized string used for a key of shortcutData.
*
* Examples:
- * keycode: 'd', modifiers: ['CTRL', 'SHIFT'] => 'd<>CTRL<>SHIFT'
- * keycode: 'alt', modifiers: ['ALT', 'SHIFT'] => 'ALT<>SHIFT'
+ * keyCode: 'd', modifiers: ['CTRL', 'SHIFT'] => 'd<>CTRL<>SHIFT'
+ * keyCode: 'alt', modifiers: ['ALT', 'SHIFT'] => 'ALT<>SHIFT'
+ *
+ * @param {string} keyCode Key code.
+ * @param {Array} modifiers Key Modifier list.
+ * @return {string} Normalized key shortcut data string.
*/
-function getAction(keycode, modifiers) {
- const SEPARATOR = '<>';
- if (keycode.toUpperCase() in MODIFIER_TO_CLASS) {
- keycode = keycode.toUpperCase();
- if (keycode in modifiers) {
- return modifiers.join(SEPARATOR);
+function getAction(keyCode, modifiers) {
+ /** @const */ var separatorStr = '<>';
+ if (keyCode.toUpperCase() in MODIFIER_TO_CLASS) {
+ keyCode = keyCode.toUpperCase();
+ if (keyCode in modifiers) {
+ return modifiers.join(separatorStr);
} else {
- var action = [keycode].concat(modifiers)
+ var action = [keyCode].concat(modifiers);
action.sort();
- return action.join(SEPARATOR);
+ return action.join(separatorStr);
}
}
- return [keycode].concat(modifiers).join(SEPARATOR);
+ return [keyCode].concat(modifiers).join(separatorStr);
}
/**
* Returns a text which displayed on a key.
+ * @param {string} keyData Key glyph data.
+ * @return {string} Key text value.
*/
function getKeyTextValue(keyData) {
if (keyData.label) {
@@ -257,6 +293,7 @@ function getKeyTextValue(keyData) {
/**
* Updates the whole keyboard.
+ * @param {Array} modifiers Key Modifier list.
*/
function update(modifiers) {
var instructions = document.getElementById('instructions');
@@ -325,8 +362,9 @@ function update(modifiers) {
/**
* A callback function for onkeydown and onkeyup events.
+ * @param {Event} e Key event.
*/
-function handleKeyEvent(e){
+function handleKeyEvent(e) {
var modifiers = getModifiers(e);
if (!getKeyboardOverlayId()) {
return;
@@ -444,6 +482,7 @@ function init() {
* Initializes the global map for remapping identifiers of modifier keys based
* on the preference.
* Called after sending the 'getLabelMap' message.
+ * @param {Object} remap Identifier map.
*/
function initIdentifierMap(remap) {
for (var key in remap) {
@@ -462,12 +501,14 @@ function initIdentifierMap(remap) {
/**
* Initializes the global keyboad overlay ID and the layout of keys.
* Called after sending the 'getInputMethodId' message.
+ * @param {inputMethodId} inputMethodId Input Method Identifier.
*/
function initKeyboardOverlayId(inputMethodId) {
// Libcros returns an empty string when it cannot find the keyboard overlay ID
// corresponding to the current input method.
// In such a case, fallback to the default ID (en_US).
- var inputMethodIdToOverlayId = keyboardOverlayData['inputMethodIdToOverlayId']
+ var inputMethodIdToOverlayId =
+ keyboardOverlayData['inputMethodIdToOverlayId'];
if (inputMethodId) {
keyboardOverlayId = inputMethodIdToOverlayId[inputMethodId];
}
@@ -475,7 +516,7 @@ function initKeyboardOverlayId(inputMethodId) {
console.error('No keyboard overlay ID for ' + inputMethodId);
keyboardOverlayId = 'en_US';
}
- while(document.body.firstChild) {
+ while (document.body.firstChild) {
document.body.removeChild(document.body.firstChild);
}
initLayout();
@@ -484,6 +525,7 @@ function initKeyboardOverlayId(inputMethodId) {
/**
* Handles click events of the learn more link.
+ * @param {Event} e Mouse click event.
*/
function learnMoreClicked(e) {
chrome.send('openLearnMorePage');
diff --git a/chrome/browser/resources/chromeos/mobile_setup.js b/chrome/browser/resources/chromeos/mobile_setup.js
index 179c1c9..c871fe9 100644
--- a/chrome/browser/resources/chromeos/mobile_setup.js
+++ b/chrome/browser/resources/chromeos/mobile_setup.js
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -10,21 +10,21 @@ cr.define('mobile', function() {
cr.addSingletonGetter(MobileSetup);
- MobileSetup.PLAN_ACTIVATION_PAGE_LOADING = -1;
- MobileSetup.PLAN_ACTIVATION_START = 0;
- MobileSetup.PLAN_ACTIVATION_TRYING_OTASP = 1;
- MobileSetup.PLAN_ACTIVATION_RECONNECTING_OTASP_TRY = 2;
- MobileSetup.PLAN_ACTIVATION_INITIATING_ACTIVATION = 3;
- MobileSetup.PLAN_ACTIVATION_RECONNECTING = 4;
- MobileSetup.PLAN_ACTIVATION_PAYMENT_PORTAL_LOADING = 5;
- MobileSetup.PLAN_ACTIVATION_SHOWING_PAYMENT = 6;
- MobileSetup.PLAN_ACTIVATION_RECONNECTING_PAYMENT = 7;
- MobileSetup.PLAN_ACTIVATION_DELAY_OTASP = 8;
- MobileSetup.PLAN_ACTIVATION_START_OTASP = 9;
- MobileSetup.PLAN_ACTIVATION_OTASP = 10;
- MobileSetup.PLAN_ACTIVATION_RECONNECTING_OTASP = 11;
- MobileSetup.PLAN_ACTIVATION_DONE = 12;
- MobileSetup.PLAN_ACTIVATION_ERROR = 0xFF;
+ MobileSetup.PLAN_ACTIVATION_PAGE_LOADING = -1;
+ MobileSetup.PLAN_ACTIVATION_START = 0;
+ MobileSetup.PLAN_ACTIVATION_TRYING_OTASP = 1;
+ MobileSetup.PLAN_ACTIVATION_RECONNECTING_OTASP_TRY = 2;
+ MobileSetup.PLAN_ACTIVATION_INITIATING_ACTIVATION = 3;
+ MobileSetup.PLAN_ACTIVATION_RECONNECTING = 4;
+ MobileSetup.PLAN_ACTIVATION_PAYMENT_PORTAL_LOADING = 5;
+ MobileSetup.PLAN_ACTIVATION_SHOWING_PAYMENT = 6;
+ MobileSetup.PLAN_ACTIVATION_RECONNECTING_PAYMENT = 7;
+ MobileSetup.PLAN_ACTIVATION_DELAY_OTASP = 8;
+ MobileSetup.PLAN_ACTIVATION_START_OTASP = 9;
+ MobileSetup.PLAN_ACTIVATION_OTASP = 10;
+ MobileSetup.PLAN_ACTIVATION_RECONNECTING_OTASP = 11;
+ MobileSetup.PLAN_ACTIVATION_DONE = 12;
+ MobileSetup.PLAN_ACTIVATION_ERROR = 0xFF;
MobileSetup.EXTENSION_PAGE_URL =
'chrome-extension://iadeocfgjdjdmpenejdbfeaocpbikmab';
@@ -38,21 +38,21 @@ cr.define('mobile', function() {
MobileSetup.prototype = {
// Mobile device information.
deviceInfo_: null,
- frameName_ : '',
- initialized_ : false,
- faked_transaction_ : false,
- payment_shown_ : false,
- frame_load_error_ : 0,
- frame_load_ignored_ : true,
- spinner_int_: -1,
+ frameName_: '',
+ initialized_: false,
+ fakedTransaction_: false,
+ paymentShown_: false,
+ frameLoadError_: 0,
+ frameLoadIgnored_: true,
+ spinnerInt_: -1,
// UI states.
- state_ : -1,
- STATE_UNKNOWN_: "unknown",
- STATE_CONNECTING_: "connecting",
- STATE_ERROR_: "error",
- STATE_PAYMENT_: "payment",
- STATE_ACTIVATING_: "activating",
- STATE_CONNECTED_: "connected",
+ state_: -1,
+ STATE_UNKNOWN_: 'unknown',
+ STATE_CONNECTING_: 'connecting',
+ STATE_ERROR_: 'error',
+ STATE_PAYMENT_: 'payment',
+ STATE_ACTIVATING_: 'activating',
+ STATE_CONNECTED_: 'connected',
initialize: function(frame_name, carrierPage) {
if (this.initialized_) {
@@ -91,18 +91,18 @@ cr.define('mobile', function() {
this.changeState_({state: MobileSetup.PLAN_ACTIVATION_PAGE_LOADING});
// Kick off activation process.
- chrome.send('startActivation', []);
+ chrome.send('startActivation');
},
- startSpinner_:function() {
+ startSpinner_: function() {
this.stopSpinner_();
- this.spinner_int_ = setInterval(mobile.MobileSetup.drawProgress, 100);
+ this.spinnerInt_ = setInterval(mobile.MobileSetup.drawProgress, 100);
},
- stopSpinner_:function() {
- if (this.spinner_int_ != -1) {
- clearInterval(this.spinner_int_);
- this.spinner_int_ = -1;
+ stopSpinner_: function() {
+ if (this.spinnerInt_ != -1) {
+ clearInterval(this.spinnerInt_);
+ this.spinnerInt_ = -1;
}
},
@@ -112,16 +112,16 @@ cr.define('mobile', function() {
loadPaymentFrame_: function(deviceInfo) {
if (deviceInfo) {
- this.frame_load_error_ = 0;
+ this.frameLoadError_ = 0;
this.deviceInfo_ = deviceInfo;
if (deviceInfo.post_data && deviceInfo.post_data.length) {
- this.frame_load_ignored_ = true;
+ this.frameLoadIgnored_ = true;
$(this.frameName_).contentWindow.location.href =
MobileSetup.REDIRECT_POST_PAGE_URL +
'?post_data=' + escape(deviceInfo.post_data) +
'&formUrl=' + escape(deviceInfo.payment_url);
} else {
- this.frame_load_ignored_ = false;
+ this.frameLoadIgnored_ = false;
$(this.frameName_).contentWindow.location.href =
deviceInfo.payment_url;
}
@@ -137,7 +137,7 @@ cr.define('mobile', function() {
if (e.data.type == 'requestDeviceInfoMsg') {
this.sendDeviceInfo_();
} else if (e.data.type == 'framePostReady') {
- this.frame_load_ignored_ = false;
+ this.frameLoadIgnored_ = false;
this.sendPostFrame_(e.origin);
} else if (e.data.type == 'reportTransactionStatusMsg') {
console.log('calling setTransactionStatus from onMessageReceived_');
@@ -152,7 +152,7 @@ cr.define('mobile', function() {
return;
var main = $('mainbody');
// Map handler state to UX.
- switch(new_state) {
+ switch (new_state) {
case MobileSetup.PLAN_ACTIVATION_PAGE_LOADING:
case MobileSetup.PLAN_ACTIVATION_START:
case MobileSetup.PLAN_ACTIVATION_DELAY_OTASP:
@@ -205,7 +205,7 @@ cr.define('mobile', function() {
$('paymentForm').classList.remove('hidden');
$('canvas').classList.add('hidden');
this.stopSpinner_();
- this.payment_shown_ = true;
+ this.paymentShown_ = true;
break;
case MobileSetup.PLAN_ACTIVATION_DONE:
$('statusHeader').textContent = '';
@@ -221,7 +221,7 @@ cr.define('mobile', function() {
$('finalStatus').classList.remove('hidden');
$('canvas').classList.add('hidden');
this.stopSpinner_();
- if (this.payment_shown_) {
+ if (this.paymentShown_) {
$('closeButton').classList.remove('hidden');
} else {
$('closeButton').classList.add('hidden');
@@ -240,7 +240,7 @@ cr.define('mobile', function() {
$('paymentForm').classList.remove('hidden');
$('canvas').classList.add('hidden');
this.stopSpinner_();
- if (this.payment_shown_) {
+ if (this.paymentShown_) {
$('closeButton').classList.remove('hidden');
} else {
$('closeButton').classList.add('hidden');
@@ -258,25 +258,25 @@ cr.define('mobile', function() {
},
portalFrameLoadError_: function(errorCode) {
- if (this.frame_load_ignored_)
+ if (this.frameLoadIgnored_)
return;
- console.log("Portal frame load error detected: " + errorCode);
- this.frame_load_error_ = errorCode;
+ console.log('Portal frame load error detected: ', errorCode);
+ this.frameLoadError_ = errorCode;
},
portalFrameLoadCompleted_: function() {
- if (this.frame_load_ignored_)
+ if (this.frameLoadIgnored_)
return;
- console.log("Portal frame load completed!");
- this.onFrameLoaded_(this.frame_load_error_ == 0);
+ console.log('Portal frame load completed!');
+ this.onFrameLoaded_(this.frameLoadError_ == 0);
},
- sendPostFrame_ : function(frameUrl) {
+ sendPostFrame_: function(frameUrl) {
var msg = { type: 'postFrame' };
$(this.frameName_).contentWindow.postMessage(msg, frameUrl);
},
- sendDeviceInfo_ : function() {
+ sendDeviceInfo_: function() {
var msg = {
type: 'deviceInfoMsg',
domain: document.location,
@@ -293,40 +293,40 @@ cr.define('mobile', function() {
};
- MobileSetup.drawProgress = function () {
+ MobileSetup.drawProgress = function() {
var ctx = canvas.getContext('2d');
ctx.clearRect(0, 0, canvas.width, canvas.height);
- var segmentCount = Math.min(12, canvas.width/1.6) // Number of segments
+ var segmentCount = Math.min(12, canvas.width / 1.6); // Number of segments
var rotation = 0.75; // Counterclockwise rotation
// Rotate canvas over time
- ctx.translate(canvas.width/2, canvas.height/2);
+ ctx.translate(canvas.width / 2, canvas.height / 2);
ctx.rotate(Math.PI * 2 / (segmentCount + rotation));
- ctx.translate(-canvas.width/2, -canvas.height/2);
+ ctx.translate(-canvas.width / 2, -canvas.height / 2);
var gap = canvas.width / 24; // Gap between segments
- var oRadius = canvas.width/2; // Outer radius
+ var oRadius = canvas.width / 2; // Outer radius
var iRadius = oRadius * 0.618; // Inner radius
var oCircumference = Math.PI * 2 * oRadius; // Outer circumference
var iCircumference = Math.PI * 2 * iRadius; // Inner circumference
var oGap = gap / oCircumference; // Gap size as fraction of outer ring
var iGap = gap / iCircumference; // Gap size as fraction of inner ring
- var oArc = Math.PI * 2 * ( 1 / segmentCount - oGap); // Angle of outer arcs
- var iArc = Math.PI * 2 * ( 1 / segmentCount - iGap); // Angle of inner arcs
+ var oArc = Math.PI * 2 * (1 / segmentCount - oGap); // Angle of outer arcs
+ var iArc = Math.PI * 2 * (1 / segmentCount - iGap); // Angle of inner arcs
- for (i = 0; i < segmentCount; i++){ // Draw each segment
+ for (i = 0; i < segmentCount; i++) { // Draw each segment
var opacity = Math.pow(1.0 - i / segmentCount, 3.0);
- opacity = (0.15 + opacity * 0.8) // Vary from 0.15 to 0.95
+ opacity = (0.15 + opacity * 0.8); // Vary from 0.15 to 0.95
var angle = - Math.PI * 2 * i / segmentCount;
ctx.beginPath();
- ctx.arc(canvas.width/2, canvas.height/2, oRadius,
- angle - oArc/2, angle + oArc/2, false);
- ctx.arc(canvas.width/2, canvas.height/2, iRadius,
- angle + iArc/2, angle - iArc/2, true);
+ ctx.arc(canvas.width / 2, canvas.height / 2, oRadius,
+ angle - oArc / 2, angle + oArc / 2, false);
+ ctx.arc(canvas.width / 2, canvas.height / 2, iRadius,
+ angle + iArc / 2, angle - iArc / 2, true);
ctx.closePath();
- ctx.fillStyle = "rgba(240, 30, 29, " + opacity + ")";
+ ctx.fillStyle = 'rgba(240, 30, 29, ' + opacity + ')';
ctx.fill();
}
};
diff --git a/chrome/browser/resources/chromeos/sim_unlock.js b/chrome/browser/resources/chromeos/sim_unlock.js
index aaded25..5f15d8f 100644
--- a/chrome/browser/resources/chromeos/sim_unlock.js
+++ b/chrome/browser/resources/chromeos/sim_unlock.js
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -10,20 +10,20 @@ cr.define('mobile', function() {
cr.addSingletonGetter(SimUnlock);
// State of the dialog.
- SimUnlock.SIM_UNLOCK_LOADING = -1;
- SimUnlock.SIM_ABSENT_NOT_LOCKED = 0,
- SimUnlock.SIM_NOT_LOCKED_ASK_PIN = 1;
- SimUnlock.SIM_NOT_LOCKED_CHANGE_PIN = 2;
- SimUnlock.SIM_LOCKED_PIN = 3;
- SimUnlock.SIM_LOCKED_NO_PIN_TRIES_LEFT = 4;
- SimUnlock.SIM_LOCKED_PUK = 5;
- SimUnlock.SIM_LOCKED_NO_PUK_TRIES_LEFT = 6;
- SimUnlock.SIM_DISABLED = 7;
+ SimUnlock.SIM_UNLOCK_LOADING = -1;
+ SimUnlock.SIM_ABSENT_NOT_LOCKED = 0,
+ SimUnlock.SIM_NOT_LOCKED_ASK_PIN = 1;
+ SimUnlock.SIM_NOT_LOCKED_CHANGE_PIN = 2;
+ SimUnlock.SIM_LOCKED_PIN = 3;
+ SimUnlock.SIM_LOCKED_NO_PIN_TRIES_LEFT = 4;
+ SimUnlock.SIM_LOCKED_PUK = 5;
+ SimUnlock.SIM_LOCKED_NO_PUK_TRIES_LEFT = 6;
+ SimUnlock.SIM_DISABLED = 7;
// Mode of the dialog.
- SimUnlock.SIM_DIALOG_UNLOCK = 0;
- SimUnlock.SIM_DIALOG_CHANGE_PIN = 1;
- SimUnlock.SIM_DIALOG_SET_LOCK_ON = 2;
+ SimUnlock.SIM_DIALOG_UNLOCK = 0;
+ SimUnlock.SIM_DIALOG_CHANGE_PIN = 1;
+ SimUnlock.SIM_DIALOG_SET_LOCK_ON = 2;
SimUnlock.SIM_DIALOG_SET_LOCK_OFF = 3;
// Error codes.
@@ -49,7 +49,7 @@ cr.define('mobile', function() {
var tries = simInfo.tries;
var pinMessage;
this.hideAll_();
- switch(newState) {
+ switch (newState) {
case SimUnlock.SIM_UNLOCK_LOADING:
break;
case SimUnlock.SIM_ABSENT_NOT_LOCKED:
@@ -234,7 +234,7 @@ cr.define('mobile', function() {
$('pin-input').addEventListener('textInput',
SimUnlock.processInput.bind(this));
$('enter-pin-confirm').addEventListener('click', function(event) {
- SimUnlock.submitPin()
+ SimUnlock.submitPin();
});
$('enter-pin-dismiss').addEventListener('click', function(event) {
SimUnlock.cancel();
diff --git a/chrome/browser/resources/chromeos/user_images_grid.js b/chrome/browser/resources/chromeos/user_images_grid.js
index e96e004..f22f5db 100644
--- a/chrome/browser/resources/chromeos/user_images_grid.js
+++ b/chrome/browser/resources/chromeos/user_images_grid.js
@@ -3,11 +3,11 @@
// found in the LICENSE file.
cr.define('options', function() {
- const ArrayDataModel = cr.ui.ArrayDataModel;
- const Grid = cr.ui.Grid;
- const GridItem = cr.ui.GridItem;
- const GridSelectionController = cr.ui.GridSelectionController;
- const ListSingleSelectionModel = cr.ui.ListSingleSelectionModel;
+ /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel;
+ /** @const */ var Grid = cr.ui.Grid;
+ /** @const */ var GridItem = cr.ui.GridItem;
+ /** @const */ var GridSelectionController = cr.ui.GridSelectionController;
+ /** @const */ var ListSingleSelectionModel = cr.ui.ListSingleSelectionModel;
/**
* Creates a new user images grid item.