diff options
author | jamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-20 04:58:48 +0000 |
---|---|---|
committer | jamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-20 04:58:48 +0000 |
commit | c34a4eb14f096235fb21f5f41c7bd0ddddb0d811 (patch) | |
tree | 9fcb518fd19fc89d9800fd4cc7114fb350941dfc /remoting/host/curtain_mode_mac.cc | |
parent | 5a61b2c39d2e45c9227d13b68f09a87354590d83 (diff) | |
download | chromium_src-c34a4eb14f096235fb21f5f41c7bd0ddddb0d811.zip chromium_src-c34a4eb14f096235fb21f5f41c7bd0ddddb0d811.tar.gz chromium_src-c34a4eb14f096235fb21f5f41c7bd0ddddb0d811.tar.bz2 |
Reinstate curtain mode on non-Lion Mac.
BUG=156256
Review URL: https://chromiumcodereview.appspot.com/11299087
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168735 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/curtain_mode_mac.cc')
-rw-r--r-- | remoting/host/curtain_mode_mac.cc | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/remoting/host/curtain_mode_mac.cc b/remoting/host/curtain_mode_mac.cc index 593f1bb..7a7b8c1 100644 --- a/remoting/host/curtain_mode_mac.cc +++ b/remoting/host/curtain_mode_mac.cc @@ -10,6 +10,7 @@ #include <unistd.h> #include "base/logging.h" +#include "base/mac/mac_util.h" #include "base/mac/scoped_cftyperef.h" namespace { @@ -65,16 +66,28 @@ CurtainModeMac::~CurtainModeMac() { void CurtainModeMac::SetActivated(bool activated) { if (activated) { - // Curtain-mode has issues on Mac OS X 10.7, so is currently disabled. - //if (!ActivateCurtain()) { - on_error_.Run(); - //} + if (!ActivateCurtain()) { + on_error_.Run(); + } } else { RemoveEventHandler(); } } bool CurtainModeMac::ActivateCurtain() { + // Curtain mode causes problems with the login screen on Lion only (starting + // with 10.7.3), so disable it on that platform. There is a work-around, but + // it involves modifying a system Plist pertaining to power-management, so + // it's not something that should be done automatically. For more details, + // see https://discussions.apple.com/thread/3209415?start=690&tstart=0 + // + // TODO(jamiewalch): If the underlying OS bug is ever fixed, we should support + // curtain mode on suitable versions of Lion. + if (base::mac::IsOSLion()) { + LOG(ERROR) << "Host curtaining is not supported on Mac OS X 10.7."; + return false; + } + // Try to install the switch-in handler. Do this before switching out the // current session so that the console session is not affected if it fails. if (!InstallEventHandler()) { @@ -83,6 +96,16 @@ bool CurtainModeMac::ActivateCurtain() { base::mac::ScopedCFTypeRef<CFDictionaryRef> session( CGSessionCopyCurrentDictionary()); + + // CGSessionCopyCurrentDictionary has been observed to return NULL in some + // cases. Once the system is in this state, curtain mode will fail as the + // CGSession command thinks the session is not attached to the console. The + // only known remedy is logout or reboot. Since we're not sure what causes + // this, or how common it is, a crash report is useful in this case (note + // that the connection would have to be refused in any case, so this is no + // loss of functionality). + CHECK(session != NULL); + const void* on_console = CFDictionaryGetValue(session, kCGSessionOnConsoleKey); const void* logged_in = CFDictionaryGetValue(session, kCGSessionLoginDoneKey); |