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

Unified Diff: chrome/browser/resources/chromeos/mobile_setup.js

Issue 10356042: Fix presubmit js style nits. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reverted document.getElementById changes in keyboard_overlay.js Created 8 years, 7 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/mobile_setup.js
diff --git a/chrome/browser/resources/chromeos/mobile_setup.js b/chrome/browser/resources/chromeos/mobile_setup.js
index 179c1c95fea132f5bdd9231b77d962d0c532c857..c871fe920aa8be36daaabf75f33c126d6b51beab 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();
}
};

Powered by Google App Engine
This is Rietveld 408576698