diff options
author | ihf <ihf@chromium.org> | 2015-08-14 16:52:20 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-14 23:52:47 +0000 |
commit | 7458fb3730f7cfc084f310a7cbebde489aa78439 (patch) | |
tree | e7320be2684a5179d64557ef436f817e874de6ea /chromeos | |
parent | 0b041b2c0d2740158845f37ffb8aa0f9a3f1f1da (diff) | |
download | chromium_src-7458fb3730f7cfc084f310a7cbebde489aa78439.zip chromium_src-7458fb3730f7cfc084f310a7cbebde489aa78439.tar.gz chromium_src-7458fb3730f7cfc084f310a7cbebde489aa78439.tar.bz2 |
Revert "SessionManagerClient::RestartJob: Use argv instead of string."
This speculatively reverts commit fb4a4c60596d52a2f3ab26ab94399d3ebd5a64c1.
For details please see crbug.com/520311
NOTRY=true
TBR=mnissler
BUG=chromium:520311, chromium:433172
TEST=compiles
Review URL: https://codereview.chromium.org/1289393002
Cr-Commit-Position: refs/heads/master@{#343536}
Diffstat (limited to 'chromeos')
-rw-r--r-- | chromeos/dbus/fake_session_manager_client.cc | 5 | ||||
-rw-r--r-- | chromeos/dbus/fake_session_manager_client.h | 2 | ||||
-rw-r--r-- | chromeos/dbus/mock_session_manager_client.h | 2 | ||||
-rw-r--r-- | chromeos/dbus/session_manager_client.cc | 33 | ||||
-rw-r--r-- | chromeos/dbus/session_manager_client.h | 4 |
5 files changed, 24 insertions, 22 deletions
diff --git a/chromeos/dbus/fake_session_manager_client.cc b/chromeos/dbus/fake_session_manager_client.cc index 89261ea..c1745cf 100644 --- a/chromeos/dbus/fake_session_manager_client.cc +++ b/chromeos/dbus/fake_session_manager_client.cc @@ -47,8 +47,9 @@ bool FakeSessionManagerClient::IsScreenLocked() const { void FakeSessionManagerClient::EmitLoginPromptVisible() { } -void FakeSessionManagerClient::RestartJob( - const std::vector<std::string>& argv) {} +void FakeSessionManagerClient::RestartJob(int pid, + const std::string& command_line) { +} void FakeSessionManagerClient::StartSession(const std::string& user_email) { DCHECK_EQ(0UL, user_sessions_.count(user_email)); diff --git a/chromeos/dbus/fake_session_manager_client.h b/chromeos/dbus/fake_session_manager_client.h index e2ff7cc..ed4c5c1 100644 --- a/chromeos/dbus/fake_session_manager_client.h +++ b/chromeos/dbus/fake_session_manager_client.h @@ -31,7 +31,7 @@ class FakeSessionManagerClient : public SessionManagerClient { bool HasObserver(const Observer* observer) const override; bool IsScreenLocked() const override; 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; diff --git a/chromeos/dbus/mock_session_manager_client.h b/chromeos/dbus/mock_session_manager_client.h index 17f0caf..3a88e52 100644 --- a/chromeos/dbus/mock_session_manager_client.h +++ b/chromeos/dbus/mock_session_manager_client.h @@ -24,7 +24,7 @@ class MockSessionManagerClient : public SessionManagerClient { MOCK_CONST_METHOD1(HasObserver, bool(const Observer*)); MOCK_CONST_METHOD0(IsScreenLocked, bool(void)); MOCK_METHOD0(EmitLoginPromptVisible, void(void)); - MOCK_METHOD1(RestartJob, void(const std::vector<std::string>&)); + MOCK_METHOD2(RestartJob, void(int, const std::string&)); MOCK_METHOD1(StartSession, void(const std::string&)); MOCK_METHOD0(StopSession, void(void)); MOCK_METHOD0(NotifySupervisedUserCreationStarted, void(void)); 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 {} diff --git a/chromeos/dbus/session_manager_client.h b/chromeos/dbus/session_manager_client.h index ba21997..254e762 100644 --- a/chromeos/dbus/session_manager_client.h +++ b/chromeos/dbus/session_manager_client.h @@ -73,8 +73,8 @@ class CHROMEOS_EXPORT SessionManagerClient : public DBusClient { // Kicks off an attempt to emit the "login-prompt-visible" upstart signal. virtual void EmitLoginPromptVisible() = 0; - // Restarts the browser job, passing |argv| as the updated command line. - virtual void RestartJob(const std::vector<std::string>& argv) = 0; + // Restarts a job referenced by |pid| with the provided command line. + virtual void RestartJob(int pid, const std::string& command_line) = 0; // Starts the session for the user. virtual void StartSession(const std::string& user_email) = 0; |