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

Unified Diff: chrome/browser/chromeos/dbus/power_manager_client.cc

Issue 8573025: chromeos: Move EnableScreenLock to PowerManagerClient from PowerLibrary (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/dbus/power_manager_client.h ('k') | chrome/browser/chromeos/preferences.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/dbus/power_manager_client.cc
diff --git a/chrome/browser/chromeos/dbus/power_manager_client.cc b/chrome/browser/chromeos/dbus/power_manager_client.cc
index 3c55a678d27a57c37e8eec518f77df46ed4625fc..db214ec7a4c28fc63f83f13a0d3793f581f8490f 100644
--- a/chrome/browser/chromeos/dbus/power_manager_client.cc
+++ b/chrome/browser/chromeos/dbus/power_manager_client.cc
@@ -8,6 +8,7 @@
#include "base/bind.h"
#include "base/callback.h"
+#include "base/file_util.h"
#include "base/format_macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
@@ -20,6 +21,13 @@
#include "dbus/object_proxy.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
+namespace {
+
+const char kLockOnIdleSuspendPath[] =
+ "/var/lib/power_manager/lock_on_idle_suspend";
+
+} // namespace
+
namespace chromeos {
PowerSupplyStatus::PowerSupplyStatus()
@@ -167,6 +175,13 @@ class PowerManagerClientImpl : public PowerManagerClient {
weak_ptr_factory_.GetWeakPtr(), callback));
}
+ virtual void EnableScreenLock(bool enable) OVERRIDE {
+ std::string config = base::StringPrintf("%d", enable);
+ file_util::WriteFile(FilePath(kLockOnIdleSuspendPath),
+ config.c_str(),
+ config.size());
satorux1 2011/11/16 00:52:49 Let's do this somewhere else. PowerManagerClient i
satorux1 2011/11/16 00:55:52 Besides, please be sure to do this in FILE thread.
satorux1 2011/11/16 00:59:48 I changed my mind. Putting the code in chrome/brow
Simon Que 2011/11/16 01:40:02 Done.
Simon Que 2011/11/16 01:40:02 Done.
+ }
+
private:
// Called when a dbus signal is initially connected.
void SignalConnected(const std::string& interface_name,
@@ -324,6 +339,8 @@ class PowerManagerClientStubImpl : public PowerManagerClient {
callback.Run(0);
}
+ virtual void EnableScreenLock(bool enable) OVERRIDE {}
+
private:
void Update() {
// We pause at 0 and 100% so that it's easier to check those conditions.
« no previous file with comments | « chrome/browser/chromeos/dbus/power_manager_client.h ('k') | chrome/browser/chromeos/preferences.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698