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

Side by Side 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: Add missing member to CurtainModeWin. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/curtaining_host_observer.h ('k') | remoting/host/remoting_me2me_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "remoting/host/curtaining_host_observer.h" 5 #include "remoting/host/curtaining_host_observer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "remoting/host/curtain_mode.h" 8 #include "remoting/host/curtain_mode.h"
9 #include "remoting/host/chromoting_host.h" 9 #include "remoting/host/chromoting_host.h"
10 10
11 namespace remoting { 11 namespace remoting {
12 12
13 CurtainingHostObserver::CurtainingHostObserver( 13 CurtainingHostObserver::CurtainingHostObserver(
14 CurtainMode *curtain, scoped_refptr<ChromotingHost> host) 14 CurtainMode *curtain, scoped_refptr<ChromotingHost> host)
15 : curtain_(curtain), host_(host) { 15 : curtain_(curtain), host_(host) {
16 host_->AddStatusObserver(this); 16 host_->AddStatusObserver(this);
17 } 17 }
18 18
19 CurtainingHostObserver::~CurtainingHostObserver() { 19 CurtainingHostObserver::~CurtainingHostObserver() {
20 host_->RemoveStatusObserver(this); 20 host_->RemoveStatusObserver(this);
21 curtain_->SetActivated(false); 21 curtain_->SetActivated(false);
22 } 22 }
23 23
24 // TODO(jamiewalch): This code assumes at most one client connection at a time. 24 void CurtainingHostObserver::SetEnableCurtaining(bool enable) {
25 // Add OnFirstClientConnected and OnLastClientDisconnected optional callbacks 25 enable_curtaining_ = enable;
26 // to the HostStatusObserver interface to address this. 26 curtain_->SetActivated(enable_curtaining_ && !active_clients_.empty());
27 }
28
27 void CurtainingHostObserver::OnClientAuthenticated(const std::string& jid) { 29 void CurtainingHostObserver::OnClientAuthenticated(const std::string& jid) {
28 if (curtain_->required()) { 30 active_clients_.insert(jid);
29 curtain_->SetActivated(true); 31 curtain_->SetActivated(enable_curtaining_ && !active_clients_.empty());
30 }
31 } 32 }
32 33
33 void CurtainingHostObserver::OnClientDisconnected(const std::string& jid) { 34 void CurtainingHostObserver::OnClientDisconnected(const std::string& jid) {
34 curtain_->SetActivated(false); 35 active_clients_.erase(jid);
36 curtain_->SetActivated(enable_curtaining_ && !active_clients_.empty());
35 } 37 }
36 38
37 } // namespace remoting 39 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/curtaining_host_observer.h ('k') | remoting/host/remoting_me2me_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698