- add sources.
[platform/framework/web/crosswalk.git] / src / remoting / host / win / window_station_and_desktop.cc
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.
4
5 #include "remoting/host/win/window_station_and_desktop.h"
6
7 #include <algorithm>
8
9 namespace remoting {
10
11 WindowStationAndDesktop::WindowStationAndDesktop()
12     : desktop_(NULL),
13       window_station_(NULL) {
14 }
15
16 WindowStationAndDesktop::~WindowStationAndDesktop() {
17   SetDesktop(NULL);
18   SetWindowStation(NULL);
19 }
20
21 void WindowStationAndDesktop::SetDesktop(HDESK desktop) {
22   std::swap(desktop_, desktop);
23   if (desktop)
24     CloseDesktop(desktop);
25 }
26
27 void WindowStationAndDesktop::SetWindowStation(HWINSTA window_station) {
28   std::swap(window_station_, window_station);
29   if (window_station)
30     CloseWindowStation(window_station);
31 }
32
33 void WindowStationAndDesktop::Swap(WindowStationAndDesktop& other) {
34   std::swap(desktop_, other.desktop_);
35   std::swap(window_station_, other.window_station_);
36 }
37
38 }  // namespace remoting