OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/host/curtain_mode.h" | 5 #include "remoting/host/curtain_mode.h" |
6 | 6 |
7 #include <ApplicationServices/ApplicationServices.h> | 7 #include <ApplicationServices/ApplicationServices.h> |
8 #include <Carbon/Carbon.h> | 8 #include <Carbon/Carbon.h> |
9 #include <Security/Security.h> | 9 #include <Security/Security.h> |
10 #include <unistd.h> | 10 #include <unistd.h> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/location.h" | 13 #include "base/location.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/mac/mac_util.h" | 15 #include "base/mac/mac_util.h" |
tapted
2016/04/25 21:25:46
remove?
Nico
2016/04/26 14:30:44
Done.
| |
16 #include "base/mac/scoped_cftyperef.h" | 16 #include "base/mac/scoped_cftyperef.h" |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "base/memory/ptr_util.h" | 18 #include "base/memory/ptr_util.h" |
19 #include "base/single_thread_task_runner.h" | 19 #include "base/single_thread_task_runner.h" |
20 #include "remoting/host/client_session_control.h" | 20 #include "remoting/host/client_session_control.h" |
21 #include "remoting/protocol/errors.h" | 21 #include "remoting/protocol/errors.h" |
22 | 22 |
23 namespace remoting { | 23 namespace remoting { |
24 | 24 |
25 namespace { | 25 namespace { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
108 client_session_control_.reset(); | 108 client_session_control_.reset(); |
109 ui_task_runner_->PostTask( | 109 ui_task_runner_->PostTask( |
110 FROM_HERE, base::Bind(&SessionWatcher::RemoveEventHandler, this)); | 110 FROM_HERE, base::Bind(&SessionWatcher::RemoveEventHandler, this)); |
111 } | 111 } |
112 | 112 |
113 SessionWatcher::~SessionWatcher() { | 113 SessionWatcher::~SessionWatcher() { |
114 DCHECK(!event_handler_); | 114 DCHECK(!event_handler_); |
115 } | 115 } |
116 | 116 |
117 void SessionWatcher::ActivateCurtain() { | 117 void SessionWatcher::ActivateCurtain() { |
118 // Curtain mode causes problems with the login screen on Lion only (starting | |
119 // with 10.7.3), so disable it on that platform. There is a work-around, but | |
120 // it involves modifying a system Plist pertaining to power-management, so | |
121 // it's not something that should be done automatically. For more details, | |
122 // see https://discussions.apple.com/thread/3209415?start=690&tstart=0 | |
123 // | |
124 // TODO(jamiewalch): If the underlying OS bug is ever fixed, we should support | |
125 // curtain mode on suitable versions of Lion. | |
126 if (base::mac::IsOSLion()) { | |
127 LOG(ERROR) << "Host curtaining is not supported on Mac OS X 10.7."; | |
128 DisconnectSession(protocol::ErrorCode::HOST_CONFIGURATION_ERROR); | |
129 return; | |
130 } | |
131 | |
132 // Try to install the switch-in handler. Do this before switching out the | 118 // Try to install the switch-in handler. Do this before switching out the |
133 // current session so that the console session is not affected if it fails. | 119 // current session so that the console session is not affected if it fails. |
134 if (!InstallEventHandler()) { | 120 if (!InstallEventHandler()) { |
135 LOG(ERROR) << "Failed to install the switch-in handler."; | 121 LOG(ERROR) << "Failed to install the switch-in handler."; |
136 DisconnectSession(protocol::ErrorCode::HOST_CONFIGURATION_ERROR); | 122 DisconnectSession(protocol::ErrorCode::HOST_CONFIGURATION_ERROR); |
137 return; | 123 return; |
138 } | 124 } |
139 | 125 |
140 base::ScopedCFTypeRef<CFDictionaryRef> session( | 126 base::ScopedCFTypeRef<CFDictionaryRef> session( |
141 CGSessionCopyCurrentDictionary()); | 127 CGSessionCopyCurrentDictionary()); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
263 // static | 249 // static |
264 std::unique_ptr<CurtainMode> CurtainMode::Create( | 250 std::unique_ptr<CurtainMode> CurtainMode::Create( |
265 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 251 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
266 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 252 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
267 base::WeakPtr<ClientSessionControl> client_session_control) { | 253 base::WeakPtr<ClientSessionControl> client_session_control) { |
268 return base::WrapUnique(new CurtainModeMac(caller_task_runner, ui_task_runner, | 254 return base::WrapUnique(new CurtainModeMac(caller_task_runner, ui_task_runner, |
269 client_session_control)); | 255 client_session_control)); |
270 } | 256 } |
271 | 257 |
272 } // namespace remoting | 258 } // namespace remoting |
OLD | NEW |