| 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" | |
| 16 #include "base/mac/scoped_cftyperef.h" | 15 #include "base/mac/scoped_cftyperef.h" |
| 17 #include "base/macros.h" | 16 #include "base/macros.h" |
| 18 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
| 19 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
| 20 #include "remoting/host/client_session_control.h" | 19 #include "remoting/host/client_session_control.h" |
| 21 #include "remoting/protocol/errors.h" | 20 #include "remoting/protocol/errors.h" |
| 22 | 21 |
| 23 namespace remoting { | 22 namespace remoting { |
| 24 | 23 |
| 25 namespace { | 24 namespace { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 client_session_control_.reset(); | 107 client_session_control_.reset(); |
| 109 ui_task_runner_->PostTask( | 108 ui_task_runner_->PostTask( |
| 110 FROM_HERE, base::Bind(&SessionWatcher::RemoveEventHandler, this)); | 109 FROM_HERE, base::Bind(&SessionWatcher::RemoveEventHandler, this)); |
| 111 } | 110 } |
| 112 | 111 |
| 113 SessionWatcher::~SessionWatcher() { | 112 SessionWatcher::~SessionWatcher() { |
| 114 DCHECK(!event_handler_); | 113 DCHECK(!event_handler_); |
| 115 } | 114 } |
| 116 | 115 |
| 117 void SessionWatcher::ActivateCurtain() { | 116 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 | 117 // 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. | 118 // current session so that the console session is not affected if it fails. |
| 134 if (!InstallEventHandler()) { | 119 if (!InstallEventHandler()) { |
| 135 LOG(ERROR) << "Failed to install the switch-in handler."; | 120 LOG(ERROR) << "Failed to install the switch-in handler."; |
| 136 DisconnectSession(protocol::ErrorCode::HOST_CONFIGURATION_ERROR); | 121 DisconnectSession(protocol::ErrorCode::HOST_CONFIGURATION_ERROR); |
| 137 return; | 122 return; |
| 138 } | 123 } |
| 139 | 124 |
| 140 base::ScopedCFTypeRef<CFDictionaryRef> session( | 125 base::ScopedCFTypeRef<CFDictionaryRef> session( |
| 141 CGSessionCopyCurrentDictionary()); | 126 CGSessionCopyCurrentDictionary()); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 // static | 248 // static |
| 264 std::unique_ptr<CurtainMode> CurtainMode::Create( | 249 std::unique_ptr<CurtainMode> CurtainMode::Create( |
| 265 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 250 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 266 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 251 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 267 base::WeakPtr<ClientSessionControl> client_session_control) { | 252 base::WeakPtr<ClientSessionControl> client_session_control) { |
| 268 return base::WrapUnique(new CurtainModeMac(caller_task_runner, ui_task_runner, | 253 return base::WrapUnique(new CurtainModeMac(caller_task_runner, ui_task_runner, |
| 269 client_session_control)); | 254 client_session_control)); |
| 270 } | 255 } |
| 271 | 256 |
| 272 } // namespace remoting | 257 } // namespace remoting |
| OLD | NEW |