OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef REMOTING_HOST_DESKTOP_WIN_H_ | 5 #ifndef REMOTING_HOST_WIN_DESKTOP_H_ |
6 #define REMOTING_HOST_DESKTOP_WIN_H_ | 6 #define REMOTING_HOST_WIN_DESKTOP_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 | 13 |
14 namespace remoting { | 14 namespace remoting { |
15 | 15 |
16 class DesktopWin { | 16 class Desktop { |
17 public: | 17 public: |
18 ~DesktopWin(); | 18 ~Desktop(); |
19 | 19 |
20 // Returns the name of the desktop represented by the object. Return false if | 20 // Returns the name of the desktop represented by the object. Return false if |
21 // quering the name failed for any reason. | 21 // quering the name failed for any reason. |
22 bool GetName(string16* desktop_name_out) const; | 22 bool GetName(string16* desktop_name_out) const; |
23 | 23 |
24 // Returns true if |other| has the same name as this desktop. Returns false | 24 // Returns true if |other| has the same name as this desktop. Returns false |
25 // in any other case including failing Win32 APIs and uninitialized desktop | 25 // in any other case including failing Win32 APIs and uninitialized desktop |
26 // handles. | 26 // handles. |
27 bool IsSame(const DesktopWin& other) const; | 27 bool IsSame(const Desktop& other) const; |
28 | 28 |
29 // Assigns the desktop to the current thread. Returns false is the operation | 29 // Assigns the desktop to the current thread. Returns false is the operation |
30 // failed for any reason. | 30 // failed for any reason. |
31 bool SetThreadDesktop() const; | 31 bool SetThreadDesktop() const; |
32 | 32 |
33 // Returns the desktop by its name or NULL if an error occurs. | 33 // Returns the desktop by its name or NULL if an error occurs. |
34 static scoped_ptr<DesktopWin> GetDesktop(const wchar_t* desktop_name); | 34 static scoped_ptr<Desktop> GetDesktop(const wchar_t* desktop_name); |
35 | 35 |
36 // Returns the desktop currently receiving user input or NULL if an error | 36 // Returns the desktop currently receiving user input or NULL if an error |
37 // occurs. | 37 // occurs. |
38 static scoped_ptr<DesktopWin> GetInputDesktop(); | 38 static scoped_ptr<Desktop> GetInputDesktop(); |
39 | 39 |
40 // Returns the desktop currently assigned to the calling thread or NULL if | 40 // Returns the desktop currently assigned to the calling thread or NULL if |
41 // an error occurs. | 41 // an error occurs. |
42 static scoped_ptr<DesktopWin> GetThreadDesktop(); | 42 static scoped_ptr<Desktop> GetThreadDesktop(); |
43 | 43 |
44 private: | 44 private: |
45 DesktopWin(HDESK desktop, bool own); | 45 Desktop(HDESK desktop, bool own); |
46 | 46 |
47 // The desktop handle. | 47 // The desktop handle. |
48 HDESK desktop_; | 48 HDESK desktop_; |
49 | 49 |
50 // True if |desktop_| must be closed on teardown. | 50 // True if |desktop_| must be closed on teardown. |
51 bool own_; | 51 bool own_; |
52 | 52 |
53 DISALLOW_COPY_AND_ASSIGN(DesktopWin); | 53 DISALLOW_COPY_AND_ASSIGN(Desktop); |
54 }; | 54 }; |
55 | 55 |
56 } // namespace remoting | 56 } // namespace remoting |
57 | 57 |
58 #endif // REMOTING_HOST_DESKTOP_WIN_H_ | 58 #endif // REMOTING_HOST_WIN_DESKTOP_H_ |
OLD | NEW |