sergeyu@chromium.org | 3d34f66 | 2013-06-04 18:51:23 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DESKTOP_H_ |
| 12 | #define WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DESKTOP_H_ |
| 13 | |
mcasas@webrtc.org | 2fa7f79 | 2014-05-21 11:07:29 +0000 | [diff] [blame] | 14 | #include <windows.h> |
henrike@webrtc.org | 88fbb2d | 2014-05-21 21:18:46 +0000 | [diff] [blame] | 15 | #include <string> |
sergeyu@chromium.org | 3d34f66 | 2013-06-04 18:51:23 +0000 | [diff] [blame] | 16 | |
Edward Lemur | c20978e | 2017-07-06 19:44:34 +0200 | [diff] [blame] | 17 | #include "webrtc/rtc_base/constructormagic.h" |
sergeyu@chromium.org | 3d34f66 | 2013-06-04 18:51:23 +0000 | [diff] [blame] | 18 | |
| 19 | namespace webrtc { |
| 20 | |
| 21 | class Desktop { |
| 22 | public: |
| 23 | ~Desktop(); |
| 24 | |
| 25 | // Returns the name of the desktop represented by the object. Return false if |
| 26 | // quering the name failed for any reason. |
| 27 | bool GetName(std::wstring* desktop_name_out) const; |
| 28 | |
| 29 | // Returns true if |other| has the same name as this desktop. Returns false |
| 30 | // in any other case including failing Win32 APIs and uninitialized desktop |
| 31 | // handles. |
| 32 | bool IsSame(const Desktop& other) const; |
| 33 | |
| 34 | // Assigns the desktop to the current thread. Returns false is the operation |
| 35 | // failed for any reason. |
| 36 | bool SetThreadDesktop() const; |
| 37 | |
| 38 | // Returns the desktop by its name or NULL if an error occurs. |
| 39 | static Desktop* GetDesktop(const wchar_t* desktop_name); |
| 40 | |
| 41 | // Returns the desktop currently receiving user input or NULL if an error |
| 42 | // occurs. |
| 43 | static Desktop* GetInputDesktop(); |
| 44 | |
| 45 | // Returns the desktop currently assigned to the calling thread or NULL if |
| 46 | // an error occurs. |
| 47 | static Desktop* GetThreadDesktop(); |
| 48 | |
| 49 | private: |
| 50 | Desktop(HDESK desktop, bool own); |
| 51 | |
| 52 | // The desktop handle. |
| 53 | HDESK desktop_; |
| 54 | |
| 55 | // True if |desktop_| must be closed on teardown. |
| 56 | bool own_; |
| 57 | |
henrikg | 3c089d7 | 2015-09-16 05:37:44 -0700 | [diff] [blame] | 58 | RTC_DISALLOW_COPY_AND_ASSIGN(Desktop); |
sergeyu@chromium.org | 3d34f66 | 2013-06-04 18:51:23 +0000 | [diff] [blame] | 59 | }; |
| 60 | |
| 61 | } // namespace webrtc |
| 62 | |
| 63 | #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DESKTOP_H_ |