| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef REMOTING_HOST_DESKTOP_ENVIRONMENT_H_ | 5 #ifndef REMOTING_HOST_DESKTOP_ENVIRONMENT_H_ |
| 6 #define REMOTING_HOST_DESKTOP_ENVIRONMENT_H_ | 6 #define REMOTING_HOST_DESKTOP_ENVIRONMENT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/time.h" | 13 #include "base/time.h" |
| 14 #include "remoting/base/scoped_thread_proxy.h" | 14 #include "remoting/base/scoped_thread_proxy.h" |
| 15 | 15 |
| 16 namespace remoting { | 16 namespace remoting { |
| 17 | 17 |
| 18 class Capturer; | 18 class Capturer; |
| 19 class ChromotingHost; | 19 class ChromotingHost; |
| 20 class ChromotingHostContext; | 20 class ChromotingHostContext; |
| 21 class EventExecutor; | 21 |
| 22 namespace protocol { |
| 23 class InputStub; |
| 24 }; |
| 22 | 25 |
| 23 class DesktopEnvironment { | 26 class DesktopEnvironment { |
| 24 public: | 27 public: |
| 25 static DesktopEnvironment* Create(ChromotingHostContext* context); | 28 static scoped_ptr<DesktopEnvironment> Create(ChromotingHostContext* context); |
| 29 static scoped_ptr<DesktopEnvironment> CreateFake( |
| 30 ChromotingHostContext* context, |
| 31 scoped_ptr<Capturer> capturer, |
| 32 scoped_ptr<protocol::InputStub> event_executor); |
| 26 | 33 |
| 27 // DesktopEnvironment takes ownership of all the objects passed in. | |
| 28 DesktopEnvironment(ChromotingHostContext* context, | |
| 29 Capturer* capturer, | |
| 30 EventExecutor* event_executor); | |
| 31 virtual ~DesktopEnvironment(); | 34 virtual ~DesktopEnvironment(); |
| 32 | 35 |
| 33 void set_host(ChromotingHost* host) { host_ = host; } | 36 void set_host(ChromotingHost* host) { host_ = host; } |
| 34 | 37 |
| 35 Capturer* capturer() const { return capturer_.get(); } | 38 Capturer* capturer() const { return capturer_.get(); } |
| 36 EventExecutor* event_executor() const { return event_executor_.get(); } | 39 protocol::InputStub* event_executor() const { return event_executor_.get(); } |
| 37 | 40 |
| 38 private: | 41 private: |
| 42 DesktopEnvironment(ChromotingHostContext* context, |
| 43 scoped_ptr<Capturer> capturer, |
| 44 scoped_ptr<protocol::InputStub> event_executor); |
| 45 |
| 39 // The host that owns this DesktopEnvironment. | 46 // The host that owns this DesktopEnvironment. |
| 40 ChromotingHost* host_; | 47 ChromotingHost* host_; |
| 41 | 48 |
| 42 // Host context used to make sure operations are run on the correct thread. | 49 // Host context used to make sure operations are run on the correct thread. |
| 43 // This is owned by the ChromotingHost. | 50 // This is owned by the ChromotingHost. |
| 44 ChromotingHostContext* context_; | 51 ChromotingHostContext* context_; |
| 45 | 52 |
| 46 // Capturer to be used by ScreenRecorder. | 53 // Capturer to be used by ScreenRecorder. |
| 47 scoped_ptr<Capturer> capturer_; | 54 scoped_ptr<Capturer> capturer_; |
| 48 | 55 |
| 49 // Executes input events received from the client. | 56 // Executes input events received from the client. |
| 50 scoped_ptr<EventExecutor> event_executor_; | 57 scoped_ptr<protocol::InputStub> event_executor_; |
| 51 | 58 |
| 52 DISALLOW_COPY_AND_ASSIGN(DesktopEnvironment); | 59 DISALLOW_COPY_AND_ASSIGN(DesktopEnvironment); |
| 53 }; | 60 }; |
| 54 | 61 |
| 55 } // namespace remoting | 62 } // namespace remoting |
| 56 | 63 |
| 57 #endif // REMOTING_HOST_DESKTOP_ENVIRONMENT_H_ | 64 #endif // REMOTING_HOST_DESKTOP_ENVIRONMENT_H_ |
| OLD | NEW |