Chromium Code Reviews| 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 (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 if (!BrowserThread::CurrentlyOn(BrowserThread::FILE)) { | |
|
satorux1
2011/11/18 19:11:48
Please remove this line. We know that we are on UI
Simon Que
2011/11/18 19:33:16
Done.
| |
| 43 BrowserThread::PostTask( | |
| 44 BrowserThread::FILE, FROM_HERE, | |
| 45 base::Bind(&EnableScreenLockOnFileThread, enable)); | |
| 46 return; | |
| 47 } | |
| 48 } | |
| 49 | |
| 50 } // namespace screen_locker_settings | |
| 51 } // namespace system | |
| 52 } // namespace chromeos | |
| OLD | NEW |