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 a4236e013b92c00bd52866bcf421e71147bd1a9c..9592bc91ca135e1f30203b76fa88336aafd4ced6 100644 |
--- a/chrome/browser/chromeos/dbus/power_manager_client.cc |
+++ b/chrome/browser/chromeos/dbus/power_manager_client.cc |
@@ -128,6 +128,29 @@ class PowerManagerClientImpl : public PowerManagerClient { |
// when we migrate the DBus code from libcros to here. |
} |
+ // Requests restart of the system. |
+ virtual void RequestRestart() OVERRIDE { |
+ dbus::MethodCall method_call(power_manager::kPowerManagerInterface, |
+ power_manager::kRequestRestartMethod); |
+ power_manager_proxy_->CallMethod( |
+ &method_call, |
+ dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
+ base::Bind(&PowerManagerClientImpl::OnRequestShutdownOrRestart, |
+ weak_ptr_factory_.GetWeakPtr())); |
satorux1
2011/11/11 18:04:59
Please use dbus::ObjectProxy::EmptyResponseCallbac
Simon Que
2011/11/11 18:56:53
Done.
|
+ }; |
+ |
+ // Requests shutdown of the system. |
+ virtual void RequestShutdown() OVERRIDE { |
+ dbus::MethodCall method_call(power_manager::kPowerManagerInterface, |
+ power_manager::kRequestShutdownMethod); |
+ power_manager_proxy_->CallMethod( |
+ &method_call, |
+ dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
+ base::Bind(&PowerManagerClientImpl::OnRequestShutdownOrRestart, |
+ weak_ptr_factory_.GetWeakPtr())); |
satorux1
2011/11/11 18:04:59
ditto.
Simon Que
2011/11/11 18:56:53
Done.
|
+ } |
+ |
+ |
private: |
// Called when a dbus signal is initially connected. |
void SignalConnected(const std::string& interface_name, |
@@ -220,6 +243,10 @@ class PowerManagerClientImpl : public PowerManagerClient { |
FOR_EACH_OBSERVER(Observer, observers_, PowerChanged(status)); |
} |
+ // Dummy callback function for CallMethod. |
+ // TODO(satorux): remove when dbus method call function supports no callback. |
+ void OnRequestShutdownOrRestart(dbus::Response* response) {} |
satorux1
2011/11/11 18:04:59
Remove this now.
Simon Que
2011/11/11 18:56:53
Done.
|
+ |
dbus::ObjectProxy* power_manager_proxy_; |
ObserverList<Observer> observers_; |
base::WeakPtrFactory<PowerManagerClientImpl> weak_ptr_factory_; |
@@ -271,6 +298,10 @@ class PowerManagerClientStubImpl : public PowerManagerClient { |
} |
} |
+ virtual void RequestRestart() OVERRIDE {} |
+ |
+ virtual void RequestShutdown() OVERRIDE {} |
+ |
private: |
void Update() { |
// We pause at 0 and 100% so that it's easier to check those conditions. |