Chromium Code Reviews| Index: chromeos/dbus/session_manager_client.cc |
| diff --git a/chromeos/dbus/session_manager_client.cc b/chromeos/dbus/session_manager_client.cc |
| index 27858284366571281b977be3666941f1a02c29a2..cbb4f883506d0d299999ae97dfe4f3b4ed291f04 100644 |
| --- a/chromeos/dbus/session_manager_client.cc |
| +++ b/chromeos/dbus/session_manager_client.cc |
| @@ -71,7 +71,8 @@ class SessionManagerClientImpl : public SessionManagerClient { |
| weak_ptr_factory_.GetWeakPtr())); |
| } |
| - virtual void StartSession(const std::string& user_email) OVERRIDE { |
| + virtual void StartSession(const std::string& user_email, |
| + const StartSessionCallback& callback) OVERRIDE { |
| dbus::MethodCall method_call(login_manager::kSessionManagerInterface, |
| login_manager::kSessionManagerStartSession); |
| dbus::MessageWriter writer(&method_call); |
| @@ -81,7 +82,7 @@ class SessionManagerClientImpl : public SessionManagerClient { |
| &method_call, |
| dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| base::Bind(&SessionManagerClientImpl::OnStartSession, |
| - weak_ptr_factory_.GetWeakPtr())); |
| + weak_ptr_factory_.GetWeakPtr(), callback)); |
| } |
| virtual void StopSession() OVERRIDE { |
| @@ -332,10 +333,19 @@ class SessionManagerClientImpl : public SessionManagerClient { |
| } |
| // Called when kSessionManagerStartSession method is complete. |
| - void OnStartSession(dbus::Response* response) { |
| - LOG_IF(ERROR, !response) |
| - << "Failed to call " |
| - << login_manager::kSessionManagerStartSession; |
| + void OnStartSession(const StartSessionCallback& callback, |
| + dbus::Response* response) { |
| + bool success = false; |
| + if (!response) { |
| + LOG(ERROR) |
|
ygorshenin1
2014/04/10 15:39:22
nit: move '<< "Failed to call "' to the previous l
Roman Sorokin (ftl)
2014/04/11 07:38:13
Done.
|
| + << "Failed to call " |
| + << login_manager::kSessionManagerStartSession; |
| + } else { |
| + dbus::MessageReader reader(response); |
| + if (!reader.PopBool(&success)) |
| + LOG(ERROR) << "Invalid response: " << response->ToString(); |
| + } |
| + callback.Run(success); |
| } |
| // Called when kSessionManagerStopSession method is complete. |
| @@ -518,7 +528,8 @@ class SessionManagerClientStubImpl : public SessionManagerClient { |
| } |
| virtual void EmitLoginPromptVisible() OVERRIDE {} |
| virtual void RestartJob(int pid, const std::string& command_line) OVERRIDE {} |
| - virtual void StartSession(const std::string& user_email) OVERRIDE {} |
| + virtual void StartSession(const std::string& user_email, |
| + const StartSessionCallback& callback) OVERRIDE {} |
| virtual void StopSession() OVERRIDE {} |
| virtual void StartDeviceWipe() OVERRIDE {} |
| virtual void RequestLockScreen() OVERRIDE { |