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

Side by Side Diff: chrome/browser/chromeos/kiosk_mode/kiosk_mode_helper.cc

Issue 9538002: Create Login UI for Demo User. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: image removed. Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_helper.h"
6
7 #include "base/bind.h"
8 #include "base/command_line.h"
9 #include "base/lazy_instance.h"
10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h"
12 #include "chrome/browser/policy/cloud_policy_constants.h"
13 #include "chrome/browser/policy/browser_policy_connector.h"
14 #include "chrome/common/chrome_switches.h"
15
16 namespace {
17
18 const int64 kScreensaverIdleTimeout = 60;
19
20 } // namespace
21
22 namespace chromeos {
23
24 static base::LazyInstance<KioskModeHelper> g_kiosk_mode_helper =
25 LAZY_INSTANCE_INITIALIZER;
26
27 // static
28 bool KioskModeHelper::IsKioskModeEnabled() {
29 if (g_browser_process) {
30 policy::BrowserPolicyConnector* bpc =
31 g_browser_process->browser_policy_connector();
32 if (bpc && policy::DEVICE_MODE_KIOSK == bpc->GetDeviceMode())
33 return true;
34 }
35 // In case we've force-enabled kiosk mode.
36 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableKioskMode))
37 return true;
38
39 return false;
40 }
41
42 // static
43 KioskModeHelper* KioskModeHelper::Get() {
44 return g_kiosk_mode_helper.Pointer();
45 }
46
47 void KioskModeHelper::Initialize(const base::Closure& notify_initialized) {
48 is_initialized_ = true;
49 notify_initialized.Run();
50 }
51
52 std::string KioskModeHelper::GetScreensaverPath() const {
53 if (!is_initialized_)
54 return std::string();
55
56 return CommandLine::ForCurrentProcess()->
57 GetSwitchValueASCII(switches::kKioskModeScreensaverPath);
58 }
59
60 int64 KioskModeHelper::GetScreensaverTimeout() const {
61 if (!is_initialized_)
62 return -1;
63
64 return kScreensaverIdleTimeout;
65 }
66
67 KioskModeHelper::KioskModeHelper() : is_initialized_(false) {
68 }
69
70 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698