| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/webui/chromeos/login/demo_mode_detector.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/demo_mode_detector.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/prefs/pref_registry_simple.h" | 8 #include "base/prefs/pref_registry_simple.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 return; | 47 return; |
| 48 } | 48 } |
| 49 | 49 |
| 50 if (IsDerelict()) | 50 if (IsDerelict()) |
| 51 StartIdleDetection(); | 51 StartIdleDetection(); |
| 52 else | 52 else |
| 53 StartOobeTimer(); | 53 StartOobeTimer(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void DemoModeDetector::StopDetection() { | 56 void DemoModeDetector::StopDetection() { |
| 57 oobe_timer_.Stop(); |
| 57 idle_detector_.reset(); | 58 idle_detector_.reset(); |
| 58 } | 59 } |
| 59 | 60 |
| 60 // static | 61 // static |
| 61 void DemoModeDetector::RegisterPrefs(PrefRegistrySimple* registry) { | 62 void DemoModeDetector::RegisterPrefs(PrefRegistrySimple* registry) { |
| 62 registry->RegisterInt64Pref(prefs::kTimeOnOobe, 0); | 63 registry->RegisterInt64Pref(prefs::kTimeOnOobe, 0); |
| 63 } | 64 } |
| 64 | 65 |
| 65 // Private methods. | 66 // Private methods. |
| 66 | 67 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 std::max(std::min(oobe_timer_update_interval_, | 147 std::max(std::min(oobe_timer_update_interval_, |
| 147 derelict_detection_timeout_ - time_on_oobe_), | 148 derelict_detection_timeout_ - time_on_oobe_), |
| 148 base::TimeDelta::FromSeconds(0)); | 149 base::TimeDelta::FromSeconds(0)); |
| 149 } | 150 } |
| 150 | 151 |
| 151 bool DemoModeDetector::IsDerelict() { | 152 bool DemoModeDetector::IsDerelict() { |
| 152 return time_on_oobe_ >= derelict_detection_timeout_; | 153 return time_on_oobe_ >= derelict_detection_timeout_; |
| 153 } | 154 } |
| 154 | 155 |
| 155 } // namespace chromeos | 156 } // namespace chromeos |
| OLD | NEW |