Chromium Code Reviews| 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. |