Index: remoting/host/chromoting_host.h |
diff --git a/remoting/host/chromoting_host.h b/remoting/host/chromoting_host.h |
index bfd4dca4105ab96f925fc02d2bd15f95e99aba08..d755744c9d57d354df82d34165b547b2fba6ddb3 100644 |
--- a/remoting/host/chromoting_host.h |
+++ b/remoting/host/chromoting_host.h |
@@ -10,11 +10,13 @@ |
#include "base/memory/scoped_ptr.h" |
#include "base/memory/ref_counted.h" |
+#include "base/memory/weak_ptr.h" |
#include "base/observer_list.h" |
#include "base/threading/thread.h" |
#include "net/base/backoff_entry.h" |
#include "remoting/host/client_session.h" |
#include "remoting/host/host_key_pair.h" |
+#include "remoting/host/host_status_monitor.h" |
#include "remoting/host/host_status_observer.h" |
#include "remoting/host/mouse_move_observer.h" |
#include "remoting/protocol/authenticator.h" |
@@ -62,6 +64,7 @@ class DesktopEnvironmentFactory; |
class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>, |
public ClientSession::EventHandler, |
public protocol::SessionManager::Listener, |
+ public HostStatusMonitor, |
public MouseMoveObserver { |
public: |
// The caller must ensure that |signal_strategy| and |
@@ -90,10 +93,9 @@ class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>, |
// called after shutdown is completed. |
void Shutdown(const base::Closure& shutdown_task); |
- // Add/Remove |observer| to/from the list of status observers. Both |
- // methods can be called on the network thread only. |
- void AddStatusObserver(HostStatusObserver* observer); |
- void RemoveStatusObserver(HostStatusObserver* observer); |
+ // HostStatusMonitor interface. |
+ virtual void AddStatusObserver(HostStatusObserver* observer) OVERRIDE; |
+ virtual void RemoveStatusObserver(HostStatusObserver* observer) OVERRIDE; |
// This method may be called only from |
// HostStatusObserver::OnClientAuthenticated() to reject the new |
@@ -151,6 +153,10 @@ class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>, |
// clients that were not connected when this method is called. |
void DisconnectAllClients(); |
+ base::WeakPtr<ChromotingHost> AsWeakPtr() { |
+ return weak_factory_.GetWeakPtr(); |
+ } |
+ |
private: |
friend class base::RefCountedThreadSafe<ChromotingHost>; |
friend class ChromotingHostTest; |
@@ -211,6 +217,8 @@ class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>, |
// The maximum duration of any session. |
base::TimeDelta max_session_duration_; |
+ base::WeakPtrFactory<ChromotingHost> weak_factory_; |
+ |
DISALLOW_COPY_AND_ASSIGN(ChromotingHost); |
}; |