desktop_session_connector.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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
  3. // found in the LICENSE file.
  4. #ifndef REMOTING_HOST_DESKTOP_SESSION_CONNECTOR_H_
  5. #define REMOTING_HOST_DESKTOP_SESSION_CONNECTOR_H_
  6. #include "base/process/process.h"
  7. #include "build/build_config.h"
  8. #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h"
  9. #include "mojo/public/cpp/system/message_pipe.h"
  10. #include "remoting/host/mojom/remoting_host.mojom.h"
  11. namespace remoting {
  12. class DesktopSessionProxy;
  13. class ScreenResolution;
  14. // Provides a way to connect a terminal (i.e. a remote client) with a desktop
  15. // session (i.e. the screen, keyboard, and the rest).
  16. class DesktopSessionConnector : public mojom::DesktopSessionConnectionEvents {
  17. public:
  18. DesktopSessionConnector() = default;
  19. DesktopSessionConnector(const DesktopSessionConnector&) = delete;
  20. DesktopSessionConnector& operator=(const DesktopSessionConnector&) = delete;
  21. ~DesktopSessionConnector() override = default;
  22. // Requests the daemon process to create a desktop session and associates
  23. // |desktop_session_proxy| with it. |desktop_session_proxy| must be
  24. // disconnected from the desktop session (see DisconnectTerminal()) before it
  25. // can be deleted.
  26. virtual void ConnectTerminal(
  27. DesktopSessionProxy* desktop_session_proxy,
  28. const ScreenResolution& resolution,
  29. bool virtual_terminal) = 0;
  30. // Requests the daemon process disconnect |desktop_session_proxy| from
  31. // the associated desktop session.
  32. virtual void DisconnectTerminal(
  33. DesktopSessionProxy* desktop_session_proxy) = 0;
  34. // Changes the screen resolution of the desktop session.
  35. virtual void SetScreenResolution(
  36. DesktopSessionProxy* desktop_session_proxy,
  37. const ScreenResolution& resolution) = 0;
  38. // Binds a receiver to allow the DesktopSessionConnector instance to receive
  39. // events related to changes in the desktop session. Returns True if |handle|
  40. // was successfully bound, otherwise false.
  41. virtual bool BindConnectionEventsReceiver(
  42. mojo::ScopedInterfaceEndpointHandle handle) = 0;
  43. #if !BUILDFLAG(IS_WIN)
  44. // Notifies the network process that |terminal_id| is now attached to
  45. // a desktop integration process. |session_id| is the id of the desktop
  46. // session being attached. |desktop_pipe| is the client end of the pipe opened
  47. // by the desktop process.
  48. virtual void OnDesktopSessionAgentAttached(
  49. int terminal_id,
  50. int session_id,
  51. mojo::ScopedMessagePipeHandle desktop_pipe) = 0;
  52. // Notifies the network process that the daemon has disconnected the desktop
  53. // session from the associated desktop environment.
  54. virtual void OnTerminalDisconnected(int terminal_id) = 0;
  55. #endif
  56. };
  57. } // namespace remoting
  58. #endif // REMOTING_HOST_DESKTOP_SESSION_CONNECTOR_H_