Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Unified Diff: remoting/host/curtain_mac.cc

Issue 8384011: Fix up Curtain mode on MacOS 10.7 (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« remoting/host/capturer_mac.cc ('K') | « remoting/host/capturer_mac.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/curtain_mac.cc
diff --git a/remoting/host/curtain_mac.cc b/remoting/host/curtain_mac.cc
index aef87c1150b047de29ba0767098bcaa739cb468a..cae5f4cd3896bf4d8e8393e47e7e820deb3555b3 100644
--- a/remoting/host/curtain_mac.cc
+++ b/remoting/host/curtain_mac.cc
@@ -4,9 +4,12 @@
#include "remoting/host/curtain.h"
+#include <ApplicationServices/ApplicationServices.h>
+
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/logging.h"
+#include "base/mac/scoped_cftyperef.h"
namespace {
static const char* kCGSessionPath =
@@ -28,19 +31,27 @@ class CurtainMac : public Curtain {
};
void CurtainMac::EnableCurtainMode(bool enable) {
- // Whether curtain mode is being enabled or disabled, switch out the session.
+ // Whether curtain mode is being enabled or disabled, switch out the session
+ // if the current user is on the console.
Jamie 2011/10/31 22:17:47 For consistency, maybe say "if the user is switche
// 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);
+ base::mac::ScopedCFTypeRef<CFDictionaryRef> session(
+ CGSessionCopyCurrentDictionary());
+ if (CFDictionaryGetValue(session,
+ kCGSessionOnConsoleKey) == kCFBooleanTrue) {
+ LOG(ERROR) << "Enabling Curtain mode!";
Jamie 2011/10/31 22:17:47 Remove, or at least lower the log level (and get r
+
+ 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);
+ }
}
}
« remoting/host/capturer_mac.cc ('K') | « remoting/host/capturer_mac.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698