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