| 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 17 matching lines...) Expand all Loading... |
| 28 #include "chrome/browser/browser_process.h" | 28 #include "chrome/browser/browser_process.h" |
| 29 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
| 30 #include "chromeos/network/device_state.h" | 30 #include "chromeos/network/device_state.h" |
| 31 #include "chromeos/network/network_activation_handler.h" | 31 #include "chromeos/network/network_activation_handler.h" |
| 32 #include "chromeos/network/network_configuration_handler.h" | 32 #include "chromeos/network/network_configuration_handler.h" |
| 33 #include "chromeos/network/network_connection_handler.h" | 33 #include "chromeos/network/network_connection_handler.h" |
| 34 #include "chromeos/network/network_event_log.h" | 34 #include "chromeos/network/network_event_log.h" |
| 35 #include "chromeos/network/network_handler_callbacks.h" | 35 #include "chromeos/network/network_handler_callbacks.h" |
| 36 #include "chromeos/network/network_state.h" | 36 #include "chromeos/network/network_state.h" |
| 37 #include "chromeos/network/network_state_handler.h" | 37 #include "chromeos/network/network_state_handler.h" |
| 38 #include "chromeos/network/shill_property_util.h" |
| 38 #include "content/public/browser/browser_thread.h" | 39 #include "content/public/browser/browser_thread.h" |
| 39 #include "third_party/cros_system_api/dbus/service_constants.h" | 40 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 40 | 41 |
| 41 using content::BrowserThread; | 42 using content::BrowserThread; |
| 42 | 43 |
| 43 namespace { | 44 namespace { |
| 44 | 45 |
| 45 // Cellular configuration file path. | 46 // Cellular configuration file path. |
| 46 const char kCellularConfigPath[] = | 47 const char kCellularConfigPath[] = |
| 47 "/usr/share/chromeos-assets/mobile/mobile_config.json"; | 48 "/usr/share/chromeos-assets/mobile/mobile_config.json"; |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 this, &MobileActivator::HandleOTASPTimeout); | 398 this, &MobileActivator::HandleOTASPTimeout); |
| 398 } | 399 } |
| 399 | 400 |
| 400 void MobileActivator::StartActivation() { | 401 void MobileActivator::StartActivation() { |
| 401 UMA_HISTOGRAM_COUNTS("Cellular.MobileSetupStart", 1); | 402 UMA_HISTOGRAM_COUNTS("Cellular.MobileSetupStart", 1); |
| 402 const NetworkState* network = GetNetworkState(service_path_); | 403 const NetworkState* network = GetNetworkState(service_path_); |
| 403 // Check if we can start activation process. | 404 // Check if we can start activation process. |
| 404 if (!network) { | 405 if (!network) { |
| 405 NetworkStateHandler::TechnologyState technology_state = | 406 NetworkStateHandler::TechnologyState technology_state = |
| 406 NetworkHandler::Get()->network_state_handler()->GetTechnologyState( | 407 NetworkHandler::Get()->network_state_handler()->GetTechnologyState( |
| 407 flimflam::kTypeCellular); | 408 NetworkTypePattern::Cellular()); |
| 408 std::string error; | 409 std::string error; |
| 409 if (technology_state == NetworkStateHandler::TECHNOLOGY_UNAVAILABLE) { | 410 if (technology_state == NetworkStateHandler::TECHNOLOGY_UNAVAILABLE) { |
| 410 error = kErrorNoDevice; | 411 error = kErrorNoDevice; |
| 411 } else if (technology_state != NetworkStateHandler::TECHNOLOGY_ENABLED) { | 412 } else if (technology_state != NetworkStateHandler::TECHNOLOGY_ENABLED) { |
| 412 error = kErrorDisabled; | 413 error = kErrorDisabled; |
| 413 } else { | 414 } else { |
| 414 error = kErrorNoService; | 415 error = kErrorNoService; |
| 415 } | 416 } |
| 416 ChangeState(NULL, PLAN_ACTIVATION_ERROR, GetErrorMessage(error)); | 417 ChangeState(NULL, PLAN_ACTIVATION_ERROR, GetErrorMessage(error)); |
| 417 return; | 418 return; |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 cellular_plan_payment_time_ = base::Time::Now(); | 1054 cellular_plan_payment_time_ = base::Time::Now(); |
| 1054 } | 1055 } |
| 1055 | 1056 |
| 1056 bool MobileActivator::HasRecentCellularPlanPayment() const { | 1057 bool MobileActivator::HasRecentCellularPlanPayment() const { |
| 1057 const int kRecentPlanPaymentHours = 6; | 1058 const int kRecentPlanPaymentHours = 6; |
| 1058 return (base::Time::Now() - | 1059 return (base::Time::Now() - |
| 1059 cellular_plan_payment_time_).InHours() < kRecentPlanPaymentHours; | 1060 cellular_plan_payment_time_).InHours() < kRecentPlanPaymentHours; |
| 1060 } | 1061 } |
| 1061 | 1062 |
| 1062 } // namespace chromeos | 1063 } // namespace chromeos |
| OLD | NEW |