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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 } | 232 } |
233 | 233 |
234 // A modem reset leads to a new service path. Since we have verified that we | 234 // A modem reset leads to a new service path. Since we have verified that we |
235 // are a cellular service on a still valid stored device path, update it. | 235 // are a cellular service on a still valid stored device path, update it. |
236 service_path_ = network->path(); | 236 service_path_ = network->path(); |
237 | 237 |
238 EvaluateCellularNetwork(network); | 238 EvaluateCellularNetwork(network); |
239 } | 239 } |
240 | 240 |
241 void MobileActivator::AddObserver(MobileActivator::Observer* observer) { | 241 void MobileActivator::AddObserver(MobileActivator::Observer* observer) { |
242 DCHECK(content::BrowserThread::CurrentlyOn(BrowserThread::UI)); | 242 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
243 observers_.AddObserver(observer); | 243 observers_.AddObserver(observer); |
244 } | 244 } |
245 | 245 |
246 void MobileActivator::RemoveObserver(MobileActivator::Observer* observer) { | 246 void MobileActivator::RemoveObserver(MobileActivator::Observer* observer) { |
247 DCHECK(content::BrowserThread::CurrentlyOn(BrowserThread::UI)); | 247 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
248 observers_.RemoveObserver(observer); | 248 observers_.RemoveObserver(observer); |
249 } | 249 } |
250 | 250 |
251 void MobileActivator::InitiateActivation(const std::string& service_path) { | 251 void MobileActivator::InitiateActivation(const std::string& service_path) { |
252 DCHECK(content::BrowserThread::CurrentlyOn(BrowserThread::UI)); | 252 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
253 const NetworkState* network = GetNetworkState(service_path); | 253 const NetworkState* network = GetNetworkState(service_path); |
254 if (!network) { | 254 if (!network) { |
255 LOG(WARNING) << "Cellular service can't be found: " << service_path; | 255 LOG(WARNING) << "Cellular service can't be found: " << service_path; |
256 return; | 256 return; |
257 } | 257 } |
258 const DeviceState* device = NetworkHandler::Get()->network_state_handler()-> | 258 const DeviceState* device = NetworkHandler::Get()->network_state_handler()-> |
259 GetDeviceState(network->device_path()); | 259 GetDeviceState(network->device_path()); |
260 if (!device) { | 260 if (!device) { |
261 LOG(ERROR) << "Cellular device can't be found: " << network->device_path(); | 261 LOG(ERROR) << "Cellular device can't be found: " << network->device_path(); |
262 return; | 262 return; |
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 cellular_plan_payment_time_ = base::Time::Now(); | 1163 cellular_plan_payment_time_ = base::Time::Now(); |
1164 } | 1164 } |
1165 | 1165 |
1166 bool MobileActivator::HasRecentCellularPlanPayment() const { | 1166 bool MobileActivator::HasRecentCellularPlanPayment() const { |
1167 const int kRecentPlanPaymentHours = 6; | 1167 const int kRecentPlanPaymentHours = 6; |
1168 return (base::Time::Now() - | 1168 return (base::Time::Now() - |
1169 cellular_plan_payment_time_).InHours() < kRecentPlanPaymentHours; | 1169 cellular_plan_payment_time_).InHours() < kRecentPlanPaymentHours; |
1170 } | 1170 } |
1171 | 1171 |
1172 } // namespace chromeos | 1172 } // namespace chromeos |
OLD | NEW |