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

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

Issue 5329007: UI polish changes on cellular plan activation page.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years 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
« no previous file with comments | « chrome/browser/resources/mobile_setup.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 cr.addSingletonGetter(MobileSetup); 11 cr.addSingletonGetter(MobileSetup);
12 12
13 MobileSetup.PLAN_ACTIVATION_LOADING = -1; 13 MobileSetup.PLAN_ACTIVATION_LOADING = -1;
14 MobileSetup.PLAN_ACTIVATION_START = 0; 14 MobileSetup.PLAN_ACTIVATION_START = 0;
15 MobileSetup.PLAN_ACTIVATION_INITIATING_ACTIVATION = 1; 15 MobileSetup.PLAN_ACTIVATION_INITIATING_ACTIVATION = 1;
16 MobileSetup.PLAN_ACTIVATION_RECONNECTING = 2; 16 MobileSetup.PLAN_ACTIVATION_RECONNECTING = 2;
17 MobileSetup.PLAN_ACTIVATION_SHOWING_PAYMENT = 3; 17 MobileSetup.PLAN_ACTIVATION_SHOWING_PAYMENT = 3;
18 MobileSetup.PLAN_ACTIVATION_DONE = 4; 18 MobileSetup.PLAN_ACTIVATION_DONE = 4;
19 MobileSetup.PLAN_ACTIVATION_ERROR = 5; 19 MobileSetup.PLAN_ACTIVATION_ERROR = 5;
20 20
21 MobileSetup.ACTIVATION_PAGE_URL =
22 'file:///usr/share/chromeos-assets/mobile/activation.html';
23
21 MobileSetup.localStrings_ = new LocalStrings(); 24 MobileSetup.localStrings_ = new LocalStrings();
22 25
23 MobileSetup.prototype = { 26 MobileSetup.prototype = {
24 // Mobile device information. 27 // Mobile device information.
25 deviceInfo_: null, 28 deviceInfo_: null,
26 frameName_ : '', 29 frameName_ : '',
27 initialized_ : false, 30 initialized_ : false,
28 faked_transaction_ : false, 31 faked_transaction_ : false,
29 // UI states. 32 // UI states.
30 state_ : -1, 33 state_ : -1,
31 STATE_UNKNOWN_: "unknown", 34 STATE_UNKNOWN_: "unknown",
32 STATE_CONNECTING_: "connecting", 35 STATE_CONNECTING_: "connecting",
33 STATE_ERROR_: "error", 36 STATE_ERROR_: "error",
34 STATE_PAYMENT_: "payment", 37 STATE_PAYMENT_: "payment",
35 STATE_ACTIVATING_: "activating", 38 STATE_ACTIVATING_: "activating",
36 STATE_CONNECTED_: "connected", 39 STATE_CONNECTED_: "connected",
37 40
38 initialize: function(frame_name) { 41 initialize: function(frame_name, carrierPage) {
39 if (this.initialized_) { 42 if (this.initialized_) {
40 console.log('calling initialize() again?'); 43 console.log('calling initialize() again?');
41 return; 44 return;
42 } 45 }
43 this.initialized_ = true; 46 this.initialized_ = true;
44 self = this; 47 self = this;
45 this.frameName_ = frame_name; 48 this.frameName_ = frame_name;
46 window.addEventListener('message', function(e) { 49 window.addEventListener('message', function(e) {
47 self.onMessageReceived_(e); 50 self.onMessageReceived_(e);
48 }); 51 });
49 $('closeButton').addEventListener('click', function(e) { 52 $('closeButton').addEventListener('click', function(e) {
50 $('finalMessage').classList.add('hidden'); 53 $('finalMessage').classList.add('hidden');
51 }); 54 });
55 $('carrierPage').contentWindow.location.href =
56 carrierPage;
52 $(frame_name).addEventListener('load', function(e) { 57 $(frame_name).addEventListener('load', function(e) {
53 // Flip the visibility of the payment page only after the frame is 58 // Flip the visibility of the payment page only after the frame is
54 // fully loaded. 59 // fully loaded.
55 if (self.state_ == MobileSetup.PLAN_ACTIVATION_SHOWING_PAYMENT) { 60 if (self.state_ == MobileSetup.PLAN_ACTIVATION_SHOWING_PAYMENT) {
56 $('statusHeader').textContent = ''; 61 $('statusHeader').textContent = '';
62 $('auxHeader').textContent = '';
57 $('finalMessage').classList.add('hidden'); 63 $('finalMessage').classList.add('hidden');
58 $('errorMessage').classList.add('hidden'); 64 $('errorMessage').classList.add('hidden');
59 $('systemStatus').classList.add('hidden'); 65 $('systemStatus').classList.add('hidden');
60 $('canvas').classList.add('hidden'); 66 $('canvas').classList.add('hidden');
67 $('carrierPage').classList.add('hidden');
61 $('paymentForm').classList.remove('hidden'); 68 $('paymentForm').classList.remove('hidden');
62 } 69 }
63 }); 70 });
64 71
65 this.changeState_(MobileSetup.PLAN_ACTIVATION_LOADING); 72 this.changeState_(MobileSetup.PLAN_ACTIVATION_LOADING);
66 setInterval(mobile.MobileSetup.drawProgress, 100); 73 setInterval(mobile.MobileSetup.drawProgress, 100);
67 // Kick off activation process. 74 // Kick off activation process.
68 chrome.send('startActivation', []); 75 chrome.send('startActivation', []);
69 }, 76 },
70 77
(...skipping 25 matching lines...) Expand all
96 if (this.state_ == new_state) 103 if (this.state_ == new_state)
97 return; 104 return;
98 var main = $('mainbody'); 105 var main = $('mainbody');
99 // Map handler state to UX. 106 // Map handler state to UX.
100 switch(new_state) { 107 switch(new_state) {
101 case MobileSetup.PLAN_ACTIVATION_LOADING: 108 case MobileSetup.PLAN_ACTIVATION_LOADING:
102 case MobileSetup.PLAN_ACTIVATION_START: 109 case MobileSetup.PLAN_ACTIVATION_START:
103 case MobileSetup.PLAN_ACTIVATION_RECONNECTING: 110 case MobileSetup.PLAN_ACTIVATION_RECONNECTING:
104 $('statusHeader').textContent = 111 $('statusHeader').textContent =
105 MobileSetup.localStrings_.getString('connecting_header'); 112 MobileSetup.localStrings_.getString('connecting_header');
113 $('auxHeader').textContent =
114 MobileSetup.localStrings_.getString('please_wait');
106 $('errorMessage').textContent = ''; 115 $('errorMessage').textContent = '';
107 $('paymentForm').classList.add('hidden'); 116 $('paymentForm').classList.add('hidden');
108 $('finalMessage').classList.add('hidden'); 117 $('finalMessage').classList.add('hidden');
109 $('errorMessage').classList.add('hidden'); 118 $('errorMessage').classList.add('hidden');
110 $('systemStatus').classList.remove('hidden'); 119 $('systemStatus').classList.remove('hidden');
111 $('canvas').classList.remove('hidden'); 120 $('canvas').classList.remove('hidden');
121 $('carrierPage').classList.remove('hidden');
112 break; 122 break;
113 case MobileSetup.PLAN_ACTIVATION_INITIATING_ACTIVATION: 123 case MobileSetup.PLAN_ACTIVATION_INITIATING_ACTIVATION:
114 $('statusHeader').textContent = 124 $('statusHeader').textContent =
115 MobileSetup.localStrings_.getString('activating_header'); 125 MobileSetup.localStrings_.getString('activating_header');
126 $('auxHeader').textContent =
127 MobileSetup.localStrings_.getString('please_wait');
116 $('errorMessage').textContent = ''; 128 $('errorMessage').textContent = '';
117 $('paymentForm').classList.add('hidden'); 129 $('paymentForm').classList.add('hidden');
118 $('finalMessage').classList.add('hidden'); 130 $('finalMessage').classList.add('hidden');
119 $('errorMessage').classList.add('hidden'); 131 $('errorMessage').classList.add('hidden');
120 $('systemStatus').classList.remove('hidden'); 132 $('systemStatus').classList.remove('hidden');
121 $('canvas').classList.remove('hidden'); 133 $('canvas').classList.remove('hidden');
134 $('carrierPage').classList.remove('hidden');
122 break; 135 break;
123 case MobileSetup.PLAN_ACTIVATION_SHOWING_PAYMENT: 136 case MobileSetup.PLAN_ACTIVATION_SHOWING_PAYMENT:
124 $('statusHeader').textContent = 137 $('statusHeader').textContent =
125 MobileSetup.localStrings_.getString('connecting_header'); 138 MobileSetup.localStrings_.getString('connecting_header');
139 $('auxHeader').textContent = '';
126 $('paymentForm').classList.add('hidden'); 140 $('paymentForm').classList.add('hidden');
127 $('finalMessage').classList.add('hidden'); 141 $('finalMessage').classList.add('hidden');
128 $('errorMessage').classList.add('hidden'); 142 $('errorMessage').classList.add('hidden');
129 $('systemStatus').classList.remove('hidden'); 143 $('systemStatus').classList.remove('hidden');
130 $('canvas').classList.remove('hidden'); 144 $('canvas').classList.remove('hidden');
131 this.loadPaymentFrame_(deviceInfo); 145 this.loadPaymentFrame_(deviceInfo);
132 break; 146 break;
133 case MobileSetup.PLAN_ACTIVATION_DONE: 147 case MobileSetup.PLAN_ACTIVATION_DONE:
134 $('statusHeader').textContent = ''; 148 $('statusHeader').textContent = '';
149 $('auxHeader').textContent = '';
135 $('errorMessage').classList.add('hidden'); 150 $('errorMessage').classList.add('hidden');
136 $('systemStatus').classList.add('hidden'); 151 $('systemStatus').classList.add('hidden');
137 $('canvas').classList.add('hidden'); 152 $('canvas').classList.add('hidden');
153 $('carrierPage').classList.add('hidden');
138 $('paymentForm').classList.remove('hidden'); 154 $('paymentForm').classList.remove('hidden');
139 $('finalMessage').classList.remove('hidden'); 155 $('finalMessage').classList.remove('hidden');
140 break; 156 break;
141 case MobileSetup.PLAN_ACTIVATION_ERROR: 157 case MobileSetup.PLAN_ACTIVATION_ERROR:
142 $('statusHeader').textContent = 158 $('statusHeader').textContent =
143 MobileSetup.localStrings_.getString('error_header'); 159 MobileSetup.localStrings_.getString('error_header');
160 $('auxHeader').textContent = '';
144 $('errorMessage').textContent = deviceInfo.error; 161 $('errorMessage').textContent = deviceInfo.error;
145 $('paymentForm').classList.add('hidden'); 162 $('paymentForm').classList.add('hidden');
146 $('finalMessage').classList.add('hidden'); 163 $('finalMessage').classList.add('hidden');
164 $('carrierPage').classList.add('hidden');
147 $('canvas').classList.add('hidden'); 165 $('canvas').classList.add('hidden');
148 $('errorMessage').classList.remove('hidden'); 166 $('errorMessage').classList.remove('hidden');
149 $('systemStatus').classList.remove('hidden'); 167 $('systemStatus').classList.remove('hidden');
150 break; 168 break;
151 } 169 }
152 this.state_ = new_state; 170 this.state_ = new_state;
153 }, 171 },
154 172
155 updateDeviceStatus_: function(deviceInfo) { 173 updateDeviceStatus_: function(deviceInfo) {
156 this.changeState_(deviceInfo); 174 this.changeState_(deviceInfo);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 ctx.fillStyle = "rgba(240, 30, 29, " + opacity + ")"; 227 ctx.fillStyle = "rgba(240, 30, 29, " + opacity + ")";
210 ctx.fill(); 228 ctx.fill();
211 } 229 }
212 }; 230 };
213 231
214 MobileSetup.deviceStateChanged = function(deviceInfo) { 232 MobileSetup.deviceStateChanged = function(deviceInfo) {
215 MobileSetup.getInstance().updateDeviceStatus_(deviceInfo); 233 MobileSetup.getInstance().updateDeviceStatus_(deviceInfo);
216 }; 234 };
217 235
218 MobileSetup.loadPage = function() { 236 MobileSetup.loadPage = function() {
219 mobile.MobileSetup.getInstance().initialize('paymentForm'); 237 mobile.MobileSetup.getInstance().initialize('paymentForm',
238 mobile.MobileSetup.ACTIVATION_PAGE_URL);
220 }; 239 };
221 240
222 // Export 241 // Export
223 return { 242 return {
224 MobileSetup: MobileSetup 243 MobileSetup: MobileSetup
225 }; 244 };
226 245
227 }); 246 });
228 247
OLDNEW
« no previous file with comments | « chrome/browser/resources/mobile_setup.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698