summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus/session_manager_client.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromeos/dbus/session_manager_client.cc')
-rw-r--r--chromeos/dbus/session_manager_client.cc33
1 files changed, 17 insertions, 16 deletions
diff --git a/chromeos/dbus/session_manager_client.cc b/chromeos/dbus/session_manager_client.cc
index 36a4e28..438ec05 100644
--- a/chromeos/dbus/session_manager_client.cc
+++ b/chromeos/dbus/session_manager_client.cc
@@ -115,15 +115,15 @@ class SessionManagerClientImpl : public SessionManagerClient {
FOR_EACH_OBSERVER(Observer, observers_, EmitLoginPromptVisibleCalled());
}
- void RestartJob(const std::vector<std::string>& argv) override {
+ void RestartJob(int pid, const std::string& command_line) override {
dbus::ScopedFileDescriptor local_auth_fd(new dbus::FileDescriptor);
dbus::ScopedFileDescriptor remote_auth_fd(new dbus::FileDescriptor);
- // session_manager's RestartJob call requires the caller to open a socket
- // pair and pass one end over dbus while holding the local end open for the
- // duration of the call. session_manager uses this to determine whether the
- // PID the restart request originates from belongs to the browser itself.
- //
+ // The session_manager provides a new method to replace RestartJob, called
+ // RestartJobWithAuth, that is able to be used correctly within a PID
+ // namespace. To use it, the caller must create a unix domain socket pair
+ // and pass one end over dbus while holding the local end open for the
+ // duration of the call.
// Here, we call CreateValidCredConduit() to create the socket pair,
// and then pass both ends along to CallRestartJobWithValidFd(), which
// takes care of them from there.
@@ -146,7 +146,7 @@ class SessionManagerClientImpl : public SessionManagerClient {
FROM_HERE, create_credentials_conduit_closure,
base::Bind(&SessionManagerClientImpl::CallRestartJobWithValidFd,
weak_ptr_factory_.GetWeakPtr(), base::Passed(&local_auth_fd),
- base::Passed(&remote_auth_fd), argv),
+ base::Passed(&remote_auth_fd), command_line),
false);
}
@@ -421,18 +421,19 @@ class SessionManagerClientImpl : public SessionManagerClient {
callback));
}
- // Calls RestartJob to tell the session manager to restart the browser using
- // the contents of |argv| as the command line, authorizing the call using
- // credentials acquired via |remote_auth_fd|. Ownership of |local_auth_fd| is
- // held for the duration of the dbus call.
+ // Calls RestartJobWithAuth to tell the session manager to restart the
+ // browser using the contents of command_line, authorizing the call
+ // using credentials acquired via remote_auth_fd.
+ // Ownership of local_auth_fd is held for the duration of the dbus call.
void CallRestartJobWithValidFd(dbus::ScopedFileDescriptor local_auth_fd,
dbus::ScopedFileDescriptor remote_auth_fd,
- const std::vector<std::string>& argv) {
- dbus::MethodCall method_call(login_manager::kSessionManagerInterface,
- login_manager::kSessionManagerRestartJob);
+ const std::string& command_line) {
+ dbus::MethodCall method_call(
+ login_manager::kSessionManagerInterface,
+ login_manager::kSessionManagerRestartJobWithAuth);
dbus::MessageWriter writer(&method_call);
writer.AppendFileDescriptor(*remote_auth_fd);
- writer.AppendArrayOfStrings(argv);
+ writer.AppendString(command_line);
// Ownership of local_auth_fd is passed to the callback that is to be
// called on completion of this method call. This keeps the browser end
@@ -669,7 +670,7 @@ class SessionManagerClientStubImpl : public SessionManagerClient {
}
bool IsScreenLocked() const override { return screen_is_locked_; }
void EmitLoginPromptVisible() override {}
- void RestartJob(const std::vector<std::string>& argv) override {}
+ void RestartJob(int pid, const std::string& command_line) override {}
void StartSession(const std::string& user_email) override {}
void StopSession() override {}
void NotifySupervisedUserCreationStarted() override {}