| Index: chrome/browser/chromeos/kiosk_mode/kiosk_mode_helper.cc
|
| diff --git a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_helper.cc b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_helper.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..94167f62a51e090377ee20ec4c28b2849f9531a6
|
| --- /dev/null
|
| +++ b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_helper.cc
|
| @@ -0,0 +1,67 @@
|
| +// Copyright (c) 2012 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.
|
| +
|
| +#include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_helper.h"
|
| +
|
| +#include "base/bind.h"
|
| +#include "base/command_line.h"
|
| +#include "base/lazy_instance.h"
|
| +#include "chrome/browser/browser_process.h"
|
| +#include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h"
|
| +#include "chrome/browser/policy/cloud_policy_constants.h"
|
| +#include "chrome/browser/policy/browser_policy_connector.h"
|
| +#include "chrome/common/chrome_switches.h"
|
| +
|
| +namespace {
|
| +
|
| +const int64 kScreensaverIdleTimeout = 60;
|
| +
|
| +} // namespace
|
| +
|
| +namespace chromeos {
|
| +
|
| +static base::LazyInstance<KioskModeHelper> g_kiosk_mode_helper =
|
| + LAZY_INSTANCE_INITIALIZER;
|
| +
|
| +// static
|
| +KioskModeHelper* KioskModeHelper::Get() {
|
| + return g_kiosk_mode_helper.Pointer();
|
| +}
|
| +
|
| +bool KioskModeHelper::IsKioskModeEnabled() const {
|
| + policy::BrowserPolicyConnector* bpc =
|
| + g_browser_process->browser_policy_connector();
|
| + if (bpc && policy::DEVICE_MODE_KIOSK == bpc->GetDeviceMode())
|
| + return true;
|
| + // In case we've force-enabled kiosk mode.
|
| + if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableKioskMode))
|
| + return true;
|
| +
|
| + return false;
|
| +}
|
| +
|
| +void KioskModeHelper::Initialize(const base::Closure& notify_initialized) {
|
| + is_initialized_ = true;
|
| + notify_initialized.Run();
|
| +}
|
| +
|
| +std::string KioskModeHelper::GetScreensaverPath() const {
|
| + if (!is_initialized_)
|
| + return std::string();
|
| +
|
| + return CommandLine::ForCurrentProcess()->
|
| + GetSwitchValueASCII(switches::kKioskModeScreensaverPath);
|
| +}
|
| +
|
| +int64 KioskModeHelper::GetScreensaverTimeout() const {
|
| + if (!is_initialized_)
|
| + return -1;
|
| +
|
| + return kScreensaverIdleTimeout;
|
| +}
|
| +
|
| +KioskModeHelper::KioskModeHelper() : is_initialized_(false) {
|
| +}
|
| +
|
| +} // namespace chromeos
|
|
|