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

Unified Diff: remoting/host/ipc_desktop_environment.h

Issue 11761019: Tiny little refactoring of DesktopEnvironment. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/ipc_audio_capturer.cc ('k') | remoting/host/ipc_desktop_environment.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/ipc_desktop_environment.h
diff --git a/remoting/host/ipc_desktop_environment.h b/remoting/host/ipc_desktop_environment.h
index 53b5c0fb75208fc701653f796c6ce0cc4587f826..47df45bc89d8107e2299fee878cb519f9db897ab 100644
--- a/remoting/host/ipc_desktop_environment.h
+++ b/remoting/host/ipc_desktop_environment.h
@@ -5,10 +5,13 @@
#ifndef REMOTING_HOST_IPC_DESKTOP_ENVIRONMENT_H_
#define REMOTING_HOST_IPC_DESKTOP_ENVIRONMENT_H_
+#include <string>
+
#include "base/basictypes.h"
#include "base/callback_forward.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "ipc/ipc_platform_file.h"
#include "remoting/host/desktop_environment.h"
@@ -25,34 +28,60 @@ class DesktopSessionProxy;
// a helper process and talking to that process via IPC.
class IpcDesktopEnvironment : public DesktopEnvironment {
public:
- // |desktop_session_connector| is used to bind the IpcDesktopEnvironment to
- // a desktop session, to be notified with a new IPC channel every time
- // the desktop process is changed. |desktop_session_connector| must outlive
- // |this|. |client| specifies the client session owning |this|.
+ // |desktop_session_connector| is used to bind DesktopSessionProxy to
+ // a desktop session, to be notified every time the desktop process is
+ // restarted.
IpcDesktopEnvironment(
- scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
- scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
- scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
- DesktopSessionConnector* desktop_session_connector,
- scoped_refptr<DesktopSessionProxy> desktop_session_proxy);
+ scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
+ const std::string& client_jid,
+ const base::Closure& disconnect_callback,
+ base::WeakPtr<DesktopSessionConnector> desktop_session_connector);
virtual ~IpcDesktopEnvironment();
- virtual void Start(
- scoped_ptr<protocol::ClipboardStub> client_clipboard,
- const std::string& client_jid,
- const base::Closure& disconnect_callback) OVERRIDE;
+ // protocol::ClipboardStub implementation.
+ virtual void InjectClipboardEvent(
+ const protocol::ClipboardEvent& event) OVERRIDE;
- private:
- // Used for IPC I/O.
- scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
+ // protocol::InputStub implementation.
+ virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE;
+ virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE;
+
+ // DesktopEnvironment implementation.
+ virtual void StartAudio(
+ scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner,
+ scoped_ptr<AudioEncoder> audio_encoder,
+ protocol::AudioStub* audio_stub) OVERRIDE;
+ virtual void PauseAudio(bool pause) OVERRIDE;
+ virtual void StartInput(
+ scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
+ protocol::ClipboardStub* clipboard_stub) OVERRIDE;
+ virtual void StartVideo(
+ scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
+ scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner,
+ scoped_ptr<VideoEncoder> video_encoder,
+ protocol::CursorShapeStub* cursor_shape_stub,
+ protocol::VideoStub* video_stub) OVERRIDE;
+ virtual SkISize GetScreenSize() const OVERRIDE;
+ virtual void PauseVideo(bool pause) OVERRIDE;
+ virtual void UpdateSequenceNumber(int64 sequence_number) OVERRIDE;
- DesktopSessionConnector* desktop_session_connector_;
+ private:
+ // Binds DesktopSessionProxy to a desktop session if it is not bound already.
+ void RegisterDesktopSessionProxy();
- scoped_refptr<DesktopSessionProxy> desktop_session_proxy_;
+ // Task runner on which public methods of this class should be called.
+ scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_;
- // True if |this| has been connected to a desktop session.
+ // True if |desktop_session_proxy_| has been connected to a desktop session.
bool connected_;
+ // Used to bind DesktopSessionProxy to a desktop session, to be notified every
+ // time the desktop process is restarted.
+ base::WeakPtr<DesktopSessionConnector> desktop_session_connector_;
+
+ scoped_refptr<DesktopSessionProxy> desktop_session_proxy_;
+
DISALLOW_COPY_AND_ASSIGN(IpcDesktopEnvironment);
};
« no previous file with comments | « remoting/host/ipc_audio_capturer.cc ('k') | remoting/host/ipc_desktop_environment.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698