| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 cr.define('mobile', function() { | 6 cr.define('mobile', function() { |
| 7 | 7 |
| 8 function MobileSetup() { | 8 function MobileSetup() { |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 this.confirm_ = new cr.ui.dialogs.ConfirmDialog(document.body); | 70 this.confirm_ = new cr.ui.dialogs.ConfirmDialog(document.body); |
| 71 | 71 |
| 72 window.addEventListener('message', function(e) { | 72 window.addEventListener('message', function(e) { |
| 73 self.onMessageReceived_(e); | 73 self.onMessageReceived_(e); |
| 74 }); | 74 }); |
| 75 | 75 |
| 76 $('closeButton').addEventListener('click', function(e) { | 76 $('closeButton').addEventListener('click', function(e) { |
| 77 $('finalStatus').classList.add('hidden'); | 77 $('finalStatus').classList.add('hidden'); |
| 78 }); | 78 }); |
| 79 | 79 |
| 80 $('cancelButton').addEventListener('click', function(e) { | |
| 81 if (self.state_ == MobileSetup.PLAN_ACTIVATION_DONE || | |
| 82 self.state_ == MobileSetup.PLAN_ACTIVATION_ERROR) { | |
| 83 window.close(); | |
| 84 return; | |
| 85 } | |
| 86 self.confirm_.show( | |
| 87 MobileSetup.localStrings_.getString('cancel_question'), function() { | |
| 88 window.close(); | |
| 89 }); | |
| 90 }); | |
| 91 | |
| 92 this.changeState_({state: MobileSetup.PLAN_ACTIVATION_PAGE_LOADING}); | 80 this.changeState_({state: MobileSetup.PLAN_ACTIVATION_PAGE_LOADING}); |
| 93 // Kick off activation process. | 81 // Kick off activation process. |
| 94 chrome.send('startActivation'); | 82 chrome.send('startActivation'); |
| 95 }, | 83 }, |
| 96 | 84 |
| 97 startSpinner_: function() { | 85 startSpinner_: function() { |
| 98 this.stopSpinner_(); | 86 this.stopSpinner_(); |
| 99 this.spinnerInt_ = setInterval(mobile.MobileSetup.drawProgress, 100); | 87 this.spinnerInt_ = setInterval(mobile.MobileSetup.drawProgress, 100); |
| 100 }, | 88 }, |
| 101 | 89 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 $('carrierPage').classList.add('hidden'); | 206 $('carrierPage').classList.add('hidden'); |
| 219 $('paymentForm').classList.remove('hidden'); | 207 $('paymentForm').classList.remove('hidden'); |
| 220 $('closeButton').classList.remove('hidden'); | 208 $('closeButton').classList.remove('hidden'); |
| 221 $('finalStatus').classList.remove('hidden'); | 209 $('finalStatus').classList.remove('hidden'); |
| 222 $('canvas').classList.add('hidden'); | 210 $('canvas').classList.add('hidden'); |
| 223 this.stopSpinner_(); | 211 this.stopSpinner_(); |
| 224 if (this.paymentShown_) { | 212 if (this.paymentShown_) { |
| 225 $('closeButton').classList.remove('hidden'); | 213 $('closeButton').classList.remove('hidden'); |
| 226 } else { | 214 } else { |
| 227 $('closeButton').classList.add('hidden'); | 215 $('closeButton').classList.add('hidden'); |
| 228 $('cancelButton').textContent = | |
| 229 MobileSetup.localStrings_.getString('close_button'); | |
| 230 } | 216 } |
| 231 break; | 217 break; |
| 232 case MobileSetup.PLAN_ACTIVATION_ERROR: | 218 case MobileSetup.PLAN_ACTIVATION_ERROR: |
| 233 $('statusHeader').textContent = ''; | 219 $('statusHeader').textContent = ''; |
| 234 $('auxHeader').textContent = ''; | 220 $('auxHeader').textContent = ''; |
| 235 $('finalHeader').textContent = | 221 $('finalHeader').textContent = |
| 236 MobileSetup.localStrings_.getString('error_header'); | 222 MobileSetup.localStrings_.getString('error_header'); |
| 237 $('finalMessage').textContent = deviceInfo.error; | 223 $('finalMessage').textContent = deviceInfo.error; |
| 238 $('systemStatus').classList.add('hidden'); | 224 $('systemStatus').classList.add('hidden'); |
| 239 $('carrierPage').classList.add('hidden'); | 225 $('carrierPage').classList.add('hidden'); |
| 240 $('paymentForm').classList.remove('hidden'); | 226 $('paymentForm').classList.remove('hidden'); |
| 241 $('canvas').classList.add('hidden'); | 227 $('canvas').classList.add('hidden'); |
| 242 this.stopSpinner_(); | 228 this.stopSpinner_(); |
| 243 if (this.paymentShown_) { | 229 if (this.paymentShown_) { |
| 244 $('closeButton').classList.remove('hidden'); | 230 $('closeButton').classList.remove('hidden'); |
| 245 } else { | 231 } else { |
| 246 $('closeButton').classList.add('hidden'); | 232 $('closeButton').classList.add('hidden'); |
| 247 $('cancelButton').textContent = | |
| 248 MobileSetup.localStrings_.getString('close_button'); | |
| 249 } | 233 } |
| 250 $('finalStatus').classList.remove('hidden'); | 234 $('finalStatus').classList.remove('hidden'); |
| 251 break; | 235 break; |
| 252 } | 236 } |
| 253 this.state_ = new_state; | 237 this.state_ = new_state; |
| 254 }, | 238 }, |
| 255 | 239 |
| 256 updateDeviceStatus_: function(deviceInfo) { | 240 updateDeviceStatus_: function(deviceInfo) { |
| 257 this.changeState_(deviceInfo); | 241 this.changeState_(deviceInfo); |
| 258 }, | 242 }, |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 mobile.MobileSetup.ACTIVATION_PAGE_URL); | 332 mobile.MobileSetup.ACTIVATION_PAGE_URL); |
| 349 }; | 333 }; |
| 350 | 334 |
| 351 // Export | 335 // Export |
| 352 return { | 336 return { |
| 353 MobileSetup: MobileSetup | 337 MobileSetup: MobileSetup |
| 354 }; | 338 }; |
| 355 | 339 |
| 356 }); | 340 }); |
| 357 | 341 |
| OLD | NEW |