| 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 #include "chrome/browser/chromeos/mobile/mobile_activator.h" | 5 #include "chrome/browser/chromeos/mobile/mobile_activator.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 } | 453 } |
| 454 | 454 |
| 455 bool MobileActivator::ConnectToNetwork(CellularNetwork* network, int delay) { | 455 bool MobileActivator::ConnectToNetwork(CellularNetwork* network, int delay) { |
| 456 if (network && network->connecting_or_connected()) | 456 if (network && network->connecting_or_connected()) |
| 457 return true; | 457 return true; |
| 458 // Permit network connection changes only in reconnecting states. | 458 // Permit network connection changes only in reconnecting states. |
| 459 if (state_ != PLAN_ACTIVATION_RECONNECTING_OTASP_TRY && | 459 if (state_ != PLAN_ACTIVATION_RECONNECTING_OTASP_TRY && |
| 460 state_ != PLAN_ACTIVATION_RECONNECTING && | 460 state_ != PLAN_ACTIVATION_RECONNECTING && |
| 461 state_ != PLAN_ACTIVATION_RECONNECTING_PAYMENT && | 461 state_ != PLAN_ACTIVATION_RECONNECTING_PAYMENT && |
| 462 state_ != PLAN_ACTIVATION_RECONNECTING_OTASP) return false; | 462 state_ != PLAN_ACTIVATION_RECONNECTING_OTASP) return false; |
| 463 if (network) | |
| 464 LOG(INFO) << "Connecting to: " << network->service_path(); | |
| 465 connection_retry_count_++; | 463 connection_retry_count_++; |
| 466 connection_start_time_ = base::Time::Now(); | 464 connection_start_time_ = base::Time::Now(); |
| 467 if (!network || state_ == PLAN_ACTIVATION_RECONNECTING_OTASP) { | 465 if (!network) { |
| 468 LOG(WARNING) << "Delaying reconnect to " | 466 LOG(WARNING) << "Connect failed, will try again in a little bit."; |
| 469 << (network ? network->service_path().c_str() : "no service"); | |
| 470 // If we coudn't connect during reconnection phase, try to reconnect | 467 // If we coudn't connect during reconnection phase, try to reconnect |
| 471 // with a delay (and try to reconnect if needed). | 468 // with a delay (and try to reconnect if needed). |
| 472 BrowserThread::PostDelayedTask(BrowserThread::UI, FROM_HERE, | 469 BrowserThread::PostDelayedTask(BrowserThread::UI, FROM_HERE, |
| 473 base::Bind(&MobileActivator::ContinueConnecting, AsWeakPtr(), delay), | 470 base::Bind(&MobileActivator::ContinueConnecting, AsWeakPtr(), delay), |
| 474 base::TimeDelta::FromMilliseconds(delay)); | 471 base::TimeDelta::FromMilliseconds(delay)); |
| 475 return false; | 472 return false; |
| 476 } | 473 } |
| 474 LOG(INFO) << "Connecting to: " << network->service_path(); |
| 477 CrosLibrary::Get()->GetNetworkLibrary()-> | 475 CrosLibrary::Get()->GetNetworkLibrary()-> |
| 478 ConnectToCellularNetwork(network); | 476 ConnectToCellularNetwork(network); |
| 479 return true; | 477 return true; |
| 480 } | 478 } |
| 481 | 479 |
| 482 void MobileActivator::ForceReconnect(CellularNetwork* network, int delay) { | 480 void MobileActivator::ForceReconnect(CellularNetwork* network, int delay) { |
| 483 DCHECK(network); | 481 DCHECK(network); |
| 484 UMA_HISTOGRAM_COUNTS("Cellular.ActivationRetry", 1); | 482 UMA_HISTOGRAM_COUNTS("Cellular.ActivationRetry", 1); |
| 485 // Reset reconnect metrics. | 483 // Reset reconnect metrics. |
| 486 connection_retry_count_ = 0; | 484 connection_retry_count_ = 0; |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 value->SetString("IMEI", device->imei()); | 1050 value->SetString("IMEI", device->imei()); |
| 1053 value->SetString("MDN", device->mdn()); | 1051 value->SetString("MDN", device->mdn()); |
| 1054 } | 1052 } |
| 1055 } | 1053 } |
| 1056 | 1054 |
| 1057 std::string MobileActivator::GetErrorMessage(const std::string& code) { | 1055 std::string MobileActivator::GetErrorMessage(const std::string& code) { |
| 1058 return cellular_config_->GetErrorMessage(code); | 1056 return cellular_config_->GetErrorMessage(code); |
| 1059 } | 1057 } |
| 1060 | 1058 |
| 1061 } // namespace chromeos | 1059 } // namespace chromeos |
| OLD | NEW |