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

Side by Side Diff: remoting/host/basic_desktop_environment.cc

Issue 13461029: The continue window is owned by the desktop environment now. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 8 months 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
« no previous file with comments | « remoting/host/basic_desktop_environment.h ('k') | remoting/host/chromoting_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "remoting/host/basic_desktop_environment.h" 5 #include "remoting/host/basic_desktop_environment.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "media/video/capture/screen/screen_capturer.h" 10 #include "media/video/capture/screen/screen_capturer.h"
11 #include "remoting/host/audio_capturer.h" 11 #include "remoting/host/audio_capturer.h"
12 #include "remoting/host/client_session_control.h" 12 #include "remoting/host/client_session_control.h"
13 #include "remoting/host/host_window.h"
14 #include "remoting/host/host_window_proxy.h"
15 #include "remoting/host/input_injector.h" 13 #include "remoting/host/input_injector.h"
16 #include "remoting/host/local_input_monitor.h"
17 #include "remoting/host/screen_controls.h" 14 #include "remoting/host/screen_controls.h"
18 #include "remoting/host/ui_strings.h"
19
20 #if defined(OS_POSIX)
21 #include <sys/types.h>
22 #include <unistd.h>
23 #endif // defined(OS_POSIX)
24 15
25 namespace remoting { 16 namespace remoting {
26 17
27 BasicDesktopEnvironment::~BasicDesktopEnvironment() { 18 BasicDesktopEnvironment::~BasicDesktopEnvironment() {
28 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 19 DCHECK(caller_task_runner_->BelongsToCurrentThread());
29 } 20 }
30 21
31 scoped_ptr<AudioCapturer> BasicDesktopEnvironment::CreateAudioCapturer() { 22 scoped_ptr<AudioCapturer> BasicDesktopEnvironment::CreateAudioCapturer() {
32 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 23 DCHECK(caller_task_runner_->BelongsToCurrentThread());
33 24
(...skipping 25 matching lines...) Expand all
59 50
60 // The basic desktop environment does not use X DAMAGE, since it is 51 // The basic desktop environment does not use X DAMAGE, since it is
61 // broken on many systems - see http://crbug.com/73423. 52 // broken on many systems - see http://crbug.com/73423.
62 return media::ScreenCapturer::Create(); 53 return media::ScreenCapturer::Create();
63 } 54 }
64 55
65 BasicDesktopEnvironment::BasicDesktopEnvironment( 56 BasicDesktopEnvironment::BasicDesktopEnvironment(
66 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, 57 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
67 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, 58 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
68 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, 59 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
69 const UiStrings* ui_strings) 60 base::WeakPtr<ClientSessionControl> client_session_control,
61 const UiStrings& ui_strings)
70 : caller_task_runner_(caller_task_runner), 62 : caller_task_runner_(caller_task_runner),
71 input_task_runner_(input_task_runner), 63 input_task_runner_(input_task_runner),
72 ui_task_runner_(ui_task_runner), 64 ui_task_runner_(ui_task_runner) {
73 ui_strings_(ui_strings) {
74 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 65 DCHECK(caller_task_runner_->BelongsToCurrentThread());
75 } 66 }
76 67
77 void BasicDesktopEnvironment::InitNonCurtainedSessionUI(
78 base::WeakPtr<ClientSessionControl> client_session_control) {
79 // Create the local input monitor.
80 local_input_monitor_ = LocalInputMonitor::Create(caller_task_runner_,
81 input_task_runner_,
82 ui_task_runner_,
83 client_session_control);
84
85 bool show_disconnect_window = true;
86 #if defined(OS_MACOSX)
87 // Don't try to display any UI on top of the system's login screen as this
88 // is rejected by the Window Server on OS X 10.7.4, and prevents the
89 // capturer from working (http://crbug.com/140984).
90
91 // TODO(lambroslambrou): Use a better technique of detecting whether we're
92 // running in the LoginWindow context, and refactor this into a separate
93 // function to be used here and in CurtainMode::ActivateCurtain().
94 show_disconnect_window = getuid() != 0;
95 #endif // OS_MACOSX
96
97 // Create the disconnect window.
98 if (show_disconnect_window) {
99 disconnect_window_ = HostWindow::CreateDisconnectWindow(*ui_strings_);
100 disconnect_window_.reset(new HostWindowProxy(
101 caller_task_runner_,
102 ui_task_runner_,
103 disconnect_window_.Pass()));
104 disconnect_window_->Start(client_session_control);
105 }
106 }
107
108 BasicDesktopEnvironmentFactory::BasicDesktopEnvironmentFactory( 68 BasicDesktopEnvironmentFactory::BasicDesktopEnvironmentFactory(
109 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, 69 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
110 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, 70 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
111 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, 71 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
112 const UiStrings& ui_strings) 72 const UiStrings& ui_strings)
113 : caller_task_runner_(caller_task_runner), 73 : caller_task_runner_(caller_task_runner),
114 input_task_runner_(input_task_runner), 74 input_task_runner_(input_task_runner),
115 ui_task_runner_(ui_task_runner), 75 ui_task_runner_(ui_task_runner),
116 ui_strings_(ui_strings) { 76 ui_strings_(ui_strings) {
117 } 77 }
118 78
119 BasicDesktopEnvironmentFactory::~BasicDesktopEnvironmentFactory() { 79 BasicDesktopEnvironmentFactory::~BasicDesktopEnvironmentFactory() {
120 } 80 }
121 81
122 scoped_ptr<DesktopEnvironment> BasicDesktopEnvironmentFactory::Create( 82 scoped_ptr<DesktopEnvironment> BasicDesktopEnvironmentFactory::Create(
123 base::WeakPtr<ClientSessionControl> client_session_control) { 83 base::WeakPtr<ClientSessionControl> client_session_control) {
124 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 84 DCHECK(caller_task_runner_->BelongsToCurrentThread());
125 85
126 scoped_ptr<BasicDesktopEnvironment> result( 86 return scoped_ptr<DesktopEnvironment>(
127 new BasicDesktopEnvironment(caller_task_runner(), 87 new BasicDesktopEnvironment(caller_task_runner(),
128 input_task_runner(), 88 input_task_runner(),
129 ui_task_runner(), 89 ui_task_runner(),
130 &ui_strings_)); 90 client_session_control,
131 result->InitNonCurtainedSessionUI(client_session_control); 91 ui_strings_));
132
133 return result.PassAs<DesktopEnvironment>();
134 } 92 }
135 93
136 bool BasicDesktopEnvironmentFactory::SupportsAudioCapture() const { 94 bool BasicDesktopEnvironmentFactory::SupportsAudioCapture() const {
137 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 95 DCHECK(caller_task_runner_->BelongsToCurrentThread());
138 96
139 return AudioCapturer::IsSupported(); 97 return AudioCapturer::IsSupported();
140 } 98 }
141 99
142 } // namespace remoting 100 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/basic_desktop_environment.h ('k') | remoting/host/chromoting_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698