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

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

Issue 11447021: Added support of Secure Attention Sequence in multiprocess mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
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_DESKTOP_SESSION_AGENT_H_ 5 #ifndef REMOTING_HOST_DESKTOP_SESSION_AGENT_H_
6 #define REMOTING_HOST_DESKTOP_SESSION_AGENT_H_ 6 #define REMOTING_HOST_DESKTOP_SESSION_AGENT_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 20 matching lines...) Expand all
31 class EventExecutor; 31 class EventExecutor;
32 32
33 // Provides screen/audio capturing and input injection services for 33 // Provides screen/audio capturing and input injection services for
34 // the network process. 34 // the network process.
35 class DesktopSessionAgent 35 class DesktopSessionAgent
36 : public base::RefCountedThreadSafe<DesktopSessionAgent>, 36 : public base::RefCountedThreadSafe<DesktopSessionAgent>,
37 public IPC::Listener, 37 public IPC::Listener,
38 public SharedBufferFactory, 38 public SharedBufferFactory,
39 public VideoFrameCapturer::Delegate { 39 public VideoFrameCapturer::Delegate {
40 public: 40 public:
41 class Delegate {
42 public:
43 virtual ~Delegate();
44
45 // Notifies the delegate that the network-to-desktop channel has been
46 // disconnected.
47 virtual void OnNetworkProcessDisconnected() = 0;
48
49 // Request the delegate to inject Secure Attention Sequence.
50 virtual void InjectSas() = 0;
51 };
52
41 static scoped_refptr<DesktopSessionAgent> Create( 53 static scoped_refptr<DesktopSessionAgent> Create(
42 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, 54 scoped_refptr<AutoThreadTaskRunner> caller_task_runner,
43 scoped_refptr<AutoThreadTaskRunner> input_task_runner, 55 scoped_refptr<AutoThreadTaskRunner> input_task_runner,
44 scoped_refptr<AutoThreadTaskRunner> io_task_runner, 56 scoped_refptr<AutoThreadTaskRunner> io_task_runner,
45 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner); 57 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner);
46 58
47 // IPC::Listener implementation. 59 // IPC::Listener implementation.
48 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 60 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
49 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; 61 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
50 virtual void OnChannelError() OVERRIDE; 62 virtual void OnChannelError() OVERRIDE;
51 63
52 // SharedBufferFactory implementation. 64 // SharedBufferFactory implementation.
53 virtual scoped_refptr<SharedBuffer> CreateSharedBuffer(uint32 size) OVERRIDE; 65 virtual scoped_refptr<SharedBuffer> CreateSharedBuffer(uint32 size) OVERRIDE;
54 virtual void ReleaseSharedBuffer(scoped_refptr<SharedBuffer> buffer) OVERRIDE; 66 virtual void ReleaseSharedBuffer(scoped_refptr<SharedBuffer> buffer) OVERRIDE;
55 67
56 // VideoFrameCapturer::Delegate implementation. 68 // VideoFrameCapturer::Delegate implementation.
57 virtual void OnCaptureCompleted( 69 virtual void OnCaptureCompleted(
58 scoped_refptr<CaptureData> capture_data) OVERRIDE; 70 scoped_refptr<CaptureData> capture_data) OVERRIDE;
59 virtual void OnCursorShapeChanged( 71 virtual void OnCursorShapeChanged(
60 scoped_ptr<protocol::CursorShapeInfo> cursor_shape) OVERRIDE; 72 scoped_ptr<protocol::CursorShapeInfo> cursor_shape) OVERRIDE;
61 73
62 // Forwards a local clipboard event though the IPC channel to the network 74 // Forwards a local clipboard event though the IPC channel to the network
63 // process. 75 // process.
64 void InjectClipboardEvent(const protocol::ClipboardEvent& event); 76 void InjectClipboardEvent(const protocol::ClipboardEvent& event);
65 77
66 // Creates desktop integration components and a connected IPC channel to be 78 // Creates desktop integration components and a connected IPC channel to be
67 // used to access them. The client end of the channel is returned in 79 // used to access them. The client end of the channel is returned in
68 // the variable pointed by |desktop_pipe_out|. 80 // the variable pointed by |desktop_pipe_out|. |delegate| must be valid until
69 // 81 // Stop() is called.
Jamie 2012/12/06 21:42:25 Would it be possible/sensible to use refcounting t
alexeypa (please no reviews) 2012/12/06 21:56:02 Using Start()/Stop() methods with a requirement to
70 // |disconnected_task| is invoked on |caller_task_runner_| to notify 82 bool Start(Delegate* delegate, IPC::PlatformFileForTransit* desktop_pipe_out);
71 // the caller that the network-to-desktop channel has been disconnected.
72 bool Start(const base::Closure& disconnected_task,
73 IPC::PlatformFileForTransit* desktop_pipe_out);
74 83
75 // Stops the agent asynchronously. 84 // Stops the agent asynchronously.
76 void Stop(); 85 void Stop();
77 86
78 protected: 87 protected:
79 DesktopSessionAgent( 88 DesktopSessionAgent(
80 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, 89 scoped_refptr<AutoThreadTaskRunner> caller_task_runner,
81 scoped_refptr<AutoThreadTaskRunner> input_task_runner, 90 scoped_refptr<AutoThreadTaskRunner> input_task_runner,
82 scoped_refptr<AutoThreadTaskRunner> io_task_runner, 91 scoped_refptr<AutoThreadTaskRunner> io_task_runner,
83 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner); 92 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner);
84 93
85 friend class base::RefCountedThreadSafe<DesktopSessionAgent>; 94 friend class base::RefCountedThreadSafe<DesktopSessionAgent>;
86 virtual ~DesktopSessionAgent(); 95 virtual ~DesktopSessionAgent();
87 96
88 // Creates a connected IPC channel to be used to access the screen/audio 97 // Creates a connected IPC channel to be used to access the screen/audio
89 // recorders and input stubs. 98 // recorders and input stubs.
90 virtual bool CreateChannelForNetworkProcess( 99 virtual bool CreateChannelForNetworkProcess(
91 IPC::PlatformFileForTransit* client_out, 100 IPC::PlatformFileForTransit* client_out,
92 scoped_ptr<IPC::ChannelProxy>* server_out) = 0; 101 scoped_ptr<IPC::ChannelProxy>* server_out) = 0;
93 102
103 // Creates an event executor specific to the platform.
104 virtual scoped_ptr<EventExecutor> CreateEventExecutor() = 0;
105
94 // Handles CaptureFrame requests from the client. 106 // Handles CaptureFrame requests from the client.
95 void OnCaptureFrame(); 107 void OnCaptureFrame();
96 108
97 // Handles InvalidateRegion requests from the client. 109 // Handles InvalidateRegion requests from the client.
98 void OnInvalidateRegion(const std::vector<SkIRect>& invalid_rects); 110 void OnInvalidateRegion(const std::vector<SkIRect>& invalid_rects);
99 111
100 // Handles SharedBufferCreated notification from the client. 112 // Handles SharedBufferCreated notification from the client.
101 void OnSharedBufferCreated(int id); 113 void OnSharedBufferCreated(int id);
102 114
103 // Handles event executor requests from the client. 115 // Handles event executor requests from the client.
(...skipping 21 matching lines...) Expand all
125 } 137 }
126 138
127 scoped_refptr<AutoThreadTaskRunner> io_task_runner() const { 139 scoped_refptr<AutoThreadTaskRunner> io_task_runner() const {
128 return io_task_runner_; 140 return io_task_runner_;
129 } 141 }
130 142
131 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner() const { 143 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner() const {
132 return video_capture_task_runner_; 144 return video_capture_task_runner_;
133 } 145 }
134 146
147 Delegate* delegate() const {
148 return delegate_;
149 }
150
135 private: 151 private:
136 // Task runner on which public methods of this class should be called. 152 // Task runner on which public methods of this class should be called.
137 scoped_refptr<AutoThreadTaskRunner> caller_task_runner_; 153 scoped_refptr<AutoThreadTaskRunner> caller_task_runner_;
138 154
139 // Task runner on which keyboard/mouse input is injected. 155 // Task runner on which keyboard/mouse input is injected.
140 scoped_refptr<AutoThreadTaskRunner> input_task_runner_; 156 scoped_refptr<AutoThreadTaskRunner> input_task_runner_;
141 157
142 // Task runner used by the IPC channel. 158 // Task runner used by the IPC channel.
143 scoped_refptr<AutoThreadTaskRunner> io_task_runner_; 159 scoped_refptr<AutoThreadTaskRunner> io_task_runner_;
144 160
145 // Task runner dedicated to running methods of |video_capturer_|. 161 // Task runner dedicated to running methods of |video_capturer_|.
146 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner_; 162 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner_;
147 163
148 // Runs on |caller_task_runner_| to notify the caller that the network-to- 164 Delegate* delegate_;
149 // desktop channel has been disconnected.
150 base::Closure disconnected_task_;
151 165
152 // Executes keyboard, mouse and clipboard events. 166 // Executes keyboard, mouse and clipboard events.
153 scoped_ptr<EventExecutor> event_executor_; 167 scoped_ptr<EventExecutor> event_executor_;
154 168
155 // IPC channel connecting the desktop process with the network process. 169 // IPC channel connecting the desktop process with the network process.
156 scoped_ptr<IPC::ChannelProxy> network_channel_; 170 scoped_ptr<IPC::ChannelProxy> network_channel_;
157 171
158 // Next shared buffer ID to be used. 172 // Next shared buffer ID to be used.
159 int next_shared_buffer_id_; 173 int next_shared_buffer_id_;
160 174
161 // List of the shared buffers registered via |SharedBufferFactory| interface. 175 // List of the shared buffers registered via |SharedBufferFactory| interface.
162 typedef std::list<scoped_refptr<SharedBuffer> > SharedBuffers; 176 typedef std::list<scoped_refptr<SharedBuffer> > SharedBuffers;
163 SharedBuffers shared_buffers_; 177 SharedBuffers shared_buffers_;
164 178
165 // Captures the screen. 179 // Captures the screen.
166 scoped_ptr<VideoFrameCapturer> video_capturer_; 180 scoped_ptr<VideoFrameCapturer> video_capturer_;
167 181
168 DISALLOW_COPY_AND_ASSIGN(DesktopSessionAgent); 182 DISALLOW_COPY_AND_ASSIGN(DesktopSessionAgent);
169 }; 183 };
170 184
171 } // namespace remoting 185 } // namespace remoting
172 186
173 #endif // REMOTING_HOST_DESKTOP_SESSION_AGENT_H_ 187 #endif // REMOTING_HOST_DESKTOP_SESSION_AGENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698