OLD | NEW |
| (Empty) |
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 #ifndef REMOTING_CAPTURER_WIN_DESKTOP_H_ | |
6 #define REMOTING_CAPTURER_WIN_DESKTOP_H_ | |
7 | |
8 #include <windows.h> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "base/string16.h" | |
13 | |
14 namespace remoting { | |
15 | |
16 class Desktop { | |
17 public: | |
18 ~Desktop(); | |
19 | |
20 // Returns the name of the desktop represented by the object. Return false if | |
21 // quering the name failed for any reason. | |
22 bool GetName(string16* desktop_name_out) const; | |
23 | |
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 | |
26 // handles. | |
27 bool IsSame(const Desktop& other) const; | |
28 | |
29 // Assigns the desktop to the current thread. Returns false is the operation | |
30 // failed for any reason. | |
31 bool SetThreadDesktop() const; | |
32 | |
33 // Returns the desktop by its name or NULL if an error occurs. | |
34 static scoped_ptr<Desktop> GetDesktop(const wchar_t* desktop_name); | |
35 | |
36 // Returns the desktop currently receiving user input or NULL if an error | |
37 // occurs. | |
38 static scoped_ptr<Desktop> GetInputDesktop(); | |
39 | |
40 // Returns the desktop currently assigned to the calling thread or NULL if | |
41 // an error occurs. | |
42 static scoped_ptr<Desktop> GetThreadDesktop(); | |
43 | |
44 private: | |
45 Desktop(HDESK desktop, bool own); | |
46 | |
47 // The desktop handle. | |
48 HDESK desktop_; | |
49 | |
50 // True if |desktop_| must be closed on teardown. | |
51 bool own_; | |
52 | |
53 DISALLOW_COPY_AND_ASSIGN(Desktop); | |
54 }; | |
55 | |
56 } // namespace remoting | |
57 | |
58 #endif // REMOTING_CAPTURER_WIN_DESKTOP_H_ | |
OLD | NEW |