Don't restore screen resolution in curtain mode.
Restoring the resolution could mess up the user's window layout if they
disconnect and reconnect, and both OS X and Windows will restore the
screen resolution if the user does log back in from the console.
Review-Url: https://codereview.chromium.org/2023433003
Cr-Commit-Position: refs/heads/master@{#398378}
diff --git a/remoting/host/me2me_desktop_environment.cc b/remoting/host/me2me_desktop_environment.cc
index 1395f9a..190707f6 100644
--- a/remoting/host/me2me_desktop_environment.cc
+++ b/remoting/host/me2me_desktop_environment.cc
@@ -39,7 +39,13 @@
Me2MeDesktopEnvironment::CreateScreenControls() {
DCHECK(caller_task_runner()->BelongsToCurrentThread());
- return base::WrapUnique(new ResizingHostObserver(DesktopResizer::Create()));
+ // We only want to restore the host resolution on disconnect if we are not
+ // curtained so we don't mess up the user's window layout unnecessarily if
+ // they disconnect and reconnect. Both OS X and Windows will restore the
+ // resolution automatically when the user logs back in on the console, and on
+ // Linux the curtain-mode uses a separate session.
+ return base::WrapUnique(new ResizingHostObserver(DesktopResizer::Create(),
+ curtain_ == nullptr));
}
std::string Me2MeDesktopEnvironment::GetCapabilities() const {
@@ -80,10 +86,12 @@
curtain_ = CurtainMode::Create(caller_task_runner(),
ui_task_runner(),
client_session_control);
- bool active = curtain_->Activate();
- if (!active)
+ if (!curtain_->Activate()) {
LOG(ERROR) << "Failed to activate the curtain mode.";
- return active;
+ curtain_ = nullptr;
+ return false;
+ }
+ return true;
}
// Otherwise, if the session is shared with the local user start monitoring