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

Unified Diff: remoting/host/desktop_environment.cc

Issue 10916161: Revert 155219 - [Chromoting] Refactoring DesktopEnvironment and moving screen/audio recorders to Cl… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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_environment.h ('k') | remoting/host/desktop_environment_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/desktop_environment.cc
===================================================================
--- remoting/host/desktop_environment.cc (revision 155274)
+++ remoting/host/desktop_environment.cc (working copy)
@@ -4,31 +4,99 @@
#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"
-#include "remoting/host/video_frame_capturer.h"
+#if defined(OS_WIN)
+#include "remoting/host/session_event_executor_win.h"
+#endif
+
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(
- scoped_ptr<AudioCapturer> audio_capturer,
+ ChromotingHostContext* context,
+ scoped_ptr<VideoFrameCapturer> capturer,
scoped_ptr<EventExecutor> event_executor,
- scoped_ptr<VideoFrameCapturer> video_capturer)
- : audio_capturer_(audio_capturer.Pass()),
- event_executor_(event_executor.Pass()),
- video_capturer_(video_capturer.Pass()) {
+ scoped_ptr<AudioCapturer> audio_capturer)
+ : context_(context),
+ capturer_(capturer.Pass()),
+ audio_capturer_(audio_capturer.Pass()),
+ event_executor_(event_executor.Pass()) {
}
DesktopEnvironment::~DesktopEnvironment() {
- event_executor_.release()->StopAndDelete();
}
-void DesktopEnvironment::Start(
+void DesktopEnvironment::OnSessionStarted(
scoped_ptr<protocol::ClipboardStub> client_clipboard) {
- event_executor_->Start(client_clipboard.Pass());
+ event_executor_->OnSessionStarted(client_clipboard.Pass());
}
+void DesktopEnvironment::OnSessionFinished() {
+ event_executor_->OnSessionFinished();
+}
+
} // namespace remoting
« no previous file with comments | « remoting/host/desktop_environment.h ('k') | remoting/host/desktop_environment_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698