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

Side by Side Diff: chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc

Issue 8341037: Added logic that will retry to reload+reconnect the mobile payment portal page 5 times before it ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/browser/ui/webui/chromeos/mobile_setup_ui.h" 5 #include "chrome/browser/ui/webui/chromeos/mobile_setup_ui.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 13 matching lines...) Expand all
24 #include "base/values.h" 24 #include "base/values.h"
25 #include "chrome/browser/browser_process.h" 25 #include "chrome/browser/browser_process.h"
26 #include "chrome/browser/chromeos/cros/cros_library.h" 26 #include "chrome/browser/chromeos/cros/cros_library.h"
27 #include "chrome/browser/chromeos/cros/network_library.h" 27 #include "chrome/browser/chromeos/cros/network_library.h"
28 #include "chrome/browser/prefs/pref_service.h" 28 #include "chrome/browser/prefs/pref_service.h"
29 #include "chrome/browser/profiles/profile.h" 29 #include "chrome/browser/profiles/profile.h"
30 #include "chrome/browser/ui/browser_list.h" 30 #include "chrome/browser/ui/browser_list.h"
31 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 31 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
32 #include "chrome/common/jstemplate_builder.h" 32 #include "chrome/common/jstemplate_builder.h"
33 #include "chrome/common/pref_names.h" 33 #include "chrome/common/pref_names.h"
34 #include "chrome/common/render_messages.h"
34 #include "chrome/common/url_constants.h" 35 #include "chrome/common/url_constants.h"
35 #include "content/browser/browser_thread.h" 36 #include "content/browser/browser_thread.h"
37 #include "content/browser/renderer_host/render_view_host_observer.h"
36 #include "content/browser/tab_contents/tab_contents.h" 38 #include "content/browser/tab_contents/tab_contents.h"
37 #include "googleurl/src/gurl.h" 39 #include "googleurl/src/gurl.h"
38 #include "grit/browser_resources.h" 40 #include "grit/browser_resources.h"
39 #include "grit/chromium_strings.h" 41 #include "grit/chromium_strings.h"
40 #include "grit/generated_resources.h" 42 #include "grit/generated_resources.h"
41 #include "grit/locale_settings.h" 43 #include "grit/locale_settings.h"
42 #include "ui/base/l10n/l10n_util.h" 44 #include "ui/base/l10n/l10n_util.h"
43 #include "ui/base/resource/resource_bundle.h" 45 #include "ui/base/resource/resource_bundle.h"
44 46
45 namespace { 47 namespace {
46 48
47 // Host page JS API function names. 49 // Host page JS API function names.
48 const char kJsApiStartActivation[] = "startActivation"; 50 const char kJsApiStartActivation[] = "startActivation";
49 const char kJsApiSetTransactionStatus[] = "setTransactionStatus"; 51 const char kJsApiSetTransactionStatus[] = "setTransactionStatus";
52 const char kJsApiPaymentPortalLoad[] = "paymentPortalLoad";
53 const char kJsApiResultOK[] = "ok";
50 54
51 const char kJsDeviceStatusChangedHandler[] = 55 const char kJsDeviceStatusChangedCallback[] =
52 "mobile.MobileSetup.deviceStateChanged"; 56 "mobile.MobileSetup.deviceStateChanged";
57 const char kJsPortalFrameLoadFailedCallback[] =
58 "mobile.MobileSetup.portalFrameLoadError";
59 const char kJsPortalFrameLoadCompletedCallback[] =
60 "mobile.MobileSetup.portalFrameLoadCompleted";
53 61
54 // Error codes matching codes defined in the cellular config file. 62 // Error codes matching codes defined in the cellular config file.
55 const char kErrorDefault[] = "default"; 63 const char kErrorDefault[] = "default";
56 const char kErrorBadConnectionPartial[] = "bad_connection_partial"; 64 const char kErrorBadConnectionPartial[] = "bad_connection_partial";
57 const char kErrorBadConnectionActivated[] = "bad_connection_activated"; 65 const char kErrorBadConnectionActivated[] = "bad_connection_activated";
58 const char kErrorRoamingOnConnection[] = "roaming_connection"; 66 const char kErrorRoamingOnConnection[] = "roaming_connection";
59 const char kErrorNoEVDO[] = "no_evdo"; 67 const char kErrorNoEVDO[] = "no_evdo";
60 const char kErrorRoamingActivation[] = "roaming_activation"; 68 const char kErrorRoamingActivation[] = "roaming_activation";
61 const char kErrorRoamingPartiallyActivated[] = "roaming_partially_activated"; 69 const char kErrorRoamingPartiallyActivated[] = "roaming_partially_activated";
62 const char kErrorNoService[] = "no_service"; 70 const char kErrorNoService[] = "no_service";
63 const char kErrorDisabled[] = "disabled"; 71 const char kErrorDisabled[] = "disabled";
64 const char kErrorNoDevice[] = "no_device"; 72 const char kErrorNoDevice[] = "no_device";
65 const char kFailedPaymentError[] = "failed_payment"; 73 const char kFailedPaymentError[] = "failed_payment";
66 const char kFailedConnectivity[] = "connectivity"; 74 const char kFailedConnectivity[] = "connectivity";
67 const char kErrorAlreadyRunning[] = "already_running"; 75 const char kErrorAlreadyRunning[] = "already_running";
68 76
69 // Cellular configuration file path. 77 // Cellular configuration file path.
70 const char kCellularConfigPath[] = 78 const char kCellularConfigPath[] =
71 "/usr/share/chromeos-assets/mobile/mobile_config.json"; 79 "/usr/share/chromeos-assets/mobile/mobile_config.json";
72 80
73 // Cellular config file field names. 81 // Cellular config file field names.
74 const char kVersionField[] = "version"; 82 const char kVersionField[] = "version";
75 const char kErrorsField[] = "errors"; 83 const char kErrorsField[] = "errors";
76 84
77 // Number of times we will retry to restart the activation process in case 85 // Number of times we will retry to restart the activation process in case
78 // there is no connectivity in the restricted pool. 86 // there is no connectivity in the restricted pool.
79 const int kMaxActivationAttempt = 3; 87 const int kMaxActivationAttempt = 3;
80 // Number of times we will retry to reconnect if connection fails. 88 // Number of times we will retry to reconnect if connection fails.
81 const int kMaxConnectionRetry = 10; 89 const int kMaxConnectionRetry = 10;
90 // Number of times we will retry to reconnect and reload payment portal page.
91 const int kMaxPortalReconnectCount = 5;
82 // Number of times we will retry to reconnect if connection fails. 92 // Number of times we will retry to reconnect if connection fails.
83 const int kMaxConnectionRetryOTASP = 30; 93 const int kMaxConnectionRetryOTASP = 30;
84 // Number of times we will retry to reconnect after payment is processed. 94 // Number of times we will retry to reconnect after payment is processed.
85 const int kMaxReconnectAttemptOTASP = 30; 95 const int kMaxReconnectAttemptOTASP = 30;
86 // Reconnect retry delay (after payment is processed). 96 // Reconnect retry delay (after payment is processed).
87 const int kPostPaymentReconnectDelayMS = 30000; // 30s. 97 const int kPostPaymentReconnectDelayMS = 30000; // 30s.
88 // Connection timeout in seconds. 98 // Connection timeout in seconds.
89 const int kConnectionTimeoutSeconds = 45; 99 const int kConnectionTimeoutSeconds = 45;
90 // Reconnect delay. 100 // Reconnect delay.
91 const int kReconnectDelayMS = 3000; 101 const int kReconnectDelayMS = 3000;
(...skipping 14 matching lines...) Expand all
106 } 116 }
107 117
108 chromeos::CellularNetwork* GetCellularNetwork( 118 chromeos::CellularNetwork* GetCellularNetwork(
109 const std::string& service_path) { 119 const std::string& service_path) {
110 return chromeos::CrosLibrary::Get()-> 120 return chromeos::CrosLibrary::Get()->
111 GetNetworkLibrary()->FindCellularNetworkByPath(service_path); 121 GetNetworkLibrary()->FindCellularNetworkByPath(service_path);
112 } 122 }
113 123
114 } // namespace 124 } // namespace
115 125
126 // Observes IPC messages from the rederer and notifies JS if frame loading error
127 // appears.
128 class PortalFrameLoadObserver : public RenderViewHostObserver {
129 public:
130 PortalFrameLoadObserver(RenderViewHost* host, WebUI* webui)
131 : RenderViewHostObserver(host), webui_(webui) {
132 DCHECK(webui_);
133 Send(new ChromeViewMsg_StartFrameSniffer(routing_id(),
134 UTF8ToUTF16("paymentForm")));
135 }
136
137 virtual ~PortalFrameLoadObserver() {}
138
139 // IPC::Channel::Listener implementation.
140 virtual bool OnMessageReceived(const IPC::Message& message) {
141 bool handled = true;
142 IPC_BEGIN_MESSAGE_MAP(PortalFrameLoadObserver, message)
143 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FrameLoadingError, OnFrameLoadError)
144 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FrameLoadingCompleted,
145 OnFrameLoadCompleted)
146 IPC_MESSAGE_UNHANDLED(handled = false)
147 IPC_END_MESSAGE_MAP()
148 return handled;
149 }
150
151 private:
152 void OnFrameLoadError(int error) {
153 base::FundamentalValue result_value(error);
154 webui_->CallJavascriptFunction(
155 kJsPortalFrameLoadFailedCallback, result_value);
156 }
157
158 void OnFrameLoadCompleted() {
159 webui_->CallJavascriptFunction(kJsPortalFrameLoadCompletedCallback);
160 }
161
162 DISALLOW_COPY_AND_ASSIGN(PortalFrameLoadObserver);
xiyuan 2011/10/26 23:17:03 nit: This should be the last.
163 WebUI* webui_;
164 };
165
116 class CellularConfigDocument { 166 class CellularConfigDocument {
117 public: 167 public:
118 CellularConfigDocument() {} 168 CellularConfigDocument() {}
119 169
120 // Return error message for a given code. 170 // Return error message for a given code.
121 std::string GetErrorMessage(const std::string& code); 171 std::string GetErrorMessage(const std::string& code);
122 const std::string& version() { return version_; } 172 const std::string& version() { return version_; }
123 173
124 bool LoadFromFile(const FilePath& config_path); 174 bool LoadFromFile(const FilePath& config_path);
125 175
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 const chromeos::Network* network) OVERRIDE; 226 const chromeos::Network* network) OVERRIDE;
177 227
178 private: 228 private:
179 typedef enum PlanActivationState { 229 typedef enum PlanActivationState {
180 PLAN_ACTIVATION_PAGE_LOADING = -1, 230 PLAN_ACTIVATION_PAGE_LOADING = -1,
181 PLAN_ACTIVATION_START = 0, 231 PLAN_ACTIVATION_START = 0,
182 PLAN_ACTIVATION_TRYING_OTASP = 1, 232 PLAN_ACTIVATION_TRYING_OTASP = 1,
183 PLAN_ACTIVATION_RECONNECTING_OTASP_TRY = 2, 233 PLAN_ACTIVATION_RECONNECTING_OTASP_TRY = 2,
184 PLAN_ACTIVATION_INITIATING_ACTIVATION = 3, 234 PLAN_ACTIVATION_INITIATING_ACTIVATION = 3,
185 PLAN_ACTIVATION_RECONNECTING = 4, 235 PLAN_ACTIVATION_RECONNECTING = 4,
186 PLAN_ACTIVATION_SHOWING_PAYMENT = 5, 236 PLAN_ACTIVATION_PAYMENT_PORTAL_LOADING = 5,
187 PLAN_ACTIVATION_DELAY_OTASP = 6, 237 PLAN_ACTIVATION_SHOWING_PAYMENT = 6,
188 PLAN_ACTIVATION_START_OTASP = 7, 238 PLAN_ACTIVATION_RECONNECTING_PAYMENT = 7,
189 PLAN_ACTIVATION_OTASP = 8, 239 PLAN_ACTIVATION_DELAY_OTASP = 8,
190 PLAN_ACTIVATION_RECONNECTING_OTASP = 9, 240 PLAN_ACTIVATION_START_OTASP = 9,
191 PLAN_ACTIVATION_DONE = 10, 241 PLAN_ACTIVATION_OTASP = 10,
242 PLAN_ACTIVATION_RECONNECTING_OTASP = 11,
243 PLAN_ACTIVATION_DONE = 12,
192 PLAN_ACTIVATION_ERROR = 0xFF, 244 PLAN_ACTIVATION_ERROR = 0xFF,
193 } PlanActivationState; 245 } PlanActivationState;
194 246
195 class TaskProxy : public base::RefCountedThreadSafe<TaskProxy> { 247 class TaskProxy : public base::RefCountedThreadSafe<TaskProxy> {
196 public: 248 public:
197 TaskProxy(const base::WeakPtr<MobileSetupHandler>& handler, int delay) 249 TaskProxy(const base::WeakPtr<MobileSetupHandler>& handler, int delay)
198 : handler_(handler), delay_(delay) { 250 : handler_(handler), delay_(delay) {
199 } 251 }
200 TaskProxy(const base::WeakPtr<MobileSetupHandler>& handler, 252 TaskProxy(const base::WeakPtr<MobileSetupHandler>& handler,
201 const std::string& status) 253 const std::string& status)
(...skipping 18 matching lines...) Expand all
220 private: 272 private:
221 base::WeakPtr<MobileSetupHandler> handler_; 273 base::WeakPtr<MobileSetupHandler> handler_;
222 std::string status_; 274 std::string status_;
223 int delay_; 275 int delay_;
224 DISALLOW_COPY_AND_ASSIGN(TaskProxy); 276 DISALLOW_COPY_AND_ASSIGN(TaskProxy);
225 }; 277 };
226 278
227 // Handlers for JS WebUI messages. 279 // Handlers for JS WebUI messages.
228 void HandleSetTransactionStatus(const ListValue* args); 280 void HandleSetTransactionStatus(const ListValue* args);
229 void HandleStartActivation(const ListValue* args); 281 void HandleStartActivation(const ListValue* args);
282 void HandlePaymentPortalLoad(const ListValue* args);
230 void SetTransactionStatus(const std::string& status); 283 void SetTransactionStatus(const std::string& status);
231 // Schedules activation process via task proxy. 284 // Schedules activation process via task proxy.
232 void InitiateActivation(); 285 void InitiateActivation();
233 // Starts activation. 286 // Starts activation.
234 void StartActivation(); 287 void StartActivation();
235 // Retried OTASP. 288 // Retried OTASP.
236 void RetryOTASP(); 289 void RetryOTASP();
237 // Continues activation process. This method is called after we disconnect 290 // Continues activation process. This method is called after we disconnect
238 // due to detected connectivity issue to kick off reconnection. 291 // due to detected connectivity issue to kick off reconnection.
239 void ContinueConnecting(int delay); 292 void ContinueConnecting(int delay);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 bool reenable_wifi_; 365 bool reenable_wifi_;
313 bool reenable_ethernet_; 366 bool reenable_ethernet_;
314 bool reenable_cert_check_; 367 bool reenable_cert_check_;
315 bool evaluating_; 368 bool evaluating_;
316 // True if we think that another tab is already running activation. 369 // True if we think that another tab is already running activation.
317 bool already_running_; 370 bool already_running_;
318 // Connection retry counter. 371 // Connection retry counter.
319 int connection_retry_count_; 372 int connection_retry_count_;
320 // Post payment reconnect wait counters. 373 // Post payment reconnect wait counters.
321 int reconnect_wait_count_; 374 int reconnect_wait_count_;
375 // Payment portal reload/reconnect attempt count.
376 int payment_reconnect_count_;
322 // Activation retry attempt count; 377 // Activation retry attempt count;
323 int activation_attempt_; 378 int activation_attempt_;
324 // Connection start time. 379 // Connection start time.
325 base::Time connection_start_time_; 380 base::Time connection_start_time_;
326 // Timer that monitors reconnection timeouts. 381 // Timer that monitors reconnection timeouts.
327 base::RepeatingTimer<MobileSetupHandler> reconnect_timer_; 382 base::RepeatingTimer<MobileSetupHandler> reconnect_timer_;
328 383
329 DISALLOW_COPY_AND_ASSIGN(MobileSetupHandler); 384 DISALLOW_COPY_AND_ASSIGN(MobileSetupHandler);
330 }; 385 };
331 386
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 : tab_contents_(NULL), 508 : tab_contents_(NULL),
454 state_(PLAN_ACTIVATION_PAGE_LOADING), 509 state_(PLAN_ACTIVATION_PAGE_LOADING),
455 service_path_(service_path), 510 service_path_(service_path),
456 reenable_wifi_(false), 511 reenable_wifi_(false),
457 reenable_ethernet_(false), 512 reenable_ethernet_(false),
458 reenable_cert_check_(false), 513 reenable_cert_check_(false),
459 evaluating_(false), 514 evaluating_(false),
460 already_running_(false), 515 already_running_(false),
461 connection_retry_count_(0), 516 connection_retry_count_(0),
462 reconnect_wait_count_(0), 517 reconnect_wait_count_(0),
518 payment_reconnect_count_(0),
463 activation_attempt_(0) { 519 activation_attempt_(0) {
464 } 520 }
465 521
466 MobileSetupHandler::~MobileSetupHandler() { 522 MobileSetupHandler::~MobileSetupHandler() {
467 reconnect_timer_.Stop(); 523 reconnect_timer_.Stop();
468 chromeos::NetworkLibrary* lib = 524 chromeos::NetworkLibrary* lib =
469 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); 525 chromeos::CrosLibrary::Get()->GetNetworkLibrary();
470 lib->RemoveNetworkManagerObserver(this); 526 lib->RemoveNetworkManagerObserver(this);
471 lib->RemoveObserverForAllNetworks(this); 527 lib->RemoveObserverForAllNetworks(this);
472 if (lib->IsLocked()) 528 if (lib->IsLocked())
(...skipping 17 matching lines...) Expand all
490 already_running_ = true; 546 already_running_ = true;
491 } 547 }
492 548
493 void MobileSetupHandler::RegisterMessages() { 549 void MobileSetupHandler::RegisterMessages() {
494 web_ui_->RegisterMessageCallback(kJsApiStartActivation, 550 web_ui_->RegisterMessageCallback(kJsApiStartActivation,
495 base::Bind(&MobileSetupHandler::HandleStartActivation, 551 base::Bind(&MobileSetupHandler::HandleStartActivation,
496 base::Unretained(this))); 552 base::Unretained(this)));
497 web_ui_->RegisterMessageCallback(kJsApiSetTransactionStatus, 553 web_ui_->RegisterMessageCallback(kJsApiSetTransactionStatus,
498 base::Bind(&MobileSetupHandler::HandleSetTransactionStatus, 554 base::Bind(&MobileSetupHandler::HandleSetTransactionStatus,
499 base::Unretained(this))); 555 base::Unretained(this)));
556 web_ui_->RegisterMessageCallback(kJsApiPaymentPortalLoad,
557 base::Bind(&MobileSetupHandler::HandlePaymentPortalLoad,
558 base::Unretained(this)));
500 } 559 }
501 560
502 void MobileSetupHandler::OnNetworkManagerChanged( 561 void MobileSetupHandler::OnNetworkManagerChanged(
503 chromeos::NetworkLibrary* cros) { 562 chromeos::NetworkLibrary* cros) {
504 if (state_ == PLAN_ACTIVATION_PAGE_LOADING) 563 if (state_ == PLAN_ACTIVATION_PAGE_LOADING)
505 return; 564 return;
506 // Note that even though we get here when the service has 565 // Note that even though we get here when the service has
507 // reappeared after disappearing earlier in the activation 566 // reappeared after disappearing earlier in the activation
508 // process, there's no need to re-establish the NetworkObserver, 567 // process, there's no need to re-establish the NetworkObserver,
509 // because the service path remains the same. 568 // because the service path remains the same.
(...skipping 19 matching lines...) Expand all
529 return; 588 return;
530 // Get change callback function name. 589 // Get change callback function name.
531 std::string status; 590 std::string status;
532 if (!args->GetString(0, &status)) 591 if (!args->GetString(0, &status))
533 return; 592 return;
534 scoped_refptr<TaskProxy> task = new TaskProxy(AsWeakPtr(), status); 593 scoped_refptr<TaskProxy> task = new TaskProxy(AsWeakPtr(), status);
535 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 594 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
536 base::Bind(&TaskProxy::HandleSetTransactionStatus, task.get())); 595 base::Bind(&TaskProxy::HandleSetTransactionStatus, task.get()));
537 } 596 }
538 597
598 void MobileSetupHandler::HandlePaymentPortalLoad(const ListValue* args) {
599 const size_t kPaymentPortalLoadParamCount = 1;
600 if (args->GetSize() != kPaymentPortalLoadParamCount)
601 return;
602 // Get change callback function name.
603 std::string result;
604 if (!args->GetString(0, &result))
605 return;
606 chromeos::CellularNetwork* network = GetCellularNetwork(service_path_);
607 if (!network) {
608 ChangeState(NULL, PLAN_ACTIVATION_ERROR,
609 GetErrorMessage(kErrorNoService));
610 return;
611 }
612 if (state_ == PLAN_ACTIVATION_PAYMENT_PORTAL_LOADING ||
613 state_ == PLAN_ACTIVATION_SHOWING_PAYMENT) {
614 if (LowerCaseEqualsASCII(result, kJsApiResultOK)) {
615 payment_reconnect_count_ = 0;
616 ChangeState(network, PLAN_ACTIVATION_SHOWING_PAYMENT, std::string());
617 } else {
618 payment_reconnect_count_++;
619 if (payment_reconnect_count_ > kMaxPortalReconnectCount) {
620 ChangeState(NULL, PLAN_ACTIVATION_ERROR,
621 GetErrorMessage(kErrorNoService));
622 return;
623 }
624 // Disconnect now, this should force reconnection and we will retry to
625 // load the frame containing payment portal again.
626 DisconnectFromNetwork(network);
627 }
628 } else {
629 NOTREACHED() << "Called paymentPortalLoad while in unexpected state: "
630 << GetStateDescription(state_);
631 }
632 }
633
539 void MobileSetupHandler::InitiateActivation() { 634 void MobileSetupHandler::InitiateActivation() {
540 scoped_refptr<TaskProxy> task = new TaskProxy(AsWeakPtr(), 0); 635 scoped_refptr<TaskProxy> task = new TaskProxy(AsWeakPtr(), 0);
541 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 636 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
542 base::Bind(&TaskProxy::HandleStartActivation, task.get())); 637 base::Bind(&TaskProxy::HandleStartActivation, task.get()));
543 } 638 }
544 639
545 void MobileSetupHandler::StartActivation() { 640 void MobileSetupHandler::StartActivation() {
546 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 641 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
547 chromeos::NetworkLibrary* lib = 642 chromeos::NetworkLibrary* lib =
548 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); 643 chromeos::CrosLibrary::Get()->GetNetworkLibrary();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 EvaluateCellularNetwork(network); 681 EvaluateCellularNetwork(network);
587 } else { 682 } else {
588 ConnectToNetwork(network, delay); 683 ConnectToNetwork(network, delay);
589 } 684 }
590 } 685 }
591 686
592 void MobileSetupHandler::SetTransactionStatus(const std::string& status) { 687 void MobileSetupHandler::SetTransactionStatus(const std::string& status) {
593 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 688 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
594 // The payment is received, try to reconnect and check the status all over 689 // The payment is received, try to reconnect and check the status all over
595 // again. 690 // again.
596 if (LowerCaseEqualsASCII(status, "ok") && 691 if (LowerCaseEqualsASCII(status, kJsApiResultOK) &&
597 state_ == PLAN_ACTIVATION_SHOWING_PAYMENT) { 692 state_ == PLAN_ACTIVATION_SHOWING_PAYMENT) {
598 chromeos::NetworkLibrary* lib = 693 chromeos::NetworkLibrary* lib =
599 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); 694 chromeos::CrosLibrary::Get()->GetNetworkLibrary();
600 lib->SignalCellularPlanPayment(); 695 lib->SignalCellularPlanPayment();
601 UMA_HISTOGRAM_COUNTS("Cellular.PaymentReceived", 1); 696 UMA_HISTOGRAM_COUNTS("Cellular.PaymentReceived", 1);
602 StartOTASP(); 697 StartOTASP();
603 } else { 698 } else {
604 UMA_HISTOGRAM_COUNTS("Cellular.PaymentFailed", 1); 699 UMA_HISTOGRAM_COUNTS("Cellular.PaymentFailed", 1);
605 } 700 }
606 } 701 }
607 702
608 void MobileSetupHandler::StartOTASP() { 703 void MobileSetupHandler::StartOTASP() {
609 state_ = PLAN_ACTIVATION_START_OTASP; 704 state_ = PLAN_ACTIVATION_START_OTASP;
610 chromeos::CellularNetwork* network = GetCellularNetwork(); 705 chromeos::CellularNetwork* network = GetCellularNetwork();
611 if (network && 706 if (network &&
612 network->connected() && 707 network->connected() &&
613 network->activation_state() == chromeos::ACTIVATION_STATE_ACTIVATED) { 708 network->activation_state() == chromeos::ACTIVATION_STATE_ACTIVATED) {
614 chromeos::CrosLibrary::Get()->GetNetworkLibrary()-> 709 chromeos::CrosLibrary::Get()->GetNetworkLibrary()->
615 DisconnectFromNetwork(network); 710 DisconnectFromNetwork(network);
616 } else { 711 } else {
617 EvaluateCellularNetwork(network); 712 EvaluateCellularNetwork(network);
618 } 713 }
619 } 714 }
620 715
621 void MobileSetupHandler::ReconnectTimerFired() { 716 void MobileSetupHandler::ReconnectTimerFired() {
622 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 717 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
623 // Permit network connection changes only in reconnecting states. 718 // Permit network connection changes only in reconnecting states.
624 if (state_ != PLAN_ACTIVATION_RECONNECTING_OTASP_TRY && 719 if (state_ != PLAN_ACTIVATION_RECONNECTING_OTASP_TRY &&
625 state_ != PLAN_ACTIVATION_RECONNECTING && 720 state_ != PLAN_ACTIVATION_RECONNECTING &&
721 state_ != PLAN_ACTIVATION_RECONNECTING_PAYMENT &&
626 state_ != PLAN_ACTIVATION_RECONNECTING_OTASP) 722 state_ != PLAN_ACTIVATION_RECONNECTING_OTASP)
627 return; 723 return;
628 chromeos::CellularNetwork* network = GetCellularNetwork(service_path_); 724 chromeos::CellularNetwork* network = GetCellularNetwork(service_path_);
629 if (!network) { 725 if (!network) {
630 // No service, try again since this is probably just transient condition. 726 // No service, try again since this is probably just transient condition.
631 LOG(WARNING) << "Service not present at reconnect attempt."; 727 LOG(WARNING) << "Service not present at reconnect attempt.";
632 } 728 }
633 EvaluateCellularNetwork(network); 729 EvaluateCellularNetwork(network);
634 } 730 }
635 731
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 } 765 }
670 766
671 bool MobileSetupHandler::ConnectToNetwork( 767 bool MobileSetupHandler::ConnectToNetwork(
672 chromeos::CellularNetwork* network, 768 chromeos::CellularNetwork* network,
673 int delay) { 769 int delay) {
674 if (network && network->connecting_or_connected()) 770 if (network && network->connecting_or_connected())
675 return true; 771 return true;
676 // Permit network connection changes only in reconnecting states. 772 // Permit network connection changes only in reconnecting states.
677 if (state_ != PLAN_ACTIVATION_RECONNECTING_OTASP_TRY && 773 if (state_ != PLAN_ACTIVATION_RECONNECTING_OTASP_TRY &&
678 state_ != PLAN_ACTIVATION_RECONNECTING && 774 state_ != PLAN_ACTIVATION_RECONNECTING &&
775 state_ != PLAN_ACTIVATION_RECONNECTING_PAYMENT &&
679 state_ != PLAN_ACTIVATION_RECONNECTING_OTASP) 776 state_ != PLAN_ACTIVATION_RECONNECTING_OTASP)
680 return false; 777 return false;
681 if (network) 778 if (network)
682 LOG(INFO) << "Connecting to: " << network->service_path(); 779 LOG(INFO) << "Connecting to: " << network->service_path();
683 connection_retry_count_++; 780 connection_retry_count_++;
684 connection_start_time_ = base::Time::Now(); 781 connection_start_time_ = base::Time::Now();
685 if (!network) { 782 if (!network) {
686 LOG(WARNING) << "Connect failed." 783 LOG(WARNING) << "Connect failed."
687 << (network ? network->service_path().c_str() : "no service"); 784 << (network ? network->service_path().c_str() : "no service");
688 // If we coudn't connect during reconnection phase, try to reconnect 785 // If we coudn't connect during reconnection phase, try to reconnect
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 void MobileSetupHandler::EvaluateCellularNetwork( 822 void MobileSetupHandler::EvaluateCellularNetwork(
726 chromeos::CellularNetwork* network) { 823 chromeos::CellularNetwork* network) {
727 if (!web_ui_) 824 if (!web_ui_)
728 return; 825 return;
729 826
730 PlanActivationState new_state = state_; 827 PlanActivationState new_state = state_;
731 if (!network) { 828 if (!network) {
732 LOG(WARNING) << "Cellular service lost"; 829 LOG(WARNING) << "Cellular service lost";
733 if (state_ == PLAN_ACTIVATION_RECONNECTING_OTASP_TRY || 830 if (state_ == PLAN_ACTIVATION_RECONNECTING_OTASP_TRY ||
734 state_ == PLAN_ACTIVATION_RECONNECTING || 831 state_ == PLAN_ACTIVATION_RECONNECTING ||
832 state_ == PLAN_ACTIVATION_RECONNECTING_PAYMENT ||
735 state_ == PLAN_ACTIVATION_RECONNECTING_OTASP) { 833 state_ == PLAN_ACTIVATION_RECONNECTING_OTASP) {
736 // This might be the legit case when service is lost after activation. 834 // This might be the legit case when service is lost after activation.
737 // We need to make sure we force reconnection as soon as it shows up. 835 // We need to make sure we force reconnection as soon as it shows up.
738 LOG(INFO) << "Force service reconnection"; 836 LOG(INFO) << "Force service reconnection";
739 connection_start_time_ = base::Time(); 837 connection_start_time_ = base::Time();
740 } 838 }
741 return; 839 return;
742 } 840 }
743 841
744 // Prevent this method from being called if it is already on the stack. 842 // Prevent this method from being called if it is already on the stack.
745 // This might happen on some state transitions (ie. connect, disconnect). 843 // This might happen on some state transitions (ie. connect, disconnect).
746 if (evaluating_) 844 if (evaluating_)
747 return; 845 return;
748 evaluating_ = true; 846 evaluating_ = true;
749 std::string error_description; 847 std::string error_description;
750 848
751 LOG(WARNING) << "Cellular:\n service=" << network->GetStateString().c_str() 849 LOG(WARNING) << "Cellular:\n service=" << network->GetStateString().c_str()
752 << "\n ui=" << GetStateDescription(state_) 850 << "\n ui=" << GetStateDescription(state_)
753 << "\n activation=" << network->GetActivationStateString().c_str() 851 << "\n activation=" << network->GetActivationStateString().c_str()
754 << "\n error=" << network->GetErrorString().c_str() 852 << "\n error=" << network->GetErrorString().c_str()
755 << "\n setvice_path=" << network->service_path().c_str(); 853 << "\n setvice_path=" << network->service_path().c_str();
756 switch (state_) { 854 switch (state_) {
757 case PLAN_ACTIVATION_START: { 855 case PLAN_ACTIVATION_START: {
758 switch (network->activation_state()) { 856 switch (network->activation_state()) {
759 case chromeos::ACTIVATION_STATE_ACTIVATED: { 857 case chromeos::ACTIVATION_STATE_ACTIVATED: {
760 if (network->disconnected()) { 858 if (network->disconnected()) {
761 new_state = PLAN_ACTIVATION_RECONNECTING; 859 new_state = PLAN_ACTIVATION_RECONNECTING;
762 } else if (network->connected()) { 860 } else if (network->connected()) {
763 if (network->restricted_pool()) { 861 if (network->restricted_pool()) {
764 new_state = PLAN_ACTIVATION_SHOWING_PAYMENT; 862 new_state = PLAN_ACTIVATION_PAYMENT_PORTAL_LOADING;
765 } else { 863 } else {
766 new_state = PLAN_ACTIVATION_DONE; 864 new_state = PLAN_ACTIVATION_DONE;
767 } 865 }
768 } 866 }
769 break; 867 break;
770 } 868 }
771 default: { 869 default: {
772 if (network->disconnected() || 870 if (network->disconnected() ||
773 network->state() == chromeos::STATE_ACTIVATION_FAILURE) { 871 network->state() == chromeos::STATE_ACTIVATION_FAILURE) {
774 new_state = (network->activation_state() == 872 new_state = (network->activation_state() ==
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 return; 910 return;
813 case PLAN_ACTIVATION_INITIATING_ACTIVATION: 911 case PLAN_ACTIVATION_INITIATING_ACTIVATION:
814 case PLAN_ACTIVATION_OTASP: 912 case PLAN_ACTIVATION_OTASP:
815 case PLAN_ACTIVATION_TRYING_OTASP: { 913 case PLAN_ACTIVATION_TRYING_OTASP: {
816 switch (network->activation_state()) { 914 switch (network->activation_state()) {
817 case chromeos::ACTIVATION_STATE_ACTIVATED: 915 case chromeos::ACTIVATION_STATE_ACTIVATED:
818 if (network->disconnected()) { 916 if (network->disconnected()) {
819 new_state = GetNextReconnectState(state_); 917 new_state = GetNextReconnectState(state_);
820 } else if (network->connected()) { 918 } else if (network->connected()) {
821 if (network->restricted_pool()) { 919 if (network->restricted_pool()) {
822 new_state = PLAN_ACTIVATION_SHOWING_PAYMENT; 920 new_state = PLAN_ACTIVATION_PAYMENT_PORTAL_LOADING;
823 } else { 921 } else {
824 new_state = PLAN_ACTIVATION_DONE; 922 new_state = PLAN_ACTIVATION_DONE;
825 } 923 }
826 } 924 }
827 break; 925 break;
828 case chromeos::ACTIVATION_STATE_PARTIALLY_ACTIVATED: 926 case chromeos::ACTIVATION_STATE_PARTIALLY_ACTIVATED:
829 if (network->connected()) { 927 if (network->connected()) {
830 if (network->restricted_pool()) 928 if (network->restricted_pool())
831 new_state = PLAN_ACTIVATION_SHOWING_PAYMENT; 929 new_state = PLAN_ACTIVATION_PAYMENT_PORTAL_LOADING;
832 } else { 930 } else {
833 new_state = GetNextReconnectState(state_); 931 new_state = GetNextReconnectState(state_);
834 } 932 }
835 break; 933 break;
836 case chromeos::ACTIVATION_STATE_NOT_ACTIVATED: 934 case chromeos::ACTIVATION_STATE_NOT_ACTIVATED:
837 case chromeos::ACTIVATION_STATE_ACTIVATING: 935 case chromeos::ACTIVATION_STATE_ACTIVATING:
838 // Wait in this state until activation state changes. 936 // Wait in this state until activation state changes.
839 break; 937 break;
840 default: 938 default:
841 break; 939 break;
842 } 940 }
843 break; 941 break;
844 } 942 }
845 case PLAN_ACTIVATION_RECONNECTING_OTASP_TRY: 943 case PLAN_ACTIVATION_RECONNECTING_OTASP_TRY:
944 case PLAN_ACTIVATION_RECONNECTING_PAYMENT:
846 case PLAN_ACTIVATION_RECONNECTING: { 945 case PLAN_ACTIVATION_RECONNECTING: {
847 if (network->connected()) { 946 if (network->connected()) {
848 // Make sure other networks are not interfering with our detection of 947 // Make sure other networks are not interfering with our detection of
849 // restricted pool. 948 // restricted pool.
850 DisableOtherNetworks(); 949 DisableOtherNetworks();
851 // Wait until the service shows up and gets activated. 950 // Wait until the service shows up and gets activated.
852 switch (network->activation_state()) { 951 switch (network->activation_state()) {
853 case chromeos::ACTIVATION_STATE_PARTIALLY_ACTIVATED: 952 case chromeos::ACTIVATION_STATE_PARTIALLY_ACTIVATED:
854 case chromeos::ACTIVATION_STATE_ACTIVATED: 953 case chromeos::ACTIVATION_STATE_ACTIVATED:
855 if (network->restricted_pool()) { 954 if (network->restricted_pool()) {
(...skipping 11 matching lines...) Expand all
867 return; 966 return;
868 } else { 967 } else {
869 new_state = PLAN_ACTIVATION_ERROR; 968 new_state = PLAN_ACTIVATION_ERROR;
870 UMA_HISTOGRAM_COUNTS("Cellular.ActivationRetryFailure", 1); 969 UMA_HISTOGRAM_COUNTS("Cellular.ActivationRetryFailure", 1);
871 error_description = GetErrorMessage(kFailedConnectivity); 970 error_description = GetErrorMessage(kFailedConnectivity);
872 } 971 }
873 } else { 972 } else {
874 // If we have already received payment, don't show the payment 973 // If we have already received payment, don't show the payment
875 // page again. We should try to reconnect after some 974 // page again. We should try to reconnect after some
876 // time instead. 975 // time instead.
877 new_state = PLAN_ACTIVATION_SHOWING_PAYMENT; 976 new_state = PLAN_ACTIVATION_PAYMENT_PORTAL_LOADING;
878 } 977 }
879 } else if (network->activation_state() == 978 } else if (network->activation_state() ==
880 chromeos::ACTIVATION_STATE_ACTIVATED) { 979 chromeos::ACTIVATION_STATE_ACTIVATED) {
881 new_state = PLAN_ACTIVATION_DONE; 980 new_state = PLAN_ACTIVATION_DONE;
882 } 981 }
883 break; 982 break;
884 default: 983 default:
885 break; 984 break;
886 } 985 }
887 } else if (NeedsReconnecting(network, &new_state, &error_description)) { 986 } else if (NeedsReconnecting(network, &new_state, &error_description)) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 } 1024 }
926 } else if (NeedsReconnecting(network, &new_state, &error_description)) { 1025 } else if (NeedsReconnecting(network, &new_state, &error_description)) {
927 evaluating_ = false; 1026 evaluating_ = false;
928 return; 1027 return;
929 } 1028 }
930 break; 1029 break;
931 } 1030 }
932 case PLAN_ACTIVATION_PAGE_LOADING: 1031 case PLAN_ACTIVATION_PAGE_LOADING:
933 break; 1032 break;
934 // Just ignore all signals until the site confirms payment. 1033 // Just ignore all signals until the site confirms payment.
935 case PLAN_ACTIVATION_SHOWING_PAYMENT: 1034 case PLAN_ACTIVATION_PAYMENT_PORTAL_LOADING:
1035 case PLAN_ACTIVATION_SHOWING_PAYMENT: {
1036 if (network->disconnected())
1037 new_state = PLAN_ACTIVATION_RECONNECTING_PAYMENT;
1038 break;
1039 }
936 // Activation completed/failed, ignore network changes. 1040 // Activation completed/failed, ignore network changes.
937 case PLAN_ACTIVATION_DONE: 1041 case PLAN_ACTIVATION_DONE:
938 case PLAN_ACTIVATION_ERROR: 1042 case PLAN_ACTIVATION_ERROR:
939 break; 1043 break;
940 } 1044 }
941 1045
942 if (new_state != PLAN_ACTIVATION_ERROR && 1046 if (new_state != PLAN_ACTIVATION_ERROR &&
943 GotActivationError(network, &error_description)) { 1047 GotActivationError(network, &error_description)) {
944 // Check for this special case when we try to do activate partially 1048 // Check for this special case when we try to do activate partially
945 // activated device. If that attempt failed, try to disconnect to clear the 1049 // activated device. If that attempt failed, try to disconnect to clear the
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 case PLAN_ACTIVATION_START: 1119 case PLAN_ACTIVATION_START:
1016 return "ACTIVATION_START"; 1120 return "ACTIVATION_START";
1017 case PLAN_ACTIVATION_TRYING_OTASP: 1121 case PLAN_ACTIVATION_TRYING_OTASP:
1018 return "TRYING_OTASP"; 1122 return "TRYING_OTASP";
1019 case PLAN_ACTIVATION_RECONNECTING_OTASP_TRY: 1123 case PLAN_ACTIVATION_RECONNECTING_OTASP_TRY:
1020 return "RECONNECTING_OTASP_TRY"; 1124 return "RECONNECTING_OTASP_TRY";
1021 case PLAN_ACTIVATION_INITIATING_ACTIVATION: 1125 case PLAN_ACTIVATION_INITIATING_ACTIVATION:
1022 return "INITIATING_ACTIVATION"; 1126 return "INITIATING_ACTIVATION";
1023 case PLAN_ACTIVATION_RECONNECTING: 1127 case PLAN_ACTIVATION_RECONNECTING:
1024 return "RECONNECTING"; 1128 return "RECONNECTING";
1129 case PLAN_ACTIVATION_PAYMENT_PORTAL_LOADING:
1130 return "PAYMENT_PORTAL_LOADING";
1025 case PLAN_ACTIVATION_SHOWING_PAYMENT: 1131 case PLAN_ACTIVATION_SHOWING_PAYMENT:
1026 return "SHOWING_PAYMENT"; 1132 return "SHOWING_PAYMENT";
1133 case PLAN_ACTIVATION_RECONNECTING_PAYMENT:
1134 return "RECONNECTING_PAYMENT";
1027 case PLAN_ACTIVATION_START_OTASP: 1135 case PLAN_ACTIVATION_START_OTASP:
1028 return "START_OTASP"; 1136 return "START_OTASP";
1029 case PLAN_ACTIVATION_DELAY_OTASP: 1137 case PLAN_ACTIVATION_DELAY_OTASP:
1030 return "DELAY_OTASP"; 1138 return "DELAY_OTASP";
1031 case PLAN_ACTIVATION_OTASP: 1139 case PLAN_ACTIVATION_OTASP:
1032 return "OTASP"; 1140 return "OTASP";
1033 case PLAN_ACTIVATION_RECONNECTING_OTASP: 1141 case PLAN_ACTIVATION_RECONNECTING_OTASP:
1034 return "RECONNECTING_OTASP"; 1142 return "RECONNECTING_OTASP";
1035 case PLAN_ACTIVATION_DONE: 1143 case PLAN_ACTIVATION_DONE:
1036 return "DONE"; 1144 return "DONE";
(...skipping 24 matching lines...) Expand all
1061 void MobileSetupHandler::UpdatePage( 1169 void MobileSetupHandler::UpdatePage(
1062 chromeos::CellularNetwork* network, 1170 chromeos::CellularNetwork* network,
1063 const std::string& error_description) { 1171 const std::string& error_description) {
1064 DictionaryValue device_dict; 1172 DictionaryValue device_dict;
1065 if (network) 1173 if (network)
1066 GetDeviceInfo(network, &device_dict); 1174 GetDeviceInfo(network, &device_dict);
1067 device_dict.SetInteger("state", state_); 1175 device_dict.SetInteger("state", state_);
1068 if (error_description.length()) 1176 if (error_description.length())
1069 device_dict.SetString("error", error_description); 1177 device_dict.SetString("error", error_description);
1070 web_ui_->CallJavascriptFunction( 1178 web_ui_->CallJavascriptFunction(
1071 kJsDeviceStatusChangedHandler, device_dict); 1179 kJsDeviceStatusChangedCallback, device_dict);
1072 } 1180 }
1073 1181
1074 1182
1075 void MobileSetupHandler::ChangeState(chromeos::CellularNetwork* network, 1183 void MobileSetupHandler::ChangeState(chromeos::CellularNetwork* network,
1076 PlanActivationState new_state, 1184 PlanActivationState new_state,
1077 const std::string& error_description) { 1185 const std::string& error_description) {
1078 static bool first_time = true; 1186 static bool first_time = true;
1079 if (state_ == new_state && !first_time) 1187 if (state_ == new_state && !first_time)
1080 return; 1188 return;
1081 LOG(WARNING) << "Activation state flip old = " 1189 LOG(WARNING) << "Activation state flip old = "
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 if (new_state == PLAN_ACTIVATION_OTASP) { 1230 if (new_state == PLAN_ACTIVATION_OTASP) {
1123 ChangeState(network, PLAN_ACTIVATION_DELAY_OTASP, std::string()); 1231 ChangeState(network, PLAN_ACTIVATION_DELAY_OTASP, std::string());
1124 } else { 1232 } else {
1125 ChangeState(network, PLAN_ACTIVATION_ERROR, 1233 ChangeState(network, PLAN_ACTIVATION_ERROR,
1126 GetErrorMessage(kFailedConnectivity)); 1234 GetErrorMessage(kFailedConnectivity));
1127 } 1235 }
1128 } 1236 }
1129 break; 1237 break;
1130 case PLAN_ACTIVATION_RECONNECTING_OTASP_TRY: 1238 case PLAN_ACTIVATION_RECONNECTING_OTASP_TRY:
1131 case PLAN_ACTIVATION_RECONNECTING: 1239 case PLAN_ACTIVATION_RECONNECTING:
1240 case PLAN_ACTIVATION_RECONNECTING_PAYMENT:
1132 case PLAN_ACTIVATION_RECONNECTING_OTASP: { 1241 case PLAN_ACTIVATION_RECONNECTING_OTASP: {
1133 // Start reconnect timer. This will ensure that we are not left in 1242 // Start reconnect timer. This will ensure that we are not left in
1134 // limbo by the network library. 1243 // limbo by the network library.
1135 if (!reconnect_timer_.IsRunning()) { 1244 if (!reconnect_timer_.IsRunning()) {
1136 reconnect_timer_.Start( 1245 reconnect_timer_.Start(
1137 FROM_HERE, 1246 FROM_HERE,
1138 base::TimeDelta::FromMilliseconds(kReconnectTimerDelayMS), 1247 base::TimeDelta::FromMilliseconds(kReconnectTimerDelayMS),
1139 this, &MobileSetupHandler::ReconnectTimerFired); 1248 this, &MobileSetupHandler::ReconnectTimerFired);
1140 } 1249 }
1141 // Reset connection metrics and try to connect. 1250 // Reset connection metrics and try to connect.
1142 reconnect_wait_count_ = 0; 1251 reconnect_wait_count_ = 0;
1143 connection_retry_count_ = 0; 1252 connection_retry_count_ = 0;
1144 connection_start_time_ = base::Time::Now(); 1253 connection_start_time_ = base::Time::Now();
1145 ConnectToNetwork(network, kReconnectDelayMS); 1254 ConnectToNetwork(network, kReconnectDelayMS);
1146 break; 1255 break;
1147 } 1256 }
1148 case PLAN_ACTIVATION_PAGE_LOADING: 1257 case PLAN_ACTIVATION_PAGE_LOADING:
1149 return; 1258 return;
1259 case PLAN_ACTIVATION_PAYMENT_PORTAL_LOADING:
1150 case PLAN_ACTIVATION_SHOWING_PAYMENT: 1260 case PLAN_ACTIVATION_SHOWING_PAYMENT:
1151 // Fix for fix SSL for the walled gardens where cert chain verification 1261 // Fix for fix SSL for the walled gardens where cert chain verification
1152 // might not work. 1262 // might not work.
1153 break; 1263 break;
1154 case PLAN_ACTIVATION_DONE: 1264 case PLAN_ACTIVATION_DONE:
1155 DCHECK(network); 1265 DCHECK(network);
1156 CompleteActivation(network); 1266 CompleteActivation(network);
1157 UMA_HISTOGRAM_COUNTS("Cellular.MobileSetupSucceeded", 1); 1267 UMA_HISTOGRAM_COUNTS("Cellular.MobileSetupSucceeded", 1);
1158 break; 1268 break;
1159 case PLAN_ACTIVATION_ERROR: 1269 case PLAN_ACTIVATION_ERROR:
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 MobileSetupHandler* handler = new MobileSetupHandler(service_path); 1446 MobileSetupHandler* handler = new MobileSetupHandler(service_path);
1337 AddMessageHandler((handler)->Attach(this)); 1447 AddMessageHandler((handler)->Attach(this));
1338 handler->Init(contents); 1448 handler->Init(contents);
1339 MobileSetupUIHTMLSource* html_source = 1449 MobileSetupUIHTMLSource* html_source =
1340 new MobileSetupUIHTMLSource(service_path); 1450 new MobileSetupUIHTMLSource(service_path);
1341 1451
1342 // Set up the chrome://mobilesetup/ source. 1452 // Set up the chrome://mobilesetup/ source.
1343 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); 1453 Profile* profile = Profile::FromBrowserContext(contents->browser_context());
1344 profile->GetChromeURLDataManager()->AddDataSource(html_source); 1454 profile->GetChromeURLDataManager()->AddDataSource(html_source);
1345 } 1455 }
1456
1457 void MobileSetupUI::RenderViewCreated(RenderViewHost* host) {
1458 ChromeWebUI::RenderViewCreated(host);
1459 // Destroyed by the corresponding RenderViewHost.
1460 new PortalFrameLoadObserver(host, tab_contents()->web_ui());
1461 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698