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/session_length_limiter.h" | 5 #include "chrome/browser/chromeos/session_length_limiter.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 (delegate_->GetCurrentTime() - session_start_time_); | 197 (delegate_->GetCurrentTime() - session_start_time_); |
198 | 198 |
199 // Log out the user immediately if the session length limit has been reached | 199 // Log out the user immediately if the session length limit has been reached |
200 // or exceeded. | 200 // or exceeded. |
201 if (remaining <= base::TimeDelta()) { | 201 if (remaining <= base::TimeDelta()) { |
202 delegate_->StopSession(); | 202 delegate_->StopSession(); |
203 return; | 203 return; |
204 } | 204 } |
205 | 205 |
206 // Set a timer to log out the user when the session length limit is reached. | 206 // Set a timer to log out the user when the session length limit is reached. |
207 timer_.reset(new base::OneShotTimer<SessionLengthLimiter::Delegate>); | 207 timer_.reset(new base::OneShotTimer); |
208 timer_->Start(FROM_HERE, remaining, delegate_.get(), | 208 timer_->Start(FROM_HERE, remaining, delegate_.get(), |
209 &SessionLengthLimiter::Delegate::StopSession); | 209 &SessionLengthLimiter::Delegate::StopSession); |
210 } | 210 } |
211 | 211 |
212 } // namespace chromeos | 212 } // namespace chromeos |
OLD | NEW |