| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_WIN_RDP_HOST_WINDOW_H_ | 5 #ifndef REMOTING_HOST_WIN_RDP_HOST_WINDOW_H_ |
| 6 #define REMOTING_HOST_WIN_RDP_HOST_WINDOW_H_ | 6 #define REMOTING_HOST_WIN_RDP_HOST_WINDOW_H_ |
| 7 | 7 |
| 8 #include <atlbase.h> | 8 #include <atlbase.h> |
| 9 #include <atlcom.h> | 9 #include <atlcom.h> |
| 10 #include <atlcrack.h> | 10 #include <atlcrack.h> |
| 11 #include <atlctl.h> | 11 #include <atlctl.h> |
| 12 | 12 |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/timer/timer.h" |
| 15 #include "base/win/scoped_comptr.h" | 16 #include "base/win/scoped_comptr.h" |
| 16 #include "net/base/ip_endpoint.h" | 17 #include "net/base/ip_endpoint.h" |
| 17 #include "remoting/host/screen_resolution.h" | 18 #include "remoting/host/screen_resolution.h" |
| 18 // The following header was generated by Visual Studio. We had to check it in | 19 // The following header was generated by Visual Studio. We had to check it in |
| 19 // due to a bug in VS2013. See crbug.com/318952 for details. | 20 // due to a bug in VS2013. See crbug.com/318952 for details. |
| 20 #include "remoting/host/win/com_imported_mstscax.tlh" | 21 #include "remoting/host/win/com_imported_mstscax.tlh" |
| 21 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | 22 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
| 22 | 23 |
| 23 namespace remoting { | 24 namespace remoting { |
| 24 | 25 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 STDMETHOD(OnAuthenticationWarningDismissed)(); | 129 STDMETHOD(OnAuthenticationWarningDismissed)(); |
| 129 STDMETHOD(OnConnected)(); | 130 STDMETHOD(OnConnected)(); |
| 130 STDMETHOD(OnLoginComplete)(); | 131 STDMETHOD(OnLoginComplete)(); |
| 131 STDMETHOD(OnDisconnected)(long reason); | 132 STDMETHOD(OnDisconnected)(long reason); |
| 132 STDMETHOD(OnFatalError)(long error_code); | 133 STDMETHOD(OnFatalError)(long error_code); |
| 133 STDMETHOD(OnConfirmClose)(VARIANT_BOOL* allow_close); | 134 STDMETHOD(OnConfirmClose)(VARIANT_BOOL* allow_close); |
| 134 | 135 |
| 135 int LogOnCreateError(HRESULT error); | 136 int LogOnCreateError(HRESULT error); |
| 136 | 137 |
| 137 // Wrappers for the event handler's methods that make sure that | 138 // Wrappers for the event handler's methods that make sure that |
| 138 // OnDisconnected() is the last notification delivered and is delevered | 139 // OnDisconnected() is the last notification delivered and is delivered |
| 139 // only once. | 140 // only once. |
| 140 void NotifyConnected(); | 141 void NotifyConnected(); |
| 141 void NotifyDisconnected(); | 142 void NotifyDisconnected(); |
| 142 | 143 |
| 143 // Updates the desktop using |screen_resolution_| if resizing is supported. | 144 // Updates the desktop using |screen_resolution_| if resizing is supported. |
| 144 void UpdateDesktopResolution(); | 145 HRESULT UpdateDesktopResolution(); |
| 146 |
| 147 // Attempts to reapply the requested screen resolution. This method is used |
| 148 // to workaround the inconsistent behavior seen by the RDP API which can fail |
| 149 // for an indeterminate amount of time (i.e. a few seconds) after the user has |
| 150 // logged into the session. In practice retrying after ~100ms will succeed, |
| 151 // but we will use |apply_resolution_timer_| to try a few times if the machine |
| 152 // is under load. |
| 153 void ReapplyDesktopResolution(int attempt_count); |
| 145 | 154 |
| 146 // Invoked to report connect/disconnect events. | 155 // Invoked to report connect/disconnect events. |
| 147 EventHandler* event_handler_; | 156 EventHandler* event_handler_; |
| 148 | 157 |
| 149 // Contains the requested dimensions of the screen. | 158 // Contains the requested dimensions of the screen. |
| 150 remoting::ScreenResolution screen_resolution_; | 159 remoting::ScreenResolution screen_resolution_; |
| 151 | 160 |
| 161 // Used for applying resolution changes after a timeout. |
| 162 base::OneShotTimer apply_resolution_timer_; |
| 163 |
| 152 // The endpoint to connect to. | 164 // The endpoint to connect to. |
| 153 net::IPEndPoint server_endpoint_; | 165 net::IPEndPoint server_endpoint_; |
| 154 | 166 |
| 155 // The terminal ID assigned to this connection. | 167 // The terminal ID assigned to this connection. |
| 156 std::string terminal_id_; | 168 std::string terminal_id_; |
| 157 | 169 |
| 158 // Our RDP session always starts logged out (i.e. at the logon screen), some | 170 // Our RDP session always starts logged out (i.e. at the logon screen), some |
| 159 // functions do not work until the user has logged in so we want to track that | 171 // functions do not work until the user has logged in so we want to track that |
| 160 // event. We don't support logging out so this value should never revert from | 172 // event. We don't support logging out so this value should never revert from |
| 161 // true to false. | 173 // true to false. |
| 162 bool user_logged_in_ = false; | 174 bool user_logged_in_ = false; |
| 163 | 175 |
| 164 // Interfaces exposed by the RDP ActiveX control. | 176 // Interfaces exposed by the RDP ActiveX control. |
| 165 base::win::ScopedComPtr<mstsc::IMsRdpClient> client_; | 177 base::win::ScopedComPtr<mstsc::IMsRdpClient> client_; |
| 166 base::win::ScopedComPtr<mstsc::IMsRdpClient9> client_9_; | 178 base::win::ScopedComPtr<mstsc::IMsRdpClient9> client_9_; |
| 167 base::win::ScopedComPtr<mstsc::IMsRdpClientAdvancedSettings> client_settings_; | 179 base::win::ScopedComPtr<mstsc::IMsRdpClientAdvancedSettings> client_settings_; |
| 168 | 180 |
| 169 // Used to cancel modal dialog boxes shown by the RDP control. | 181 // Used to cancel modal dialog boxes shown by the RDP control. |
| 170 class WindowHook; | 182 class WindowHook; |
| 171 scoped_refptr<WindowHook> window_activate_hook_; | 183 scoped_refptr<WindowHook> window_activate_hook_; |
| 172 }; | 184 }; |
| 173 | 185 |
| 174 } // namespace remoting | 186 } // namespace remoting |
| 175 | 187 |
| 176 #endif // REMOTING_HOST_WIN_RDP_HOST_WINDOW_H_ | 188 #endif // REMOTING_HOST_WIN_RDP_HOST_WINDOW_H_ |
| OLD | NEW |