summaryrefslogtreecommitdiffstats
path: root/remoting/host/scoped_thread_desktop_win.h
diff options
context:
space:
mode:
authoralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-17 20:03:57 +0000
committeralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-17 20:03:57 +0000
commit5ae4da131e324fcabcbf1afb5fd7e5b33f09c6ad (patch)
tree52e3604974e1e0f0e960387b280b512dfba56178 /remoting/host/scoped_thread_desktop_win.h
parentd88d4b32caf3ec57c5ea70c5fb5551ee5de1b4c9 (diff)
downloadchromium_src-5ae4da131e324fcabcbf1afb5fd7e5b33f09c6ad.zip
chromium_src-5ae4da131e324fcabcbf1afb5fd7e5b33f09c6ad.tar.gz
chromium_src-5ae4da131e324fcabcbf1afb5fd7e5b33f09c6ad.tar.bz2
Chromoting: the screen capturer and event executors now always try to work with the the current input desktop (i.e. they switch to the new input desktop if it is different then the last time).
Review URL: http://codereview.chromium.org/9706003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127373 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/scoped_thread_desktop_win.h')
-rw-r--r--remoting/host/scoped_thread_desktop_win.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/remoting/host/scoped_thread_desktop_win.h b/remoting/host/scoped_thread_desktop_win.h
new file mode 100644
index 0000000..85354df
--- /dev/null
+++ b/remoting/host/scoped_thread_desktop_win.h
@@ -0,0 +1,47 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_HOST_SCOPED_THREAD_DESKTOP_WIN_H_
+#define REMOTING_HOST_SCOPED_THREAD_DESKTOP_WIN_H_
+
+#include <windows.h>
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+
+namespace remoting {
+
+class DesktopWin;
+
+class ScopedThreadDesktopWin {
+ public:
+ ScopedThreadDesktopWin();
+ ~ScopedThreadDesktopWin();
+
+ // Returns true if |desktop| has the same desktop name as the currently
+ // assigned desktop (if assigned) or as the initial desktop (if not assigned).
+ // Returns false in any other case including failing Win32 APIs and
+ // uninitialized desktop handles.
+ bool IsSame(const DesktopWin& desktop);
+
+ // Reverts the calling thread to use the initial desktop.
+ void Revert();
+
+ // Assigns |desktop| to be the calling thread. Returns true if the thread has
+ // been switched to |desktop| successfully.
+ bool SetThreadDesktop(scoped_ptr<DesktopWin> desktop);
+
+ private:
+ // The desktop handle assigned to the calling thread by Set
+ scoped_ptr<DesktopWin> assigned_;
+
+ // The desktop handle assigned to the calling thread at creation.
+ scoped_ptr<DesktopWin> initial_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedThreadDesktopWin);
+};
+
+} // namespace remoting
+
+#endif // REMOTING_HOST_SCOPED_THREAD_DESKTOP_WIN_H_