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 21 matching lines...) Expand all Loading... |
32 DemoModeDetector::~DemoModeDetector() { | 32 DemoModeDetector::~DemoModeDetector() { |
33 } | 33 } |
34 | 34 |
35 // Public methods. | 35 // Public methods. |
36 | 36 |
37 void DemoModeDetector::InitDetection() { | 37 void DemoModeDetector::InitDetection() { |
38 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 38 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
39 switches::kDisableDemoMode)) | 39 switches::kDisableDemoMode)) |
40 return; | 40 return; |
41 | 41 |
42 if (base::SysInfo::IsRunningOnChromeOS()) { | 42 const bool has_derelict_switch = |
| 43 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 44 switches::kDerelictDetectionTimeout) || |
| 45 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 46 switches::kDerelictIdleTimeout); |
| 47 |
| 48 if (base::SysInfo::IsRunningOnChromeOS() && !has_derelict_switch) { |
43 std::string track; | 49 std::string track; |
44 // We're running on an actual device; if we cannot find our release track | 50 // We're running on an actual device; if we cannot find our release track |
45 // value or if the track contains "testimage", don't start demo mode. | 51 // value or if the track contains "testimage", don't start demo mode. |
46 if (!base::SysInfo::GetLsbReleaseValue("CHROMEOS_RELEASE_TRACK", &track) || | 52 if (!base::SysInfo::GetLsbReleaseValue("CHROMEOS_RELEASE_TRACK", &track) || |
47 track.find("testimage") != std::string::npos) | 53 track.find("testimage") != std::string::npos) |
48 return; | 54 return; |
49 } | 55 } |
50 | 56 |
51 if (IsDerelict()) | 57 if (IsDerelict()) |
52 StartIdleDetection(); | 58 StartIdleDetection(); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 std::max(std::min(oobe_timer_update_interval_, | 154 std::max(std::min(oobe_timer_update_interval_, |
149 derelict_detection_timeout_ - time_on_oobe_), | 155 derelict_detection_timeout_ - time_on_oobe_), |
150 base::TimeDelta::FromSeconds(0)); | 156 base::TimeDelta::FromSeconds(0)); |
151 } | 157 } |
152 | 158 |
153 bool DemoModeDetector::IsDerelict() { | 159 bool DemoModeDetector::IsDerelict() { |
154 return time_on_oobe_ >= derelict_detection_timeout_; | 160 return time_on_oobe_ >= derelict_detection_timeout_; |
155 } | 161 } |
156 | 162 |
157 } // namespace chromeos | 163 } // namespace chromeos |
OLD | NEW |