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

Unified Diff: remoting/host/desktop_session_agent.cc

Issue 12087073: Pass a DesktopEnvironmentFactory when creating DesktopProcess. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased. fixed posix. Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/desktop_session_agent.h ('k') | remoting/host/desktop_session_agent_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/desktop_session_agent.cc
diff --git a/remoting/host/desktop_session_agent.cc b/remoting/host/desktop_session_agent.cc
index 49d15f25c959fb7402986b6a44eb42d97e8af4d3..d3ac87f40e347458f94058982d76dd14c359d040 100644
--- a/remoting/host/desktop_session_agent.cc
+++ b/remoting/host/desktop_session_agent.cc
@@ -14,6 +14,7 @@
#include "remoting/base/util.h"
#include "remoting/host/audio_capturer.h"
#include "remoting/host/chromoting_messages.h"
+#include "remoting/host/desktop_environment.h"
#include "remoting/host/disconnect_window.h"
#include "remoting/host/event_executor.h"
#include "remoting/host/local_input_monitor.h"
@@ -176,11 +177,23 @@ void DesktopSessionAgent::OnStartSessionAgent(
const std::string& authenticated_jid) {
DCHECK(caller_task_runner()->BelongsToCurrentThread());
DCHECK(!started_);
+ DCHECK(!audio_capturer_);
+ DCHECK(!event_executor_);
+ DCHECK(!video_capturer_);
started_ = true;
+ // Create a desktop environment for the new session.
+ base::Closure disconnect_session =
+ base::Bind(&DesktopSessionAgent::DisconnectSession, this);
+ scoped_ptr<DesktopEnvironment> desktop_environment =
+ delegate_->desktop_environment_factory().Create(authenticated_jid,
+ disconnect_session);
+
// Create the event executor.
- event_executor_ = CreateEventExecutor();
+ event_executor_ =
+ desktop_environment->CreateEventExecutor(input_task_runner(),
+ caller_task_runner());
// Hook up the input filter
input_tracker_.reset(new protocol::InputEventTracker(event_executor_.get()));
@@ -191,9 +204,6 @@ void DesktopSessionAgent::OnStartSessionAgent(
new DesktopSesssionClipboardStub(this));
event_executor_->Start(clipboard_stub.Pass());
- base::Closure disconnect_session =
- base::Bind(&DesktopSessionAgent::DisconnectSession, this);
-
// Create the disconnect window.
disconnect_window_ = DisconnectWindow::Create(&ui_strings_);
disconnect_window_->Show(
@@ -205,10 +215,16 @@ void DesktopSessionAgent::OnStartSessionAgent(
local_input_monitor_->Start(this, disconnect_session);
// Start the audio capturer.
- audio_capture_task_runner()->PostTask(
- FROM_HERE, base::Bind(&DesktopSessionAgent::StartAudioCapturer, this));
+ if (delegate_->desktop_environment_factory().SupportsAudioCapture()) {
+ audio_capturer_ = desktop_environment->CreateAudioCapturer(
+ audio_capture_task_runner());
+ audio_capture_task_runner()->PostTask(
+ FROM_HERE, base::Bind(&DesktopSessionAgent::StartAudioCapturer, this));
+ }
// Start the video capturer.
+ video_capturer_ = desktop_environment->CreateVideoCapturer(
+ video_capture_task_runner(), caller_task_runner());
video_capture_task_runner()->PostTask(
FROM_HERE, base::Bind(&DesktopSessionAgent::StartVideoCapturer, this));
}
@@ -470,7 +486,6 @@ void DesktopSessionAgent::SendToNetwork(IPC::Message* message) {
void DesktopSessionAgent::StartAudioCapturer() {
DCHECK(audio_capture_task_runner()->BelongsToCurrentThread());
- audio_capturer_ = AudioCapturer::Create();
if (audio_capturer_) {
audio_capturer_->Start(base::Bind(&DesktopSessionAgent::ProcessAudioPacket,
this));
@@ -486,7 +501,6 @@ void DesktopSessionAgent::StopAudioCapturer() {
void DesktopSessionAgent::StartVideoCapturer() {
DCHECK(video_capture_task_runner()->BelongsToCurrentThread());
- video_capturer_ = media::ScreenCapturer::Create();
if (video_capturer_)
video_capturer_->Start(this);
}
« no previous file with comments | « remoting/host/desktop_session_agent.h ('k') | remoting/host/desktop_session_agent_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698