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 <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" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/prefs/pref_registry_simple.h" |
| 14 #include "base/prefs/pref_service.h" |
13 #include "base/prefs/public/pref_service_base.h" | 15 #include "base/prefs/public/pref_service_base.h" |
14 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/lifetime/application_lifetime.h" | 17 #include "chrome/browser/lifetime/application_lifetime.h" |
16 #include "chrome/browser/prefs/pref_registry_simple.h" | |
17 #include "chrome/browser/prefs/pref_service.h" | |
18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
19 | 19 |
20 namespace chromeos { | 20 namespace chromeos { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 // The minimum session time limit that can be set. | 24 // The minimum session time limit that can be set. |
25 const int kSessionLengthLimitMinMs = 30 * 1000; // 30 seconds. | 25 const int kSessionLengthLimitMinMs = 30 * 1000; // 30 seconds. |
26 | 26 |
27 // The maximum session time limit that can be set. | 27 // The maximum session time limit that can be set. |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 (delegate_->GetCurrentTime() - session_start_time_); | 157 (delegate_->GetCurrentTime() - session_start_time_); |
158 if (remaining < kZeroTimeDelta) | 158 if (remaining < kZeroTimeDelta) |
159 remaining = kZeroTimeDelta; | 159 remaining = kZeroTimeDelta; |
160 | 160 |
161 // End the session if the remaining time reaches zero. | 161 // End the session if the remaining time reaches zero. |
162 if (remaining == base::TimeDelta()) | 162 if (remaining == base::TimeDelta()) |
163 delegate_->StopSession(); | 163 delegate_->StopSession(); |
164 } | 164 } |
165 | 165 |
166 } // namespace chromeos | 166 } // namespace chromeos |
OLD | NEW |