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

Unified Diff: remoting/host/chromoting_host.h

Issue 12386035: Moving host status events monitoring to a separate interface (HostStatusMonitor). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | remoting/host/chromoting_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
};
« no previous file with comments | « no previous file | remoting/host/chromoting_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698