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 #ifndef REMOTING_HOST_WIN_WINDOW_STATION_AND_DESKTOP_H_
6 #define REMOTING_HOST_WIN_WINDOW_STATION_AND_DESKTOP_H_
10 #include "base/basictypes.h"
14 // Scoper for a pair of window station and desktop handles. Both handles are
15 // closed when the object goes out of scope.
16 class WindowStationAndDesktop
{
18 WindowStationAndDesktop();
19 ~WindowStationAndDesktop();
21 HDESK
desktop() const { return desktop_
; }
22 HWINSTA
window_station() const { return window_station_
; }
24 // Sets a new desktop handle closing the owned desktop handle if needed.
25 void SetDesktop(HDESK desktop
);
27 // Sets a new window station handle closing the owned window station handle
29 void SetWindowStation(HWINSTA window_station
);
31 // Swaps contents with the other WindowStationAndDesktop.
32 void Swap(WindowStationAndDesktop
& other
);
36 HWINSTA window_station_
;
38 DISALLOW_COPY_AND_ASSIGN(WindowStationAndDesktop
);
41 } // namespace remoting
43 #endif // REMOTING_HOST_WIN_WINDOW_STATION_AND_DESKTOP_H_