| Index: remoting/host/it2me_host_user_interface.h
|
| diff --git a/remoting/host/desktop_environment.h b/remoting/host/it2me_host_user_interface.h
|
| similarity index 52%
|
| copy from remoting/host/desktop_environment.h
|
| copy to remoting/host/it2me_host_user_interface.h
|
| index 28da047e1f227931e2598eb3284cd55ca3763aaf..11d39d69306f8b03f4a0e52283dd467a19e1464d 100644
|
| --- a/remoting/host/desktop_environment.h
|
| +++ b/remoting/host/it2me_host_user_interface.h
|
| @@ -2,64 +2,74 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef REMOTING_HOST_DESKTOP_ENVIRONMENT_H_
|
| -#define REMOTING_HOST_DESKTOP_ENVIRONMENT_H_
|
| +#ifndef REMOTING_HOST_IT2ME_HOST_USER_INTERFACE_H_
|
| +#define REMOTING_HOST_IT2ME_HOST_USER_INTERFACE_H_
|
|
|
| #include <string>
|
|
|
| #include "base/basictypes.h"
|
| -#include "base/memory/ref_counted.h"
|
| +#include "base/compiler_specific.h"
|
| #include "base/memory/scoped_ptr.h"
|
| -#include "base/time.h"
|
| +
|
| #include "remoting/base/scoped_thread_proxy.h"
|
| +#include "remoting/host/host_status_observer.h"
|
| +
|
| +// Milliseconds before the continue window is shown.
|
| +static const int kContinueWindowShowTimeoutMs = 10 * 60 * 1000;
|
| +
|
| +// Milliseconds before the continue window is automatically dismissed and
|
| +// the connection is closed.
|
| +static const int kContinueWindowHideTimeoutMs = 60 * 1000;
|
|
|
| namespace remoting {
|
|
|
| -class Capturer;
|
| class ChromotingHost;
|
| class ChromotingHostContext;
|
| class ContinueWindow;
|
| -class Curtain;
|
| class DisconnectWindow;
|
| -class EventExecutor;
|
| class LocalInputMonitor;
|
| +class SignalStrategy;
|
|
|
| -class DesktopEnvironment {
|
| +// This class implements the IT2Me-specific parts of the ChromotingHost:
|
| +// Disconnect and Continue window popups.
|
| +// IT2Me-specific handling of multiple connection attempts.
|
| +class It2MeHostUserInterface : public HostStatusObserver {
|
| public:
|
| - static DesktopEnvironment* Create(ChromotingHostContext* context);
|
| -
|
| - // DesktopEnvironment takes ownership of all the objects passed in.
|
| - DesktopEnvironment(ChromotingHostContext* context,
|
| - Capturer* capturer,
|
| - EventExecutor* event_executor,
|
| - Curtain* curtain,
|
| - DisconnectWindow* disconnect_window,
|
| - ContinueWindow* continue_window,
|
| - LocalInputMonitor* monitor);
|
| - virtual ~DesktopEnvironment();
|
| + It2MeHostUserInterface(ChromotingHost* host, ChromotingHostContext* context);
|
| + virtual ~It2MeHostUserInterface();
|
| +
|
| + void Init();
|
| +
|
| + // HostStatusObserver implementation. These methods will be called from the
|
| + // network thread.
|
| + virtual void OnSignallingConnected(SignalStrategy* signal_strategy,
|
| + const std::string& full_jid) OVERRIDE;
|
| + virtual void OnSignallingDisconnected() OVERRIDE;
|
| + virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE;
|
| + virtual void OnClientDisconnected(const std::string& jid) OVERRIDE;
|
| + virtual void OnAccessDenied() OVERRIDE;
|
| + virtual void OnShutdown() OVERRIDE;
|
|
|
| // Shuts down the object and all its resources synchronously. Must
|
| // be called on the UI thread.
|
| void Shutdown();
|
|
|
| - void set_host(ChromotingHost* host) { host_ = host; }
|
| + private:
|
| + class TimerTask;
|
|
|
| - Capturer* capturer() const { return capturer_.get(); }
|
| - EventExecutor* event_executor() const { return event_executor_.get(); }
|
| - Curtain* curtain() const { return curtain_.get(); }
|
| + // Allow ChromotingHostTest::SetUp() to call InitFrom().
|
| + friend class ChromotingHostTest;
|
|
|
| - // Called whenever a new client has connected.
|
| - void OnConnect(const std::string& username);
|
| + // Used by unit-tests as an alternative to Init() so that mock versions of
|
| + // internal objects can be used. This takes ownership of all objects passed
|
| + // in.
|
| + void InitFrom(DisconnectWindow* disconnect_window,
|
| + ContinueWindow* continue_window,
|
| + LocalInputMonitor* monitor);
|
|
|
| - // Called when the last client has disconnected.
|
| + void OnConnect(const std::string& username);
|
| void OnLastDisconnect();
|
|
|
| - // Called when the remote connection has been paused/unpaused.
|
| - void OnPause(bool pause);
|
| -
|
| - private:
|
| - class TimerTask;
|
| -
|
| void ProcessOnConnect(const std::string& username);
|
| void ProcessOnLastDisconnect();
|
|
|
| @@ -74,8 +84,6 @@ class DesktopEnvironment {
|
|
|
| // Called by the ContinueWindow implementation (on the UI thread) when the
|
| // user dismisses the Continue prompt.
|
| - // TODO(lambroslambrou): Move this method to the (to be written)
|
| - // It2MeObserver class.
|
| void ContinueSession(bool continue_session);
|
|
|
| void StartContinueWindowTimer(bool start);
|
| @@ -83,22 +91,12 @@ class DesktopEnvironment {
|
| void OnContinueWindowTimer();
|
| void OnShutdownHostTimer();
|
|
|
| - // 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_;
|
| -
|
| - // Executes input events received from the client.
|
| - scoped_ptr<EventExecutor> event_executor_;
|
| -
|
| - // Curtain ensures privacy for the remote user.
|
| - scoped_ptr<Curtain> curtain_;
|
| -
|
| // Provide a user interface allowing the host user to close the connection.
|
| scoped_ptr<DisconnectWindow> disconnect_window_;
|
|
|
| @@ -117,9 +115,13 @@ class DesktopEnvironment {
|
|
|
| ScopedThreadProxy ui_thread_proxy_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(DesktopEnvironment);
|
| + // The JID of the currently-authenticated user (or an empty string if no user
|
| + // is connected).
|
| + std::string authenticated_jid_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(It2MeHostUserInterface);
|
| };
|
|
|
| } // namespace remoting
|
|
|
| -#endif // REMOTING_HOST_DESKTOP_ENVIRONMENT_H_
|
| +#endif // REMOTING_HOST_IT2ME_HOST_USER_INTERFACE_H_
|
|
|