| 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 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/scoped_native_library.h" | 13 #include "base/scoped_native_library.h" |
| 14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "base/win/registry.h" | 15 #include "base/win/registry.h" |
| 16 #include "base/win/windows_version.h" | 16 #include "base/win/windows_version.h" |
| 17 #include "media/video/capture/screen/win/desktop.h" | 17 #include "third_party/webrtc/modules/desktop_capture/win/desktop.h" |
| 18 #include "media/video/capture/screen/win/scoped_thread_desktop.h" | 18 #include "third_party/webrtc/modules/desktop_capture/win/scoped_thread_desktop.h
" |
| 19 | 19 |
| 20 namespace remoting { | 20 namespace remoting { |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 // Names of the API and library implementing software SAS generation. | 24 // Names of the API and library implementing software SAS generation. |
| 25 const base::FilePath::CharType kSasDllFileName[] = FILE_PATH_LITERAL("sas.dll"); | 25 const base::FilePath::CharType kSasDllFileName[] = FILE_PATH_LITERAL("sas.dll"); |
| 26 const char kSendSasName[] = "SendSAS"; | 26 const char kSendSasName[] = "SendSAS"; |
| 27 | 27 |
| 28 // The prototype of SendSAS(). | 28 // The prototype of SendSAS(). |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 } | 183 } |
| 184 | 184 |
| 185 SasInjectorXp::~SasInjectorXp() { | 185 SasInjectorXp::~SasInjectorXp() { |
| 186 } | 186 } |
| 187 | 187 |
| 188 bool SasInjectorXp::InjectSas() { | 188 bool SasInjectorXp::InjectSas() { |
| 189 const wchar_t kWinlogonDesktopName[] = L"Winlogon"; | 189 const wchar_t kWinlogonDesktopName[] = L"Winlogon"; |
| 190 const wchar_t kSasWindowClassName[] = L"SAS window class"; | 190 const wchar_t kSasWindowClassName[] = L"SAS window class"; |
| 191 const wchar_t kSasWindowTitle[] = L"SAS window"; | 191 const wchar_t kSasWindowTitle[] = L"SAS window"; |
| 192 | 192 |
| 193 scoped_ptr<media::Desktop> winlogon_desktop( | 193 scoped_ptr<webrtc::Desktop> winlogon_desktop( |
| 194 media::Desktop::GetDesktop(kWinlogonDesktopName)); | 194 webrtc::Desktop::GetDesktop(kWinlogonDesktopName)); |
| 195 if (!winlogon_desktop.get()) { | 195 if (!winlogon_desktop.get()) { |
| 196 LOG_GETLASTERROR(ERROR) | 196 LOG_GETLASTERROR(ERROR) |
| 197 << "Failed to open '" << kWinlogonDesktopName << "' desktop"; | 197 << "Failed to open '" << kWinlogonDesktopName << "' desktop"; |
| 198 return false; | 198 return false; |
| 199 } | 199 } |
| 200 | 200 |
| 201 media::ScopedThreadDesktop desktop; | 201 webrtc::ScopedThreadDesktop desktop; |
| 202 if (!desktop.SetThreadDesktop(winlogon_desktop.Pass())) { | 202 if (!desktop.SetThreadDesktop(winlogon_desktop.release())) { |
| 203 LOG_GETLASTERROR(ERROR) | 203 LOG_GETLASTERROR(ERROR) |
| 204 << "Failed to switch to '" << kWinlogonDesktopName << "' desktop"; | 204 << "Failed to switch to '" << kWinlogonDesktopName << "' desktop"; |
| 205 return false; | 205 return false; |
| 206 } | 206 } |
| 207 | 207 |
| 208 HWND window = FindWindow(kSasWindowClassName, kSasWindowTitle); | 208 HWND window = FindWindow(kSasWindowClassName, kSasWindowTitle); |
| 209 if (!window) { | 209 if (!window) { |
| 210 LOG_GETLASTERROR(ERROR) | 210 LOG_GETLASTERROR(ERROR) |
| 211 << "Failed to find '" << kSasWindowTitle << "' window"; | 211 << "Failed to find '" << kSasWindowTitle << "' window"; |
| 212 return false; | 212 return false; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 226 | 226 |
| 227 scoped_ptr<SasInjector> SasInjector::Create() { | 227 scoped_ptr<SasInjector> SasInjector::Create() { |
| 228 if (base::win::GetVersion() < base::win::VERSION_VISTA) { | 228 if (base::win::GetVersion() < base::win::VERSION_VISTA) { |
| 229 return scoped_ptr<SasInjector>(new SasInjectorXp()); | 229 return scoped_ptr<SasInjector>(new SasInjectorXp()); |
| 230 } else { | 230 } else { |
| 231 return scoped_ptr<SasInjector>(new SasInjectorWin()); | 231 return scoped_ptr<SasInjector>(new SasInjectorWin()); |
| 232 } | 232 } |
| 233 } | 233 } |
| 234 | 234 |
| 235 } // namespace remoting | 235 } // namespace remoting |
| OLD | NEW |