| 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 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 VLOG(1) << "Transitioning..."; | 991 VLOG(1) << "Transitioning..."; |
| 992 | 992 |
| 993 // Kill all the possible timers and callbacks we might have outstanding. | 993 // Kill all the possible timers and callbacks we might have outstanding. |
| 994 state_duration_timer_.Stop(); | 994 state_duration_timer_.Stop(); |
| 995 continue_reconnect_timer_.Stop(); | 995 continue_reconnect_timer_.Stop(); |
| 996 reconnect_timeout_timer_.Stop(); | 996 reconnect_timeout_timer_.Stop(); |
| 997 const PlanActivationState old_state = state_; | 997 const PlanActivationState old_state = state_; |
| 998 state_ = new_state; | 998 state_ = new_state; |
| 999 | 999 |
| 1000 // Signal to observers layer that the state is changing. | 1000 // Signal to observers layer that the state is changing. |
| 1001 FOR_EACH_OBSERVER(Observer, observers_, | 1001 for (auto& observer : observers_) |
| 1002 OnActivationStateChanged(network, state_, error_description)); | 1002 observer.OnActivationStateChanged(network, state_, error_description); |
| 1003 | 1003 |
| 1004 // Pick action that should happen on entering the new state. | 1004 // Pick action that should happen on entering the new state. |
| 1005 switch (new_state) { | 1005 switch (new_state) { |
| 1006 case PLAN_ACTIVATION_START: | 1006 case PLAN_ACTIVATION_START: |
| 1007 break; | 1007 break; |
| 1008 case PLAN_ACTIVATION_DELAY_OTASP: { | 1008 case PLAN_ACTIVATION_DELAY_OTASP: { |
| 1009 UMA_HISTOGRAM_COUNTS("Cellular.RetryOTASP", 1); | 1009 UMA_HISTOGRAM_COUNTS("Cellular.RetryOTASP", 1); |
| 1010 BrowserThread::PostDelayedTask(BrowserThread::UI, FROM_HERE, | 1010 BrowserThread::PostDelayedTask(BrowserThread::UI, FROM_HERE, |
| 1011 base::Bind(&MobileActivator::RetryOTASP, AsWeakPtr()), | 1011 base::Bind(&MobileActivator::RetryOTASP, AsWeakPtr()), |
| 1012 base::TimeDelta::FromMilliseconds(kOTASPRetryDelay)); | 1012 base::TimeDelta::FromMilliseconds(kOTASPRetryDelay)); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 cellular_plan_payment_time_ = base::Time::Now(); | 1162 cellular_plan_payment_time_ = base::Time::Now(); |
| 1163 } | 1163 } |
| 1164 | 1164 |
| 1165 bool MobileActivator::HasRecentCellularPlanPayment() const { | 1165 bool MobileActivator::HasRecentCellularPlanPayment() const { |
| 1166 const int kRecentPlanPaymentHours = 6; | 1166 const int kRecentPlanPaymentHours = 6; |
| 1167 return (base::Time::Now() - | 1167 return (base::Time::Now() - |
| 1168 cellular_plan_payment_time_).InHours() < kRecentPlanPaymentHours; | 1168 cellular_plan_payment_time_).InHours() < kRecentPlanPaymentHours; |
| 1169 } | 1169 } |
| 1170 | 1170 |
| 1171 } // namespace chromeos | 1171 } // namespace chromeos |
| OLD | NEW |