Index: remoting/host/curtain_mode_mac.h |
diff --git a/remoting/host/curtain_mode_mac.h b/remoting/host/curtain_mode_mac.h |
index 3d21805e81dff278fe9bec687fb3231171a12998..b439b1140fda341f36affbbf23361abe7b8e468f 100644 |
--- a/remoting/host/curtain_mode_mac.h |
+++ b/remoting/host/curtain_mode_mac.h |
@@ -17,27 +17,46 @@ namespace remoting { |
class CurtainMode : public HostStatusObserver { |
public: |
- CurtainMode(); |
+ // Set callbacks to be invoked when the switched-out session is switched back |
+ // to the console, or in case of errors activating curtain-mode. Typically, |
+ // remote clients should be disconnected in both cases: for errors, because |
+ // the privacy guarantee of curtain-mode cannot be honoured; for switch-in, |
+ // to ensure that only one connection (console or remote) exists to a session. |
+ // Note that only the session's owner (or someone who knows the password) can |
+ // attach it to the console, so this is safe. |
+ CurtainMode(const base::Closure& on_session_activate, |
+ const base::Closure& on_error); |
virtual ~CurtainMode(); |
- // Set the callback to be invoked when the switched-out remote session is |
- // switched back to the console. Typically, remote connections should be |
- // closed in this event to make sure that only one connection (console or |
- // remote) exists to a session at any time to ensure privacy. Note that |
- // only the session's owner (or someone who knows the owner's password) |
- // can attach it to the console, so this is safe. |
- bool Init(const base::Closure& on_session_activate); |
+ // Enable or disable curtain-mode. Note that disabling curtain-mode does not |
+ // deactivate the curtain, but it does remove the switch-in handler, meaning |
+ // that on_session_activate will not be invoked if curtain-mode is disabled. |
+ // Conversely, enabling curtain-mode *does* activate the curtain if there is |
+ // a connected client at the time. |
+ void SetEnabled(bool enabled); |
// Overridden from HostStatusObserver |
virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; |
+ virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; |
private: |
+ // If the current session is attached to the console and is not showing |
+ // the logon screen then switch it out to ensure privacy. |
+ bool ActivateCurtain(); |
+ |
+ // Add or remove the switch-in event handler. |
+ bool InstallEventHandler(); |
+ bool RemoveEventHandler(); |
+ |
+ // Handlers for the switch-in event. |
static OSStatus SessionActivateHandler(EventHandlerCallRef handler, |
EventRef event, |
void* user_data); |
void OnSessionActivate(); |
base::Closure on_session_activate_; |
+ base::Closure on_error_; |
+ bool connection_active_; |
EventHandlerRef event_handler_; |
}; |