Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: remoting/host/win/scoped_thread_desktop.cc

Issue 11470028: Move screen capturers to remoting/capturer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 #include "remoting/host/win/scoped_thread_desktop.h"
6
7 #include "base/logging.h"
8
9 #include "remoting/host/win/desktop.h"
10
11 namespace remoting {
12
13 ScopedThreadDesktop::ScopedThreadDesktop()
14 : initial_(Desktop::GetThreadDesktop()) {
15 }
16
17 ScopedThreadDesktop::~ScopedThreadDesktop() {
18 Revert();
19 }
20
21 bool ScopedThreadDesktop::IsSame(const Desktop& desktop) {
22 if (assigned_.get() != NULL) {
23 return assigned_->IsSame(desktop);
24 } else {
25 return initial_->IsSame(desktop);
26 }
27 }
28
29 void ScopedThreadDesktop::Revert() {
30 if (assigned_.get() != NULL) {
31 initial_->SetThreadDesktop();
32 assigned_.reset();
33 }
34 }
35
36 bool ScopedThreadDesktop::SetThreadDesktop(scoped_ptr<Desktop> desktop) {
37 Revert();
38
39 if (initial_->IsSame(*desktop))
40 return true;
41
42 if (!desktop->SetThreadDesktop())
43 return false;
44
45 assigned_ = desktop.Pass();
46 return true;
47 }
48
49 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/win/scoped_thread_desktop.h ('k') | remoting/host/win/session_desktop_environment_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698