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

Side by Side Diff: remoting/host/desktop_environment.h

Issue 8725016: Refactor IT2Me-specific functions into a HostObserver subclass. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unused header Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 ContinueWindow;
22 class Curtain; 21 class Curtain;
23 class DisconnectWindow;
24 class EventExecutor; 22 class EventExecutor;
25 class LocalInputMonitor;
26 23
27 class DesktopEnvironment { 24 class DesktopEnvironment {
28 public: 25 public:
29 static DesktopEnvironment* Create(ChromotingHostContext* context); 26 static DesktopEnvironment* Create(ChromotingHostContext* context);
30 27
31 // DesktopEnvironment takes ownership of all the objects passed in. 28 // DesktopEnvironment takes ownership of all the objects passed in.
32 DesktopEnvironment(ChromotingHostContext* context, 29 DesktopEnvironment(ChromotingHostContext* context,
33 Capturer* capturer, 30 Capturer* capturer,
34 EventExecutor* event_executor, 31 EventExecutor* event_executor,
35 Curtain* curtain, 32 Curtain* curtain);
36 DisconnectWindow* disconnect_window,
37 ContinueWindow* continue_window,
38 LocalInputMonitor* monitor);
39 virtual ~DesktopEnvironment(); 33 virtual ~DesktopEnvironment();
40 34
41 // Shuts down the object and all its resources synchronously. Must
42 // be called on the UI thread.
43 void Shutdown();
44
45 void set_host(ChromotingHost* host) { host_ = host; } 35 void set_host(ChromotingHost* host) { host_ = host; }
46 36
47 Capturer* capturer() const { return capturer_.get(); } 37 Capturer* capturer() const { return capturer_.get(); }
48 EventExecutor* event_executor() const { return event_executor_.get(); } 38 EventExecutor* event_executor() const { return event_executor_.get(); }
49 Curtain* curtain() const { return curtain_.get(); } 39 Curtain* curtain() const { return curtain_.get(); }
Sergey Ulanov 2011/11/29 20:18:00 Do we want curtain to be part of DesktopEnvironmen
Lambros 2011/11/30 20:47:02 Will eventually move to a Me2Me-specific HostObser
50 40
51 // Called whenever a new client has connected.
52 void OnConnect(const std::string& username);
53
54 // Called when the last client has disconnected.
55 void OnLastDisconnect();
56
57 // Called when the remote connection has been paused/unpaused.
58 void OnPause(bool pause);
59
60 private: 41 private:
61 class TimerTask;
62
63 void ProcessOnConnect(const std::string& username);
64 void ProcessOnLastDisconnect();
65
66 void MonitorLocalInputs(bool enable);
67
68 // Show or hide the Disconnect window on the UI thread. If |show| is false,
69 // hide the window, ignoring the |username| parameter.
70 void ShowDisconnectWindow(bool show, const std::string& username);
71
72 // Show or hide the Continue Sharing window on the UI thread.
73 void ShowContinueWindow(bool show);
74
75 // Called by the ContinueWindow implementation (on the UI thread) when the
76 // user dismisses the Continue prompt.
77 // TODO(lambroslambrou): Move this method to the (to be written)
78 // It2MeObserver class.
79 void ContinueSession(bool continue_session);
80
81 void StartContinueWindowTimer(bool start);
82
83 void OnContinueWindowTimer();
84 void OnShutdownHostTimer();
85
86 // The host that owns this DesktopEnvironment. 42 // The host that owns this DesktopEnvironment.
87 ChromotingHost* host_; 43 ChromotingHost* host_;
88 44
89 // Host context used to make sure operations are run on the correct thread. 45 // Host context used to make sure operations are run on the correct thread.
90 // This is owned by the ChromotingHost. 46 // This is owned by the ChromotingHost.
91 ChromotingHostContext* context_; 47 ChromotingHostContext* context_;
92 48
93 // Capturer to be used by ScreenRecorder. 49 // Capturer to be used by ScreenRecorder.
94 scoped_ptr<Capturer> capturer_; 50 scoped_ptr<Capturer> capturer_;
95 51
96 // Executes input events received from the client. 52 // Executes input events received from the client.
97 scoped_ptr<EventExecutor> event_executor_; 53 scoped_ptr<EventExecutor> event_executor_;
98 54
99 // Curtain ensures privacy for the remote user. 55 // Curtain ensures privacy for the remote user.
100 scoped_ptr<Curtain> curtain_; 56 scoped_ptr<Curtain> curtain_;
101 57
102 // Provide a user interface allowing the host user to close the connection.
103 scoped_ptr<DisconnectWindow> disconnect_window_;
104
105 // Provide a user interface requiring the user to periodically re-confirm
106 // the connection.
107 scoped_ptr<ContinueWindow> continue_window_;
108
109 // Monitor local inputs to allow remote inputs to be blocked while the local
110 // user is trying to do something.
111 scoped_ptr<LocalInputMonitor> local_input_monitor_;
112
113 bool is_monitoring_local_inputs_;
114
115 // Timer controlling the "continue session" dialog.
116 scoped_ptr<TimerTask> timer_task_;
117
118 ScopedThreadProxy ui_thread_proxy_;
119
120 DISALLOW_COPY_AND_ASSIGN(DesktopEnvironment); 58 DISALLOW_COPY_AND_ASSIGN(DesktopEnvironment);
121 }; 59 };
122 60
123 } // namespace remoting 61 } // namespace remoting
124 62
125 #endif // REMOTING_HOST_DESKTOP_ENVIRONMENT_H_ 63 #endif // REMOTING_HOST_DESKTOP_ENVIRONMENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698