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

Unified Diff: remoting/host/curtaining_host_observer.cc

Issue 11275178: Enforce the RemoteAccessHostRequireCurtain policy on all platforms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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
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

Powered by Google App Engine
This is Rietveld 408576698