// Copyright (c) 2012 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. #ifndef REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_ #define REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_ #include #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "remoting/host/desktop_environment.h" #include "remoting/host/ui_strings.h" namespace remoting { // Used to create audio/video capturers and event executor that work with // the local console. class BasicDesktopEnvironment : public DesktopEnvironment { public: virtual ~BasicDesktopEnvironment(); // DesktopEnvironment implementation. virtual scoped_ptr CreateAudioCapturer() OVERRIDE; virtual scoped_ptr CreateInputInjector() OVERRIDE; virtual scoped_ptr CreateScreenControls() OVERRIDE; virtual scoped_ptr CreateVideoCapturer() OVERRIDE; virtual std::string GetCapabilities() const OVERRIDE; virtual void SetCapabilities(const std::string& capabilities) OVERRIDE; protected: friend class BasicDesktopEnvironmentFactory; // |ui_strings| are hosted by the BasicDesktopEnvironmentFactory instance that // created |this|. |ui_strings| must outlive this object. BasicDesktopEnvironment( scoped_refptr caller_task_runner, scoped_refptr input_task_runner, scoped_refptr ui_task_runner); scoped_refptr caller_task_runner() const { return caller_task_runner_; } scoped_refptr input_task_runner() const { return input_task_runner_; } scoped_refptr ui_task_runner() const { return ui_task_runner_; } private: // Task runner on which methods of DesktopEnvironment interface should be // called. scoped_refptr caller_task_runner_; // Used to run input-related tasks. scoped_refptr input_task_runner_; // Used to run UI code. scoped_refptr ui_task_runner_; DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironment); }; // Used to create |BasicDesktopEnvironment| instances. class BasicDesktopEnvironmentFactory : public DesktopEnvironmentFactory { public: BasicDesktopEnvironmentFactory( scoped_refptr caller_task_runner, scoped_refptr input_task_runner, scoped_refptr ui_task_runner, const UiStrings& ui_strings); virtual ~BasicDesktopEnvironmentFactory(); // DesktopEnvironmentFactory implementation. virtual bool SupportsAudioCapture() const OVERRIDE; protected: scoped_refptr caller_task_runner() const { return caller_task_runner_; } scoped_refptr input_task_runner() const { return input_task_runner_; } scoped_refptr ui_task_runner() const { return ui_task_runner_; } const UiStrings& ui_strings() const { return ui_strings_; } private: // Task runner on which methods of DesktopEnvironmentFactory interface should // be called. scoped_refptr caller_task_runner_; // Used to run input-related tasks. scoped_refptr input_task_runner_; // Used to run UI code. scoped_refptr ui_task_runner_; // Contains a copy of the localized UI strings. const UiStrings ui_strings_; DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironmentFactory); }; } // namespace remoting #endif // REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_