| 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/power/session_length_limiter.h" | 5 #include "chrome/browser/chromeos/power/session_length_limiter.h" |
| 6 | 6 |
| 7 #include <deque> | 7 #include <deque> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 now_ += kSessionLengthLimitTimerInterval; | 169 now_ += kSessionLengthLimitTimerInterval; |
| 170 *remaining_ -= kSessionLengthLimitTimerInterval; | 170 *remaining_ -= kSessionLengthLimitTimerInterval; |
| 171 if (*remaining_ < kZeroTimeDelta) | 171 if (*remaining_ < kZeroTimeDelta) |
| 172 remaining_.reset(new base::TimeDelta(kZeroTimeDelta)); | 172 remaining_.reset(new base::TimeDelta(kZeroTimeDelta)); |
| 173 } | 173 } |
| 174 | 174 |
| 175 base::Time GetCurrentTime() const { | 175 base::Time GetCurrentTime() const { |
| 176 return now_; | 176 return now_; |
| 177 } | 177 } |
| 178 | 178 |
| 179 TestingPrefService local_state_; | 179 TestingPrefServiceSimple local_state_; |
| 180 MockSessionLengthLimiterDelegate* delegate_; // Owned by | 180 MockSessionLengthLimiterDelegate* delegate_; // Owned by |
| 181 // session_length_limiter_. | 181 // session_length_limiter_. |
| 182 scoped_refptr<ImmediateSingleThreadTaskRunner> runner_; | 182 scoped_refptr<ImmediateSingleThreadTaskRunner> runner_; |
| 183 | 183 |
| 184 base::Time session_start_time_; | 184 base::Time session_start_time_; |
| 185 base::Time now_; | 185 base::Time now_; |
| 186 scoped_ptr<base::TimeDelta> remaining_; | 186 scoped_ptr<base::TimeDelta> remaining_; |
| 187 | 187 |
| 188 scoped_ptr<SessionLengthLimiter> session_length_limiter_; | 188 scoped_ptr<SessionLengthLimiter> session_length_limiter_; |
| 189 }; | 189 }; |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 remaining_.reset(new base::TimeDelta(kZeroTimeDelta)); | 375 remaining_.reset(new base::TimeDelta(kZeroTimeDelta)); |
| 376 } | 376 } |
| 377 | 377 |
| 378 // Check that the next timer tick does not lead to the session being | 378 // Check that the next timer tick does not lead to the session being |
| 379 // terminated. | 379 // terminated. |
| 380 now_ += kSessionLengthLimitTimerInterval; | 380 now_ += kSessionLengthLimitTimerInterval; |
| 381 runner_->RunTasks(); | 381 runner_->RunTasks(); |
| 382 } | 382 } |
| 383 | 383 |
| 384 } // namespace chromeos | 384 } // namespace chromeos |
| OLD | NEW |