diff options
author | jamiewalch@google.com <jamiewalch@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-31 20:10:36 +0000 |
---|---|---|
committer | jamiewalch@google.com <jamiewalch@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-31 20:10:36 +0000 |
commit | 135d0a4e737b0f15836a694900994b670ee1a20b (patch) | |
tree | b6df0139b9b5cd12cdbfa31b9061bf9e0dadac2f /remoting/host/curtain_mac.cc | |
parent | 3e1a05ab9d6496e84879518d974320fbc561465c (diff) | |
download | chromium_src-135d0a4e737b0f15836a694900994b670ee1a20b.zip chromium_src-135d0a4e737b0f15836a694900994b670ee1a20b.tar.gz chromium_src-135d0a4e737b0f15836a694900994b670ee1a20b.tar.bz2 |
Initial curtain mode implementation.
BUG=
TEST=
Review URL: http://codereview.chromium.org/6849027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87350 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/curtain_mac.cc')
-rw-r--r-- | remoting/host/curtain_mac.cc | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/remoting/host/curtain_mac.cc b/remoting/host/curtain_mac.cc index b6c741a..aef87c1 100644 --- a/remoting/host/curtain_mac.cc +++ b/remoting/host/curtain_mac.cc @@ -8,6 +8,12 @@ #include "base/compiler_specific.h" #include "base/logging.h" +namespace { +static const char* kCGSessionPath = + "/System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/" + "CGSession"; +} + namespace remoting { namespace { @@ -22,12 +28,29 @@ class CurtainMac : public Curtain { }; void CurtainMac::EnableCurtainMode(bool enable) { - NOTIMPLEMENTED(); + // Whether curtain mode is being enabled or disabled, switch out the session. + // TODO(jamiewalch): If curtain mode is being enabled at the login screen, it + // should be deferred until the user logs in. + pid_t child = fork(); + if (child == 0) { + execl(kCGSessionPath, kCGSessionPath, "-suspend", (char*)0); + exit(1); + } else if (child > 0) { + int status = 0; + waitpid(child, &status, 0); + // To ensure that the system has plenty of time to notify the CGDisplay- + // ReconfigurationCallback, sleep here. 1s is probably overkill. + sleep(1); + } } } // namespace Curtain* Curtain::Create() { + // There's no need to check for curtain mode being enabled here because on + // the mac it's easy for a local user to recover if anything crashes while + // a session is active--they just have to enter a password to switch their + // session back in. return new CurtainMac(); } |