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

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

Issue 8537001: chromeos: Power manager client calls shutdown and restart (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
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.

Powered by Google App Engine
This is Rietveld 408576698