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

Side by Side Diff: remoting/host/curtain_mode_mac.h

Issue 10829306: Make curtain-mode controllable by policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/constants.h ('k') | remoting/host/curtain_mode_mac.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 #ifndef REMOTING_HOST_CURTAIN_MODE_MAC_H_ 5 #ifndef REMOTING_HOST_CURTAIN_MODE_MAC_H_
6 #define REMOTING_HOST_CURTAIN_MODE_MAC_H_ 6 #define REMOTING_HOST_CURTAIN_MODE_MAC_H_
7 7
8 #include <Carbon/Carbon.h> 8 #include <Carbon/Carbon.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "remoting/host/host_status_observer.h" 14 #include "remoting/host/host_status_observer.h"
15 15
16 namespace remoting { 16 namespace remoting {
17 17
18 class CurtainMode : public HostStatusObserver { 18 class CurtainMode : public HostStatusObserver {
19 public: 19 public:
20 CurtainMode(); 20 // Set callbacks to be invoked when the switched-out session is switched back
21 // to the console, or in case of errors activating curtain-mode. Typically,
22 // remote clients should be disconnected in both cases: for errors, because
23 // the privacy guarantee of curtain-mode cannot be honoured; for switch-in,
24 // to ensure that only one connection (console or remote) exists to a session.
25 // Note that only the session's owner (or someone who knows the password) can
26 // attach it to the console, so this is safe.
27 CurtainMode(const base::Closure& on_session_activate,
28 const base::Closure& on_error);
21 virtual ~CurtainMode(); 29 virtual ~CurtainMode();
22 30
23 // Set the callback to be invoked when the switched-out remote session is 31 // Enable or disable curtain-mode. Note that disabling curtain-mode does not
24 // switched back to the console. Typically, remote connections should be 32 // deactivate the curtain, but it does remove the switch-in handler, meaning
25 // closed in this event to make sure that only one connection (console or 33 // that on_session_activate will not be invoked if curtain-mode is disabled.
26 // remote) exists to a session at any time to ensure privacy. Note that 34 // Conversely, enabling curtain-mode *does* activate the curtain if there is
27 // only the session's owner (or someone who knows the owner's password) 35 // a connected client at the time.
28 // can attach it to the console, so this is safe. 36 void SetEnabled(bool enabled);
29 bool Init(const base::Closure& on_session_activate);
30 37
31 // Overridden from HostStatusObserver 38 // Overridden from HostStatusObserver
32 virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; 39 virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE;
40 virtual void OnClientDisconnected(const std::string& jid) OVERRIDE;
33 41
34 private: 42 private:
43 // If the current session is attached to the console and is not showing
44 // the logon screen then switch it out to ensure privacy.
45 bool ActivateCurtain();
46
47 // Add or remove the switch-in event handler.
48 bool InstallEventHandler();
49 bool RemoveEventHandler();
50
51 // Handlers for the switch-in event.
35 static OSStatus SessionActivateHandler(EventHandlerCallRef handler, 52 static OSStatus SessionActivateHandler(EventHandlerCallRef handler,
36 EventRef event, 53 EventRef event,
37 void* user_data); 54 void* user_data);
38 void OnSessionActivate(); 55 void OnSessionActivate();
39 56
40 base::Closure on_session_activate_; 57 base::Closure on_session_activate_;
58 base::Closure on_error_;
59 bool connection_active_;
41 EventHandlerRef event_handler_; 60 EventHandlerRef event_handler_;
42 }; 61 };
43 62
44 } 63 }
45 64
46 #endif 65 #endif
OLDNEW
« no previous file with comments | « remoting/host/constants.h ('k') | remoting/host/curtain_mode_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698