Infer appropriate GNU_STACK alignment for a shared library.
[chromium-blink-merge.git] / remoting / host / curtain_mode_win.cc
bloba9f51c86bd3530c5abda97df716480e21ff43249
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
3 // found in the LICENSE file.
5 #include "remoting/host/curtain_mode.h"
7 #include "base/logging.h"
8 #include "base/single_thread_task_runner.h"
9 #include "base/win/windows_version.h"
10 #include "remoting/host/client_session_control.h"
12 namespace remoting {
14 class CurtainModeWin : public CurtainMode {
15 public:
16 CurtainModeWin();
18 // Overriden from CurtainMode.
19 virtual bool Activate() override;
21 private:
22 DISALLOW_COPY_AND_ASSIGN(CurtainModeWin);
25 CurtainModeWin::CurtainModeWin() {
28 bool CurtainModeWin::Activate() {
29 if (base::win::GetVersion() < base::win::VERSION_VISTA) {
30 LOG(ERROR) << "Curtain mode is not supported on Windows XP/2003";
31 return false;
34 DWORD session_id;
35 if (!ProcessIdToSessionId(GetCurrentProcessId(), &session_id)) {
36 PLOG(ERROR) << "Failed to map the current PID to session ID";
37 return false;
40 // The current session is curtained if it is not attached to the local
41 // console.
42 return WTSGetActiveConsoleSessionId() != session_id;
45 // static
46 scoped_ptr<CurtainMode> CurtainMode::Create(
47 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
48 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
49 base::WeakPtr<ClientSessionControl> client_session_control) {
50 // |client_session_control| is not used because the client session is
51 // disconnected as soon as the session is re-attached to the local console.
52 // See RdpDesktopSession for more details.
53 return make_scoped_ptr(new CurtainModeWin());
56 } // namespace remoting