OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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/system/touchpad_settings.h" |
| 6 |
| 7 #include "base/bind.h" |
| 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" |
| 10 #include "base/stringprintf.h" |
| 11 #include "chrome/browser/chromeos/system/runtime_environment.h" |
| 12 #include "content/public/browser/browser_thread.h" |
| 13 |
| 14 using content::BrowserThread; |
| 15 |
| 16 namespace { |
| 17 |
| 18 const char kLockOnIdleSuspendPath[] = |
| 19 "/var/lib/power_manager/lock_on_idle_suspend"; |
| 20 |
| 21 void EnableScreenLockOnFileThread(bool enable) { |
| 22 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 23 |
| 24 if (chromeos::system::runtime_environment::IsRunningOnChromeOS()) { |
| 25 std::string config = base::StringPrintf("%d", enable); |
| 26 file_util::WriteFile(FilePath(kLockOnIdleSuspendPath), |
| 27 config.c_str(), |
| 28 config.size()); |
| 29 } |
| 30 } |
| 31 |
| 32 } // namespace |
| 33 |
| 34 namespace chromeos { |
| 35 namespace system { |
| 36 namespace screen_locker_settings { |
| 37 |
| 38 void EnableScreenLock(bool enable) { |
| 39 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 40 |
| 41 // Run this on the FILE thread. |
| 42 BrowserThread::PostTask( |
| 43 BrowserThread::FILE, FROM_HERE, |
| 44 base::Bind(&EnableScreenLockOnFileThread, enable)); |
| 45 } |
| 46 |
| 47 } // namespace screen_locker_settings |
| 48 } // namespace system |
| 49 } // namespace chromeos |
OLD | NEW |