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

Unified Diff: chrome/browser/chromeos/cros/power_library.cc

Issue 3532010: Add a pref checkbox to enable/disable screen lock for ChromeOs. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: firx chromeos trybot 2, set expectations Created 10 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/cros/power_library.cc
diff --git a/chrome/browser/chromeos/cros/power_library.cc b/chrome/browser/chromeos/cros/power_library.cc
index 220cd4e353666b373d009535ca415a307e5fa9cf..85c5e9a26771963f0560b6686ad82918fd81dfea 100644
--- a/chrome/browser/chromeos/cros/power_library.cc
+++ b/chrome/browser/chromeos/cros/power_library.cc
@@ -59,6 +59,22 @@ class PowerLibraryImpl : public PowerLibrary {
return base::TimeDelta::FromSeconds(status_.battery_time_to_full);
}
+ virtual void EnableScreenLock(bool enable) {
+ if (!CrosLibrary::Get()->EnsureLoaded())
+ return;
+
+ // Make sure we run on FILE thread becuase chromeos::EnableScreenLock
+ // would write power manager config file to disk.
+ if (!ChromeThread::CurrentlyOn(ChromeThread::FILE)) {
+ ChromeThread::PostTask(
+ ChromeThread::FILE, FROM_HERE,
+ NewRunnableMethod(this, &PowerLibraryImpl::EnableScreenLock, enable));
+ return;
+ }
+
+ chromeos::EnableScreenLock(enable);
+ }
+
private:
static void PowerStatusChangedHandler(void* object,
const chromeos::PowerStatus& status) {
@@ -119,6 +135,7 @@ class PowerLibraryStubImpl : public PowerLibrary {
base::TimeDelta battery_time_to_full() const {
return base::TimeDelta::FromSeconds(0);
}
+ virtual void EnableScreenLock(bool enable) {}
};
// static
« no previous file with comments | « chrome/browser/chromeos/cros/power_library.h ('k') | chrome/browser/chromeos/dom_ui/cros_personal_options_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698