| Index: remoting/host/me2me_single_window_desktop_environment.cc
|
| diff --git a/remoting/host/me2me_single_window_desktop_environment.cc b/remoting/host/me2me_single_window_desktop_environment.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..dc300c175252c1eb39d400d5749ec3668f83a9a2
|
| --- /dev/null
|
| +++ b/remoting/host/me2me_single_window_desktop_environment.cc
|
| @@ -0,0 +1,97 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "remoting/host/me2me_single_window_desktop_environment.h"
|
| +
|
| +#include "base/logging.h"
|
| +#include "base/single_thread_task_runner.h"
|
| +#include "remoting/host/single_window_input_injector.h"
|
| +#include "remoting/host/window_capturer_screen_wrapper.h"
|
| +#include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h"
|
| +#include "third_party/webrtc/modules/desktop_capture/screen_capturer.h"
|
| +
|
| +namespace remoting {
|
| +
|
| +SingleWindowDesktopEnvironment::~SingleWindowDesktopEnvironment() {
|
| +}
|
| +
|
| +scoped_ptr<webrtc::ScreenCapturer>
|
| +SingleWindowDesktopEnvironment::CreateVideoCapturer() {
|
| + DCHECK(caller_task_runner()->BelongsToCurrentThread());
|
| +
|
| + // Use the default capturing options with the WindowCapturer
|
| + webrtc::DesktopCaptureOptions options =
|
| + webrtc::DesktopCaptureOptions::CreateDefault();
|
| + options.set_use_update_notifications(true);
|
| +
|
| + // Create a WindowCapturer
|
| + scoped_ptr<webrtc::WindowCapturer>window_capturer(
|
| + webrtc::WindowCapturer::Create(options));
|
| + window_capturer->SelectWindow(window_id_);
|
| +
|
| + // Wrap WindowCapturer in a ScreenCapturer interface
|
| + scoped_ptr<WindowCapturerScreenWrapper>window_capturer_wrapper(
|
| + new WindowCapturerScreenWrapper(window_capturer.Pass()));
|
| +
|
| + return window_capturer_wrapper.PassAs<webrtc::ScreenCapturer>();
|
| +}
|
| +
|
| +scoped_ptr<InputInjector>
|
| + SingleWindowDesktopEnvironment::CreateInputInjector() {
|
| + DCHECK(caller_task_runner()->BelongsToCurrentThread());
|
| +
|
| + scoped_ptr<InputInjector>input_injector(
|
| + InputInjector::Create(input_task_runner(),
|
| + ui_task_runner()));
|
| + return SingleWindowInputInjector::Create(window_id_, input_injector.Pass());
|
| + /*
|
| + return InputInjector::CreateForWindow(input_task_runner(),
|
| + ui_task_runner(),
|
| + window_id_);
|
| + */
|
| +}
|
| +
|
| +SingleWindowDesktopEnvironment::SingleWindowDesktopEnvironment(
|
| + scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
|
| + scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
|
| + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner)
|
| + : BasicDesktopEnvironment(caller_task_runner,
|
| + input_task_runner,
|
| + ui_task_runner) {
|
| +}
|
| +
|
| +void SingleWindowDesktopEnvironment::SetWindowId(
|
| + webrtc::WindowId windowIdEnvironment) {
|
| + DCHECK(caller_task_runner()->BelongsToCurrentThread());
|
| + window_id_ = windowIdEnvironment;
|
| +}
|
| +
|
| +SingleWindowDesktopEnvironmentFactory::SingleWindowDesktopEnvironmentFactory(
|
| + scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
|
| + scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
|
| + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
|
| + webrtc::WindowId windowId)
|
| + : BasicDesktopEnvironmentFactory(caller_task_runner,
|
| + input_task_runner,
|
| + ui_task_runner) {
|
| + window_id_ = windowId;
|
| +}
|
| +
|
| +SingleWindowDesktopEnvironmentFactory::
|
| + ~SingleWindowDesktopEnvironmentFactory() {
|
| +}
|
| +
|
| +scoped_ptr<DesktopEnvironment> SingleWindowDesktopEnvironmentFactory::Create(
|
| + base::WeakPtr<ClientSessionControl> client_session_control) {
|
| + DCHECK(caller_task_runner()->BelongsToCurrentThread());
|
| +
|
| + scoped_ptr<SingleWindowDesktopEnvironment> desktop_environment(
|
| + new SingleWindowDesktopEnvironment(caller_task_runner(),
|
| + input_task_runner(),
|
| + ui_task_runner()));
|
| + desktop_environment->SetWindowId(window_id_);
|
| + return desktop_environment.PassAs<DesktopEnvironment>();
|
| +}
|
| +
|
| +} // namespace remoting
|
|
|