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

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

Issue 8271025: Moved mobile activation into its own modal dialog (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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/mobile_setup.js
===================================================================
--- chrome/browser/resources/mobile_setup.js (revision 105363)
+++ chrome/browser/resources/mobile_setup.js (working copy)
@@ -50,6 +50,7 @@
STATE_CONNECTED_: "connected",
initialize: function(frame_name, carrierPage) {
+ this.confirm_ = new cr.ui.dialogs.ConfirmDialog(document.body);
if (this.initialized_) {
console.log('calling initialize() again?');
return;
@@ -57,13 +58,27 @@
this.initialized_ = true;
self = this;
this.frameName_ = frame_name;
+
window.addEventListener('message', function(e) {
self.onMessageReceived_(e);
});
+
$('closeButton').addEventListener('click', function(e) {
- $('finalStatus').classList.add('hidden');
+ $('finalStatus').classList.add('hidden');
});
+ $('cancelButton').addEventListener('click', function(e) {
+ if (self.state_ == MobileSetup.PLAN_ACTIVATION_DONE ||
+ self.state_ == MobileSetup.PLAN_ACTIVATION_ERROR) {
+ window.close();
+ return;
+ }
+ self.confirm_.show(
+ MobileSetup.localStrings_.getString('cancel_question'), function() {
+ window.close();
+ });
+ });
+
this.changeState_({state: MobileSetup.PLAN_ACTIVATION_PAGE_LOADING});
setInterval(mobile.MobileSetup.drawProgress, 100);
// Kick off activation process.
@@ -181,10 +196,13 @@
$('paymentForm').classList.remove('hidden');
$('closeButton').classList.remove('hidden');
$('finalStatus').classList.remove('hidden');
- if (this.payment_shown_)
+ if (this.payment_shown_) {
$('closeButton').classList.remove('hidden');
- else
+ } else {
$('closeButton').classList.add('hidden');
+ $('cancelButton').textContent =
+ MobileSetup.localStrings_.getString('close_button');
xiyuan 2011/10/15 15:56:19 Why do we need to do this? This should be done aut
zel 2011/10/18 22:22:16 The button to close the window changes the title f
+ }
break;
case MobileSetup.PLAN_ACTIVATION_ERROR:
$('statusHeader').textContent = '';
@@ -196,10 +214,13 @@
$('canvas').classList.add('hidden');
$('carrierPage').classList.add('hidden');
$('paymentForm').classList.remove('hidden');
- if (this.payment_shown_)
+ if (this.payment_shown_) {
$('closeButton').classList.remove('hidden');
- else
+ } else {
$('closeButton').classList.add('hidden');
+ $('cancelButton').textContent =
+ MobileSetup.localStrings_.getString('close_button');
+ }
$('finalStatus').classList.remove('hidden');
break;
}

Powered by Google App Engine
This is Rietveld 408576698