| 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> |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 } | 127 } |
| 128 | 128 |
| 129 // Try to install the switch-in handler. Do this before switching out the | 129 // Try to install the switch-in handler. Do this before switching out the |
| 130 // current session so that the console session is not affected if it fails. | 130 // current session so that the console session is not affected if it fails. |
| 131 if (!InstallEventHandler()) { | 131 if (!InstallEventHandler()) { |
| 132 LOG(ERROR) << "Failed to install the switch-in handler."; | 132 LOG(ERROR) << "Failed to install the switch-in handler."; |
| 133 DisconnectSession(); | 133 DisconnectSession(); |
| 134 return; | 134 return; |
| 135 } | 135 } |
| 136 | 136 |
| 137 base::mac::ScopedCFTypeRef<CFDictionaryRef> session( | 137 base::ScopedCFTypeRef<CFDictionaryRef> session( |
| 138 CGSessionCopyCurrentDictionary()); | 138 CGSessionCopyCurrentDictionary()); |
| 139 | 139 |
| 140 // CGSessionCopyCurrentDictionary has been observed to return NULL in some | 140 // CGSessionCopyCurrentDictionary has been observed to return NULL in some |
| 141 // cases. Once the system is in this state, curtain mode will fail as the | 141 // cases. Once the system is in this state, curtain mode will fail as the |
| 142 // CGSession command thinks the session is not attached to the console. The | 142 // CGSession command thinks the session is not attached to the console. The |
| 143 // only known remedy is logout or reboot. Since we're not sure what causes | 143 // only known remedy is logout or reboot. Since we're not sure what causes |
| 144 // this, or how common it is, a crash report is useful in this case (note | 144 // this, or how common it is, a crash report is useful in this case (note |
| 145 // that the connection would have to be refused in any case, so this is no | 145 // that the connection would have to be refused in any case, so this is no |
| 146 // loss of functionality). | 146 // loss of functionality). |
| 147 CHECK(session != NULL); | 147 CHECK(session != NULL); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 scoped_ptr<CurtainMode> CurtainMode::Create( | 259 scoped_ptr<CurtainMode> CurtainMode::Create( |
| 260 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 260 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 261 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 261 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 262 base::WeakPtr<ClientSessionControl> client_session_control) { | 262 base::WeakPtr<ClientSessionControl> client_session_control) { |
| 263 return scoped_ptr<CurtainMode>(new CurtainModeMac(caller_task_runner, | 263 return scoped_ptr<CurtainMode>(new CurtainModeMac(caller_task_runner, |
| 264 ui_task_runner, | 264 ui_task_runner, |
| 265 client_session_control)); | 265 client_session_control)); |
| 266 } | 266 } |
| 267 | 267 |
| 268 } // namespace remoting | 268 } // namespace remoting |
| OLD | NEW |