summaryrefslogtreecommitdiffstats
path: root/remoting/host/desktop_environment.h
diff options
context:
space:
mode:
authorgarykac@chromium.org <garykac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-07 21:57:11 +0000
committergarykac@chromium.org <garykac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-07 21:57:11 +0000
commit49c4757170b6044fb1c8ce04486ec8aef6f886ce (patch)
tree370f04031684839f781047a066c6e8cec7f898a6 /remoting/host/desktop_environment.h
parentde7f196e24457073ca674752e62423c0083ecd74 (diff)
downloadchromium_src-49c4757170b6044fb1c8ce04486ec8aef6f886ce.zip
chromium_src-49c4757170b6044fb1c8ce04486ec8aef6f886ce.tar.gz
chromium_src-49c4757170b6044fb1c8ce04486ec8aef6f886ce.tar.bz2
Chromoting: Move host input and window mgmt into DesktopEnvironment
Hide details of window management and continue timers in the DesktopEnvironment class and expose OnConnect, OnLastDisconnect and OnPause methods. Move all host input monitor code into DesktopEnvironment as well. BUG=none TEST=none Review URL: http://codereview.chromium.org/7312019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91764 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/desktop_environment.h')
-rw-r--r--remoting/host/desktop_environment.h60
1 files changed, 53 insertions, 7 deletions
diff --git a/remoting/host/desktop_environment.h b/remoting/host/desktop_environment.h
index b029a2a..0f473e3 100644
--- a/remoting/host/desktop_environment.h
+++ b/remoting/host/desktop_environment.h
@@ -5,12 +5,18 @@
#ifndef REMOTING_HOST_DESKTOP_ENVIRONMENT_H_
#define REMOTING_HOST_DESKTOP_ENVIRONMENT_H_
+#include <string>
+
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
+#include "base/threading/thread.h"
+#include "base/timer.h"
namespace remoting {
class Capturer;
+class ChromotingHost;
+class ChromotingHostContext;
class ContinueWindow;
class Curtain;
class DisconnectWindow;
@@ -19,23 +25,54 @@ class LocalInputMonitor;
class DesktopEnvironment {
public:
+ static DesktopEnvironment* Create(ChromotingHostContext* context);
+
// DesktopEnvironment takes ownership of all the objects passed the ctor.
- DesktopEnvironment(Capturer* capturer, EventExecutor* event_executor,
- Curtain* curtain, DisconnectWindow* disconnect_window,
+ DesktopEnvironment(ChromotingHostContext* context,
+ Capturer* capturer,
+ EventExecutor* event_executor,
+ Curtain* curtain,
+ DisconnectWindow* disconnect_window,
ContinueWindow* continue_window,
LocalInputMonitor* monitor);
virtual ~DesktopEnvironment();
+ void set_host(ChromotingHost* host) { host_ = host; }
+
Capturer* capturer() const { return capturer_.get(); }
EventExecutor* event_executor() const { return event_executor_.get(); }
Curtain* curtain() const { return curtain_.get(); }
- DisconnectWindow* disconnect_window() { return disconnect_window_.get(); }
- ContinueWindow* continue_window() { return continue_window_.get(); }
- LocalInputMonitor* local_input_monitor() {
- return local_input_monitor_.get();
- }
+
+ // Called whenever a new client has connected.
+ void OnConnect(const std::string& username);
+
+ // Called when the last client has disconnected.
+ void OnLastDisconnect();
+
+ // Called when the remote connection has been paused/unpaused.
+ void OnPause(bool pause);
private:
+ void MonitorLocalInputs(bool enable);
+
+ // Show or hide the Disconnect window on the UI thread. If |show| is false,
+ // hide the window, ignoring the |username| parameter.
+ void ShowDisconnectWindow(bool show, const std::string& username);
+
+ // Show or hide the Continue Sharing window on the UI thread.
+ void ShowContinueWindow(bool show);
+
+ void StartContinueWindowTimer(bool start);
+
+ void ContinueWindowTimerFunc();
+
+ // The host that owns this DesktopEnvironment.
+ ChromotingHost* host_;
+
+ // Host context used to make sure operations are run on the correct thread.
+ // This is owned by the ChromotingHost.
+ ChromotingHostContext* context_;
+
// Capturer to be used by ScreenRecorder.
scoped_ptr<Capturer> capturer_;
@@ -56,9 +93,18 @@ class DesktopEnvironment {
// user is trying to do something.
scoped_ptr<LocalInputMonitor> local_input_monitor_;
+ bool is_monitoring_local_inputs_;
+
+ // Timer controlling the "continue session" dialog. The timer is started when
+ // a connection is made or re-confirmed. On expiry, inputs to the host are
+ // blocked and the dialog is shown.
+ base::OneShotTimer<DesktopEnvironment> continue_window_timer_;
+
DISALLOW_COPY_AND_ASSIGN(DesktopEnvironment);
};
} // namespace remoting
+DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::DesktopEnvironment);
+
#endif // REMOTING_HOST_DESKTOP_ENVIRONMENT_H_