| 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/sas_injector.h" | 5 #include "remoting/host/sas_injector.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ptr_util.h" |
| 13 #include "base/path_service.h" | 15 #include "base/path_service.h" |
| 14 #include "base/scoped_native_library.h" | 16 #include "base/scoped_native_library.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 16 #include "base/win/registry.h" | 18 #include "base/win/registry.h" |
| 17 #include "base/win/windows_version.h" | 19 #include "base/win/windows_version.h" |
| 18 #include "third_party/webrtc/modules/desktop_capture/win/desktop.h" | 20 #include "third_party/webrtc/modules/desktop_capture/win/desktop.h" |
| 19 #include "third_party/webrtc/modules/desktop_capture/win/scoped_thread_desktop.h
" | 21 #include "third_party/webrtc/modules/desktop_capture/win/scoped_thread_desktop.h
" |
| 20 | 22 |
| 21 namespace remoting { | 23 namespace remoting { |
| 22 | 24 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 } | 183 } |
| 182 | 184 |
| 183 SasInjectorXp::~SasInjectorXp() { | 185 SasInjectorXp::~SasInjectorXp() { |
| 184 } | 186 } |
| 185 | 187 |
| 186 bool SasInjectorXp::InjectSas() { | 188 bool SasInjectorXp::InjectSas() { |
| 187 const wchar_t kWinlogonDesktopName[] = L"Winlogon"; | 189 const wchar_t kWinlogonDesktopName[] = L"Winlogon"; |
| 188 const wchar_t kSasWindowClassName[] = L"SAS window class"; | 190 const wchar_t kSasWindowClassName[] = L"SAS window class"; |
| 189 const wchar_t kSasWindowTitle[] = L"SAS window"; | 191 const wchar_t kSasWindowTitle[] = L"SAS window"; |
| 190 | 192 |
| 191 scoped_ptr<webrtc::Desktop> winlogon_desktop( | 193 std::unique_ptr<webrtc::Desktop> winlogon_desktop( |
| 192 webrtc::Desktop::GetDesktop(kWinlogonDesktopName)); | 194 webrtc::Desktop::GetDesktop(kWinlogonDesktopName)); |
| 193 if (!winlogon_desktop.get()) { | 195 if (!winlogon_desktop.get()) { |
| 194 PLOG(ERROR) << "Failed to open '" << kWinlogonDesktopName << "' desktop"; | 196 PLOG(ERROR) << "Failed to open '" << kWinlogonDesktopName << "' desktop"; |
| 195 return false; | 197 return false; |
| 196 } | 198 } |
| 197 | 199 |
| 198 webrtc::ScopedThreadDesktop desktop; | 200 webrtc::ScopedThreadDesktop desktop; |
| 199 if (!desktop.SetThreadDesktop(winlogon_desktop.release())) { | 201 if (!desktop.SetThreadDesktop(winlogon_desktop.release())) { |
| 200 PLOG(ERROR) << "Failed to switch to '" << kWinlogonDesktopName | 202 PLOG(ERROR) << "Failed to switch to '" << kWinlogonDesktopName |
| 201 << "' desktop"; | 203 << "' desktop"; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 212 WM_HOTKEY, | 214 WM_HOTKEY, |
| 213 0, | 215 0, |
| 214 MAKELONG(MOD_ALT | MOD_CONTROL, VK_DELETE)) == 0) { | 216 MAKELONG(MOD_ALT | MOD_CONTROL, VK_DELETE)) == 0) { |
| 215 PLOG(ERROR) << "Failed to post WM_HOTKEY message"; | 217 PLOG(ERROR) << "Failed to post WM_HOTKEY message"; |
| 216 return false; | 218 return false; |
| 217 } | 219 } |
| 218 | 220 |
| 219 return true; | 221 return true; |
| 220 } | 222 } |
| 221 | 223 |
| 222 scoped_ptr<SasInjector> SasInjector::Create() { | 224 std::unique_ptr<SasInjector> SasInjector::Create() { |
| 223 if (base::win::GetVersion() < base::win::VERSION_VISTA) { | 225 if (base::win::GetVersion() < base::win::VERSION_VISTA) { |
| 224 return make_scoped_ptr(new SasInjectorXp()); | 226 return base::WrapUnique(new SasInjectorXp()); |
| 225 } else { | 227 } else { |
| 226 return make_scoped_ptr(new SasInjectorWin()); | 228 return base::WrapUnique(new SasInjectorWin()); |
| 227 } | 229 } |
| 228 } | 230 } |
| 229 | 231 |
| 230 } // namespace remoting | 232 } // namespace remoting |
| OLD | NEW |