| 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 "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 const int kSessionLengthLimitMaxMs = 24 * 60 * 60 * 1000; // 24 hours. | 30 const int kSessionLengthLimitMaxMs = 24 * 60 * 60 * 1000; // 24 hours. |
| 31 | 31 |
| 32 // A default delegate implementation that returns the current time and does end | 32 // A default delegate implementation that returns the current time and does end |
| 33 // the current user's session when requested. This can be replaced with a mock | 33 // the current user's session when requested. This can be replaced with a mock |
| 34 // in tests. | 34 // in tests. |
| 35 class SessionLengthLimiterDelegateImpl : public SessionLengthLimiter::Delegate { | 35 class SessionLengthLimiterDelegateImpl : public SessionLengthLimiter::Delegate { |
| 36 public: | 36 public: |
| 37 SessionLengthLimiterDelegateImpl(); | 37 SessionLengthLimiterDelegateImpl(); |
| 38 virtual ~SessionLengthLimiterDelegateImpl(); | 38 virtual ~SessionLengthLimiterDelegateImpl(); |
| 39 | 39 |
| 40 virtual const base::TimeTicks GetCurrentTime() const OVERRIDE; | 40 virtual const base::TimeTicks GetCurrentTime() const override; |
| 41 virtual void StopSession() OVERRIDE; | 41 virtual void StopSession() override; |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 DISALLOW_COPY_AND_ASSIGN(SessionLengthLimiterDelegateImpl); | 44 DISALLOW_COPY_AND_ASSIGN(SessionLengthLimiterDelegateImpl); |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 SessionLengthLimiterDelegateImpl::SessionLengthLimiterDelegateImpl() { | 47 SessionLengthLimiterDelegateImpl::SessionLengthLimiterDelegateImpl() { |
| 48 } | 48 } |
| 49 | 49 |
| 50 SessionLengthLimiterDelegateImpl::~SessionLengthLimiterDelegateImpl() { | 50 SessionLengthLimiterDelegateImpl::~SessionLengthLimiterDelegateImpl() { |
| 51 } | 51 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 return; | 204 return; |
| 205 } | 205 } |
| 206 | 206 |
| 207 // Set a timer to log out the user when the session length limit is reached. | 207 // Set a timer to log out the user when the session length limit is reached. |
| 208 timer_.reset(new base::OneShotTimer<SessionLengthLimiter::Delegate>); | 208 timer_.reset(new base::OneShotTimer<SessionLengthLimiter::Delegate>); |
| 209 timer_->Start(FROM_HERE, remaining, delegate_.get(), | 209 timer_->Start(FROM_HERE, remaining, delegate_.get(), |
| 210 &SessionLengthLimiter::Delegate::StopSession); | 210 &SessionLengthLimiter::Delegate::StopSession); |
| 211 } | 211 } |
| 212 | 212 |
| 213 } // namespace chromeos | 213 } // namespace chromeos |
| OLD | NEW |