This source file includes following definitions.
- Activate
- Create
#include "remoting/host/curtain_mode.h"
#include "base/logging.h"
#include "base/single_thread_task_runner.h"
#include "base/win/windows_version.h"
#include "remoting/host/client_session_control.h"
namespace remoting {
class CurtainModeWin : public CurtainMode {
public:
CurtainModeWin();
virtual bool Activate() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(CurtainModeWin);
};
CurtainModeWin::CurtainModeWin() {
}
bool CurtainModeWin::Activate() {
if (base::win::GetVersion() < base::win::VERSION_VISTA) {
LOG(ERROR) << "Curtain mode is not supported on Windows XP/2003";
return false;
}
DWORD session_id;
if (!ProcessIdToSessionId(GetCurrentProcessId(), &session_id)) {
LOG_GETLASTERROR(ERROR) << "Failed to map the current PID to session ID";
return false;
}
return WTSGetActiveConsoleSessionId() != session_id;
}
scoped_ptr<CurtainMode> CurtainMode::Create(
scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
base::WeakPtr<ClientSessionControl> client_session_control) {
return scoped_ptr<CurtainMode>(new CurtainModeWin());
}
}