Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / remoting / host / win / window_station_and_desktop.cc
blob1932392b8c3072408e47e67f8aaf62326ea494c6
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/win/window_station_and_desktop.h"
7 #include <algorithm>
9 namespace remoting {
11 WindowStationAndDesktop::WindowStationAndDesktop()
12 : desktop_(nullptr),
13 window_station_(nullptr) {
16 WindowStationAndDesktop::~WindowStationAndDesktop() {
17 SetDesktop(nullptr);
18 SetWindowStation(nullptr);
21 void WindowStationAndDesktop::SetDesktop(HDESK desktop) {
22 std::swap(desktop_, desktop);
23 if (desktop)
24 CloseDesktop(desktop);
27 void WindowStationAndDesktop::SetWindowStation(HWINSTA window_station) {
28 std::swap(window_station_, window_station);
29 if (window_station)
30 CloseWindowStation(window_station);
33 void WindowStationAndDesktop::Swap(WindowStationAndDesktop& other) {
34 std::swap(desktop_, other.desktop_);
35 std::swap(window_station_, other.window_station_);
38 } // namespace remoting