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

Side by Side Diff: chrome/browser/chromeos/system/screen_locker_settings.cc

Issue 8573025: chromeos: Move EnableScreenLock to PowerManagerClient from PowerLibrary (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added thread checks, created separate file thread func, removed unneeded includes Created 9 years, 1 month 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
« no previous file with comments | « chrome/browser/chromeos/system/screen_locker_settings.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/system/screen_locker_settings.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698