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 "ipc/ipc_channel.h" |
14 #include "remoting/base/scoped_thread_proxy.h" | 15 #include "remoting/base/scoped_thread_proxy.h" |
15 | 16 |
| 17 namespace IPC { |
| 18 |
| 19 class ChannelProxy; |
| 20 class Message; |
| 21 |
| 22 } // namespace IPC |
| 23 |
16 namespace remoting { | 24 namespace remoting { |
17 | 25 |
18 class Capturer; | 26 class Capturer; |
19 class ChromotingHost; | 27 class ChromotingHost; |
20 class ChromotingHostContext; | 28 class ChromotingHostContext; |
21 class EventExecutor; | 29 class EventExecutor; |
22 | 30 |
23 class DesktopEnvironment { | 31 class DesktopEnvironment : public IPC::Channel::Listener { |
24 public: | 32 public: |
25 static DesktopEnvironment* Create(ChromotingHostContext* context); | 33 // Creates DesktopEnvironment along with the capturer and event executor. |
| 34 // |context| is assumed to be owned by the ChromotingHost. |
| 35 static scoped_ptr<DesktopEnvironment> Create(ChromotingHostContext* context); |
26 | 36 |
27 // DesktopEnvironment takes ownership of all the objects passed in. | 37 // Creates DesktopEnvironment using the passed |capturer| and |event_executor| |
28 DesktopEnvironment(ChromotingHostContext* context, | 38 // taking their ownership. |context| is assumed to be owned by |
29 Capturer* capturer, | 39 // the ChromotingHost. |
30 EventExecutor* event_executor); | 40 static scoped_ptr<DesktopEnvironment> CreateFake( |
| 41 ChromotingHostContext* context, |
| 42 Capturer* capturer, |
| 43 EventExecutor* event_executor); |
| 44 |
31 virtual ~DesktopEnvironment(); | 45 virtual ~DesktopEnvironment(); |
32 | 46 |
| 47 // IPC::Channel::Listener implementation. |
| 48 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 49 |
33 void set_host(ChromotingHost* host) { host_ = host; } | 50 void set_host(ChromotingHost* host) { host_ = host; } |
34 | 51 |
35 Capturer* capturer() const { return capturer_.get(); } | 52 Capturer* capturer() const { return capturer_.get(); } |
36 EventExecutor* event_executor() const { return event_executor_.get(); } | 53 EventExecutor* event_executor() const { return event_executor_.get(); } |
37 | 54 |
38 private: | 55 private: |
| 56 DesktopEnvironment(ChromotingHostContext* context); |
| 57 |
| 58 bool Initialize(); |
| 59 |
39 // The host that owns this DesktopEnvironment. | 60 // The host that owns this DesktopEnvironment. |
40 ChromotingHost* host_; | 61 ChromotingHost* host_; |
41 | 62 |
42 // Host context used to make sure operations are run on the correct thread. | 63 // Host context used to make sure operations are run on the correct thread. |
43 // This is owned by the ChromotingHost. | 64 // This is owned by the ChromotingHost. |
44 ChromotingHostContext* context_; | 65 ChromotingHostContext* context_; |
45 | 66 |
| 67 // IPC channel connecting the host with the chromoting service. |
| 68 scoped_ptr<IPC::ChannelProxy> chromoting_session_; |
| 69 |
46 // Capturer to be used by ScreenRecorder. | 70 // Capturer to be used by ScreenRecorder. |
47 scoped_ptr<Capturer> capturer_; | 71 scoped_ptr<Capturer> capturer_; |
48 | 72 |
49 // Executes input events received from the client. | 73 // Executes input events received from the client. |
50 scoped_ptr<EventExecutor> event_executor_; | 74 scoped_ptr<EventExecutor> event_executor_; |
51 | 75 |
52 DISALLOW_COPY_AND_ASSIGN(DesktopEnvironment); | 76 DISALLOW_COPY_AND_ASSIGN(DesktopEnvironment); |
53 }; | 77 }; |
54 | 78 |
55 } // namespace remoting | 79 } // namespace remoting |
56 | 80 |
57 #endif // REMOTING_HOST_DESKTOP_ENVIRONMENT_H_ | 81 #endif // REMOTING_HOST_DESKTOP_ENVIRONMENT_H_ |
OLD | NEW |