Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Unified Diff: chrome/browser/ui/webui/chromeos/login/demo_mode_detector.h

Issue 273533004: Flag covering HID-detection OOBE screen removed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/chromeos/login/demo_mode_detector.h
diff --git a/chrome/browser/ui/webui/chromeos/login/demo_mode_detector.h b/chrome/browser/ui/webui/chromeos/login/demo_mode_detector.h
new file mode 100644
index 0000000000000000000000000000000000000000..c70236d1e75889775dd2d3067dc3b1337088b5c4
--- /dev/null
+++ b/chrome/browser/ui/webui/chromeos/login/demo_mode_detector.h
@@ -0,0 +1,60 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_DEMO_MODE_DETECTOR_H_
+#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_DEMO_MODE_DETECTOR_H_
+
+#include <string>
+
+#include "base/memory/weak_ptr.h"
+#include "base/time/time.h"
+#include "base/timer/timer.h"
+#include "chrome/browser/chromeos/idle_detector.h"
+
+namespace chromeos {
+
+// Helper for idle state and demo-mode detection.
+// Should be initialized on OOBE start.
+class DemoModeDetector {
+ public:
+ DemoModeDetector();
+ virtual ~DemoModeDetector();
+
+ void InitDetection();
+ void StopDetection();
+
+ private:
+ void StartIdleDetection();
+ void StartOobeTimer();
+ void OnIdle();
+ void OnOobeTimerUpdate();
+ void SetupTimeouts();
+ bool IsDerelict();
+
+ // Total time this machine has spent on OOBE.
+ base::TimeDelta time_on_oobe_;
+
+ scoped_ptr<IdleDetector> idle_detector_;
+
+ base::RepeatingTimer<DemoModeDetector> oobe_timer_;
+
+ // Timeout to detect if the machine is in a derelict state.
+ base::TimeDelta derelict_detection_timeout_;
+
+ // Timeout before showing our demo app if the machine is in a derelict state.
+ base::TimeDelta derelict_idle_timeout_;
+
+ // Time between updating our total time on oobe.
+ base::TimeDelta oobe_timer_update_interval_;
+
+ bool demo_launched_;
+
+ base::WeakPtrFactory<DemoModeDetector> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(DemoModeDetector);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_DEMO_MODE_DETECTOR_H_

Powered by Google App Engine
This is Rietveld 408576698