OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CURTAINING_HOST_OBSERVER_H_ | 5 #ifndef REMOTING_HOST_CURTAINING_HOST_OBSERVER_H_ |
6 #define REMOTING_HOST_CURTAINING_HOST_OBSERVER_H_ | 6 #define REMOTING_HOST_CURTAINING_HOST_OBSERVER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/ref_counted.h" | |
14 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" |
15 #include "remoting/host/host_status_observer.h" | 15 #include "remoting/host/host_status_observer.h" |
16 | 16 |
17 namespace remoting { | 17 namespace remoting { |
18 | 18 |
19 class CurtainMode; | 19 class CurtainMode; |
20 class ChromotingHost; | 20 class HostStatusMonitor; |
21 | 21 |
22 class CurtainingHostObserver : public HostStatusObserver { | 22 class CurtainingHostObserver : public HostStatusObserver { |
23 public: | 23 public: |
24 CurtainingHostObserver(CurtainMode *curtain, | 24 CurtainingHostObserver(CurtainMode *curtain, |
25 scoped_refptr<ChromotingHost> host); | 25 base::WeakPtr<HostStatusMonitor> monitor); |
26 virtual ~CurtainingHostObserver(); | 26 virtual ~CurtainingHostObserver(); |
27 | 27 |
28 // Enables/disables curtaining when one or more clients are connected. | 28 // Enables/disables curtaining when one or more clients are connected. |
29 // Takes immediate effect if clients are already connected. | 29 // Takes immediate effect if clients are already connected. |
30 void SetEnableCurtaining(bool enable); | 30 void SetEnableCurtaining(bool enable); |
31 | 31 |
32 // HostStatusObserver interface. | 32 // HostStatusObserver interface. |
33 virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; | 33 virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; |
34 virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; | 34 virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; |
35 | 35 |
36 private: | 36 private: |
37 CurtainMode* curtain_; | 37 CurtainMode* curtain_; |
38 scoped_refptr<ChromotingHost> host_; | 38 base::WeakPtr<HostStatusMonitor> monitor_; |
39 std::set<std::string> active_clients_; | 39 std::set<std::string> active_clients_; |
40 bool enable_curtaining_; | 40 bool enable_curtaining_; |
41 }; | 41 }; |
42 | 42 |
43 } // namespace remoting | 43 } // namespace remoting |
44 #endif | 44 #endif |
OLD | NEW |