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

Unified Diff: chromeos/dbus/session_manager_client.cc

Issue 228703004: Start session fail causes restart chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed comments and rebase Created 6 years, 8 months 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 | « chromeos/dbus/session_manager_client.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..486ce595f998fe9aaae791838eb75f8dba29617e 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,8 @@ 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 +334,18 @@ 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) << "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,10 @@ 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 {
+ callback.Run(true);
+ }
virtual void StopSession() OVERRIDE {}
virtual void StartDeviceWipe() OVERRIDE {}
virtual void RequestLockScreen() OVERRIDE {
« no previous file with comments | « chromeos/dbus/session_manager_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698