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_CAPTURER_WIN_SCOPED_THREAD_DESKTOP_H_ | 5 #ifndef MEDIA_VIDEO_CAPTURE_SCREEN_WIN_SCOPED_THREAD_DESKTOP_H_ |
6 #define REMOTING_CAPTURER_WIN_SCOPED_THREAD_DESKTOP_H_ | 6 #define MEDIA_VIDEO_CAPTURE_SCREEN_WIN_SCOPED_THREAD_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 "media/base/media_export.h" |
12 | 13 |
13 namespace remoting { | 14 namespace media { |
14 | 15 |
15 class Desktop; | 16 class Desktop; |
16 | 17 |
17 class ScopedThreadDesktop { | 18 class MEDIA_EXPORT ScopedThreadDesktop { |
18 public: | 19 public: |
19 ScopedThreadDesktop(); | 20 ScopedThreadDesktop(); |
20 ~ScopedThreadDesktop(); | 21 ~ScopedThreadDesktop(); |
21 | 22 |
22 // Returns true if |desktop| has the same desktop name as the currently | 23 // Returns true if |desktop| has the same desktop name as the currently |
23 // assigned desktop (if assigned) or as the initial desktop (if not assigned). | 24 // assigned desktop (if assigned) or as the initial desktop (if not assigned). |
24 // Returns false in any other case including failing Win32 APIs and | 25 // Returns false in any other case including failing Win32 APIs and |
25 // uninitialized desktop handles. | 26 // uninitialized desktop handles. |
26 bool IsSame(const Desktop& desktop); | 27 bool IsSame(const Desktop& desktop); |
27 | 28 |
28 // Reverts the calling thread to use the initial desktop. | 29 // Reverts the calling thread to use the initial desktop. |
29 void Revert(); | 30 void Revert(); |
30 | 31 |
31 // Assigns |desktop| to be the calling thread. Returns true if the thread has | 32 // Assigns |desktop| to be the calling thread. Returns true if the thread has |
32 // been switched to |desktop| successfully. | 33 // been switched to |desktop| successfully. |
33 bool SetThreadDesktop(scoped_ptr<Desktop> desktop); | 34 bool SetThreadDesktop(scoped_ptr<Desktop> desktop); |
34 | 35 |
35 private: | 36 private: |
36 // The desktop handle assigned to the calling thread by Set | 37 // The desktop handle assigned to the calling thread by Set |
37 scoped_ptr<Desktop> assigned_; | 38 scoped_ptr<Desktop> assigned_; |
38 | 39 |
39 // The desktop handle assigned to the calling thread at creation. | 40 // The desktop handle assigned to the calling thread at creation. |
40 scoped_ptr<Desktop> initial_; | 41 scoped_ptr<Desktop> initial_; |
41 | 42 |
42 DISALLOW_COPY_AND_ASSIGN(ScopedThreadDesktop); | 43 DISALLOW_COPY_AND_ASSIGN(ScopedThreadDesktop); |
43 }; | 44 }; |
44 | 45 |
45 } // namespace remoting | 46 } // namespace media |
46 | 47 |
47 #endif // REMOTING_CAPTURER_WIN_SCOPED_THREAD_DESKTOP_H_ | 48 #endif // MEDIA_VIDEO_CAPTURE_SCREEN_WIN_SCOPED_THREAD_DESKTOP_H_ |
OLD | NEW |