Index: remoting/host/desktop_environment.cc |
diff --git a/remoting/host/desktop_environment.cc b/remoting/host/desktop_environment.cc |
index 12d3655af4f794de1f706c579feb0c9977f5909e..8807a0276eeb02fe6ed8fc6c2abe75f403311906 100644 |
--- a/remoting/host/desktop_environment.cc |
+++ b/remoting/host/desktop_environment.cc |
@@ -4,99 +4,31 @@ |
#include "remoting/host/desktop_environment.h" |
-#include "base/bind.h" |
#include "base/compiler_specific.h" |
#include "remoting/host/audio_capturer.h" |
-#include "remoting/host/video_frame_capturer.h" |
#include "remoting/host/chromoting_host_context.h" |
+#include "remoting/host/desktop_environment.h" |
#include "remoting/host/event_executor.h" |
- |
-#if defined(OS_WIN) |
-#include "remoting/host/session_event_executor_win.h" |
-#endif |
+#include "remoting/host/video_frame_capturer.h" |
namespace remoting { |
-// static |
-scoped_ptr<DesktopEnvironment> DesktopEnvironment::Create( |
- ChromotingHostContext* context) { |
- scoped_ptr<VideoFrameCapturer> capturer(VideoFrameCapturer::Create()); |
- scoped_ptr<EventExecutor> event_executor = EventExecutor::Create( |
- context->desktop_task_runner(), context->ui_task_runner()); |
- scoped_ptr<AudioCapturer> audio_capturer = AudioCapturer::Create(); |
- |
- if (capturer.get() == NULL || event_executor.get() == NULL) { |
- LOG(ERROR) << "Unable to create DesktopEnvironment"; |
- return scoped_ptr<DesktopEnvironment>(); |
- } |
- |
- return scoped_ptr<DesktopEnvironment>( |
- new DesktopEnvironment(context, |
- capturer.Pass(), |
- event_executor.Pass(), |
- audio_capturer.Pass())); |
-} |
- |
-// static |
-scoped_ptr<DesktopEnvironment> DesktopEnvironment::CreateForService( |
- ChromotingHostContext* context) { |
- scoped_ptr<VideoFrameCapturer> capturer(VideoFrameCapturer::Create()); |
- scoped_ptr<EventExecutor> event_executor = EventExecutor::Create( |
- context->desktop_task_runner(), context->ui_task_runner()); |
- scoped_ptr<AudioCapturer> audio_capturer = AudioCapturer::Create(); |
- |
- if (capturer.get() == NULL || event_executor.get() == NULL) { |
- LOG(ERROR) << "Unable to create DesktopEnvironment"; |
- return scoped_ptr<DesktopEnvironment>(); |
- } |
- |
-#if defined(OS_WIN) |
- event_executor.reset(new SessionEventExecutorWin( |
- context->desktop_task_runner(), |
- event_executor.Pass())); |
-#endif |
- |
- return scoped_ptr<DesktopEnvironment>( |
- new DesktopEnvironment(context, |
- capturer.Pass(), |
- event_executor.Pass(), |
- audio_capturer.Pass())); |
-} |
- |
-// static |
-scoped_ptr<DesktopEnvironment> DesktopEnvironment::CreateFake( |
- ChromotingHostContext* context, |
- scoped_ptr<VideoFrameCapturer> capturer, |
- scoped_ptr<EventExecutor> event_executor, |
- scoped_ptr<AudioCapturer> audio_capturer) { |
- return scoped_ptr<DesktopEnvironment>( |
- new DesktopEnvironment(context, |
- capturer.Pass(), |
- event_executor.Pass(), |
- audio_capturer.Pass())); |
-} |
- |
DesktopEnvironment::DesktopEnvironment( |
- ChromotingHostContext* context, |
- scoped_ptr<VideoFrameCapturer> capturer, |
+ scoped_ptr<AudioCapturer> audio_capturer, |
scoped_ptr<EventExecutor> event_executor, |
- scoped_ptr<AudioCapturer> audio_capturer) |
- : context_(context), |
- capturer_(capturer.Pass()), |
- audio_capturer_(audio_capturer.Pass()), |
- event_executor_(event_executor.Pass()) { |
+ scoped_ptr<VideoFrameCapturer> video_capturer) |
+ : audio_capturer_(audio_capturer.Pass()), |
+ event_executor_(event_executor.Pass()), |
+ video_capturer_(video_capturer.Pass()) { |
} |
DesktopEnvironment::~DesktopEnvironment() { |
+ event_executor_.release()->StopAndDelete(); |
} |
-void DesktopEnvironment::OnSessionStarted( |
+void DesktopEnvironment::Start( |
scoped_ptr<protocol::ClipboardStub> client_clipboard) { |
- event_executor_->OnSessionStarted(client_clipboard.Pass()); |
-} |
- |
-void DesktopEnvironment::OnSessionFinished() { |
- event_executor_->OnSessionFinished(); |
+ event_executor_->Start(client_clipboard.Pass()); |
} |
} // namespace remoting |