Index: remoting/host/curtaining_host_observer.cc |
diff --git a/remoting/host/curtaining_host_observer.cc b/remoting/host/curtaining_host_observer.cc |
index 298c5957a7ad36190072aa6a6e05d1a11380381e..6eacabe6c08be853ac9d92e798d8a63e347ab5ac 100644 |
--- a/remoting/host/curtaining_host_observer.cc |
+++ b/remoting/host/curtaining_host_observer.cc |
@@ -21,17 +21,19 @@ CurtainingHostObserver::~CurtainingHostObserver() { |
curtain_->SetActivated(false); |
} |
-// TODO(jamiewalch): This code assumes at most one client connection at a time. |
-// Add OnFirstClientConnected and OnLastClientDisconnected optional callbacks |
-// to the HostStatusObserver interface to address this. |
Jamie
2012/11/07 00:27:49
Please reinstate this TODO in some form. If you th
Wez
2012/11/07 02:37:32
Most of our uses of HostObserver will disappear in
Jamie
2012/11/07 22:28:02
Fair enough, but we'll still want to centralize th
Wez
2012/11/07 22:33:06
No, we won't; this way of handling "curtaining" wi
|
+void CurtainingHostObserver::SetEnableCurtaining(bool enable) { |
+ enable_curtaining_ = enable; |
+ curtain_->SetActivated(enable_curtaining_ && !active_clients_.empty()); |
+} |
+ |
void CurtainingHostObserver::OnClientAuthenticated(const std::string& jid) { |
- if (curtain_->required()) { |
- curtain_->SetActivated(true); |
- } |
+ active_clients_.insert(jid); |
+ curtain_->SetActivated(enable_curtaining_ && !active_clients_.empty()); |
} |
void CurtainingHostObserver::OnClientDisconnected(const std::string& jid) { |
- curtain_->SetActivated(false); |
+ active_clients_.erase(jid); |
+ curtain_->SetActivated(enable_curtaining_ && !active_clients_.empty()); |
} |
} // namespace remoting |