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

Side by Side Diff: chrome/browser/resources/mobile_setup.js

Issue 5072001: Improved activation logic to cover few more edge cases. Removed button that w... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 28 matching lines...) Expand all
39 if (this.initialized_) { 39 if (this.initialized_) {
40 console.log('calling initialize() again?'); 40 console.log('calling initialize() again?');
41 return; 41 return;
42 } 42 }
43 this.initialized_ = true; 43 this.initialized_ = true;
44 self = this; 44 self = this;
45 this.frameName_ = frame_name; 45 this.frameName_ = frame_name;
46 window.addEventListener('message', function(e) { 46 window.addEventListener('message', function(e) {
47 self.onMessageReceived_(e); 47 self.onMessageReceived_(e);
48 }); 48 });
49 $('cheat').addEventListener('click', function(e) {
50 console.log('calling setTransactionStatus from cheat.onclick');
51 if (self.faked_transaction_)
52 return;
53 $('paymentForm').classList.add('hidden');
54 chrome.send('setTransactionStatus', ['OK']);
55 self.faked_transaction_ = true;
56 });
57 $(frame_name).addEventListener('load', function(e) { 49 $(frame_name).addEventListener('load', function(e) {
58 // Flip the visibility of the payment page only after the frame is 50 // Flip the visibility of the payment page only after the frame is
59 // fully loaded. 51 // fully loaded.
60 if (self.state_ == MobileSetup.PLAN_ACTIVATION_SHOWING_PAYMENT) { 52 if (self.state_ == MobileSetup.PLAN_ACTIVATION_SHOWING_PAYMENT) {
61 $('statusHeader').textContent = ''; 53 $('statusHeader').textContent = '';
62 $('finalMessage').classList.add('hidden'); 54 $('finalMessage').classList.add('hidden');
63 $('errorMessage').classList.add('hidden'); 55 $('errorMessage').classList.add('hidden');
64 $('systemStatus').classList.add('hidden'); 56 $('systemStatus').classList.add('hidden');
57 $('canvas').classList.add('hidden');
65 $('paymentForm').classList.remove('hidden'); 58 $('paymentForm').classList.remove('hidden');
66 } 59 }
67 }); 60 });
68 61
69 this.changeState_(MobileSetup.PLAN_ACTIVATION_LOADING); 62 this.changeState_(MobileSetup.PLAN_ACTIVATION_LOADING);
70 setInterval(mobile.MobileSetup.drawProgress, 100); 63 setInterval(mobile.MobileSetup.drawProgress, 100);
71 // Kick off activation process. 64 // Kick off activation process.
72 chrome.send('startActivation', []); 65 chrome.send('startActivation', []);
73 }, 66 },
74 67
(...skipping 22 matching lines...) Expand all
97 90
98 changeState_: function(deviceInfo) { 91 changeState_: function(deviceInfo) {
99 var new_state = deviceInfo.state; 92 var new_state = deviceInfo.state;
100 if (this.state_ == new_state) 93 if (this.state_ == new_state)
101 return; 94 return;
102 var main = $('mainbody'); 95 var main = $('mainbody');
103 // Map handler state to UX. 96 // Map handler state to UX.
104 switch(new_state) { 97 switch(new_state) {
105 case MobileSetup.PLAN_ACTIVATION_LOADING: 98 case MobileSetup.PLAN_ACTIVATION_LOADING:
106 case MobileSetup.PLAN_ACTIVATION_START: 99 case MobileSetup.PLAN_ACTIVATION_START:
100 case MobileSetup.PLAN_ACTIVATION_RECONNECTING:
107 $('statusHeader').textContent = 101 $('statusHeader').textContent =
108 MobileSetup.localStrings_.getString('connecting_header'); 102 MobileSetup.localStrings_.getString('connecting_header');
109 $('errorMessage').textContent = ''; 103 $('errorMessage').textContent = '';
110 $('paymentForm').classList.add('hidden'); 104 $('paymentForm').classList.add('hidden');
111 $('finalMessage').classList.add('hidden'); 105 $('finalMessage').classList.add('hidden');
112 $('errorMessage').classList.add('hidden'); 106 $('errorMessage').classList.add('hidden');
113 $('systemStatus').classList.remove('hidden'); 107 $('systemStatus').classList.remove('hidden');
108 $('canvas').classList.remove('hidden');
114 break; 109 break;
115 case MobileSetup.PLAN_ACTIVATION_INITIATING_ACTIVATION: 110 case MobileSetup.PLAN_ACTIVATION_INITIATING_ACTIVATION:
116 case MobileSetup.PLAN_ACTIVATION_RECONNECTING:
117 $('statusHeader').textContent = 111 $('statusHeader').textContent =
118 MobileSetup.localStrings_.getString('activating_header'); 112 MobileSetup.localStrings_.getString('activating_header');
119 $('errorMessage').textContent = ''; 113 $('errorMessage').textContent = '';
120 $('paymentForm').classList.add('hidden'); 114 $('paymentForm').classList.add('hidden');
121 $('finalMessage').classList.add('hidden'); 115 $('finalMessage').classList.add('hidden');
122 $('errorMessage').classList.add('hidden'); 116 $('errorMessage').classList.add('hidden');
123 $('systemStatus').classList.remove('hidden'); 117 $('systemStatus').classList.remove('hidden');
118 $('canvas').classList.remove('hidden');
124 break; 119 break;
125 case MobileSetup.PLAN_ACTIVATION_SHOWING_PAYMENT: 120 case MobileSetup.PLAN_ACTIVATION_SHOWING_PAYMENT:
126 $('paymentForm').classList.add('hidden'); 121 $('paymentForm').classList.add('hidden');
127 $('finalMessage').classList.add('hidden'); 122 $('finalMessage').classList.add('hidden');
128 $('errorMessage').classList.add('hidden'); 123 $('errorMessage').classList.add('hidden');
129 $('systemStatus').classList.remove('hidden'); 124 $('systemStatus').classList.remove('hidden');
125 $('canvas').classList.remove('hidden');
130 this.loadPaymentFrame_(deviceInfo); 126 this.loadPaymentFrame_(deviceInfo);
131 break; 127 break;
132 case MobileSetup.PLAN_ACTIVATION_DONE: 128 case MobileSetup.PLAN_ACTIVATION_DONE:
133 $('statusHeader').textContent = ''; 129 $('statusHeader').textContent = '';
134 $('errorMessage').classList.add('hidden'); 130 $('errorMessage').classList.add('hidden');
135 $('systemStatus').classList.add('hidden'); 131 $('systemStatus').classList.add('hidden');
132 $('canvas').classList.add('hidden');
136 $('paymentForm').classList.remove('hidden'); 133 $('paymentForm').classList.remove('hidden');
137 $('finalMessage').classList.remove('hidden'); 134 $('finalMessage').classList.remove('hidden');
138 break; 135 break;
139 case MobileSetup.PLAN_ACTIVATION_ERROR: 136 case MobileSetup.PLAN_ACTIVATION_ERROR:
140 $('statusHeader').textContent = 137 $('statusHeader').textContent =
141 MobileSetup.localStrings_.getString('error_header'); 138 MobileSetup.localStrings_.getString('error_header');
142 $('errorMessage').textContent = deviceInfo.error; 139 $('errorMessage').textContent = deviceInfo.error;
143 $('paymentForm').classList.add('hidden'); 140 $('paymentForm').classList.add('hidden');
144 $('finalMessage').classList.add('hidden'); 141 $('finalMessage').classList.add('hidden');
142 $('canvas').classList.add('hidden');
145 $('errorMessage').classList.remove('hidden'); 143 $('errorMessage').classList.remove('hidden');
146 $('systemStatus').classList.remove('hidden'); 144 $('systemStatus').classList.remove('hidden');
oshima 2010/11/16 05:44:37 just a suggestion for future. no need to consider
zel 2010/11/16 05:56:06 It's a mixed content that is shown. Yes, it would
147 break; 145 break;
148 } 146 }
149 this.state_ = new_state; 147 this.state_ = new_state;
150 }, 148 },
151 149
152 updateDeviceStatus_: function(deviceInfo) { 150 updateDeviceStatus_: function(deviceInfo) {
153 this.changeState_(deviceInfo); 151 this.changeState_(deviceInfo);
154 }, 152 },
155 153
156 sendDeviceInfo_ : function() { 154 sendDeviceInfo_ : function() {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 mobile.MobileSetup.getInstance().initialize('paymentForm'); 214 mobile.MobileSetup.getInstance().initialize('paymentForm');
217 }; 215 };
218 216
219 // Export 217 // Export
220 return { 218 return {
221 MobileSetup: MobileSetup 219 MobileSetup: MobileSetup
222 }; 220 };
223 221
224 }); 222 });
225 223
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698