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

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: rebased 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
« no previous file with comments | « remoting/host/desktop_process.cc ('k') | remoting/host/desktop_session_agent.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h"
15 #include "ipc/ipc_listener.h" 16 #include "ipc/ipc_listener.h"
16 #include "ipc/ipc_platform_file.h" 17 #include "ipc/ipc_platform_file.h"
17 #include "remoting/base/shared_buffer.h" 18 #include "remoting/base/shared_buffer.h"
18 #include "remoting/base/shared_buffer_factory.h" 19 #include "remoting/base/shared_buffer_factory.h"
19 #include "remoting/host/video_frame_capturer.h" 20 #include "remoting/host/video_frame_capturer.h"
20 #include "remoting/protocol/clipboard_stub.h" 21 #include "remoting/protocol/clipboard_stub.h"
21 #include "third_party/skia/include/core/SkRect.h" 22 #include "third_party/skia/include/core/SkRect.h"
22 23
23 namespace IPC { 24 namespace IPC {
24 class ChannelProxy; 25 class ChannelProxy;
25 class Message; 26 class Message;
26 } // namespace IPC 27 } // namespace IPC
27 28
28 namespace remoting { 29 namespace remoting {
29 30
30 class AutoThreadTaskRunner; 31 class AutoThreadTaskRunner;
31 class EventExecutor; 32 class EventExecutor;
32 33
33 // Provides screen/audio capturing and input injection services for 34 // Provides screen/audio capturing and input injection services for
34 // the network process. 35 // the network process.
35 class DesktopSessionAgent 36 class DesktopSessionAgent
36 : public base::RefCountedThreadSafe<DesktopSessionAgent>, 37 : public base::RefCountedThreadSafe<DesktopSessionAgent>,
37 public IPC::Listener, 38 public IPC::Listener,
38 public SharedBufferFactory, 39 public SharedBufferFactory,
39 public VideoFrameCapturer::Delegate { 40 public VideoFrameCapturer::Delegate {
40 public: 41 public:
42 class Delegate {
43 public:
44 virtual ~Delegate();
45
46 // Notifies the delegate that the network-to-desktop channel has been
47 // disconnected.
48 virtual void OnNetworkProcessDisconnected() = 0;
49
50 // Request the delegate to inject Secure Attention Sequence.
51 virtual void InjectSas() = 0;
52 };
53
41 static scoped_refptr<DesktopSessionAgent> Create( 54 static scoped_refptr<DesktopSessionAgent> Create(
42 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, 55 scoped_refptr<AutoThreadTaskRunner> caller_task_runner,
43 scoped_refptr<AutoThreadTaskRunner> input_task_runner, 56 scoped_refptr<AutoThreadTaskRunner> input_task_runner,
44 scoped_refptr<AutoThreadTaskRunner> io_task_runner, 57 scoped_refptr<AutoThreadTaskRunner> io_task_runner,
45 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner); 58 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner);
46 59
47 // IPC::Listener implementation. 60 // IPC::Listener implementation.
48 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 61 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
49 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; 62 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
50 virtual void OnChannelError() OVERRIDE; 63 virtual void OnChannelError() OVERRIDE;
51 64
52 // SharedBufferFactory implementation. 65 // SharedBufferFactory implementation.
53 virtual scoped_refptr<SharedBuffer> CreateSharedBuffer(uint32 size) OVERRIDE; 66 virtual scoped_refptr<SharedBuffer> CreateSharedBuffer(uint32 size) OVERRIDE;
54 virtual void ReleaseSharedBuffer(scoped_refptr<SharedBuffer> buffer) OVERRIDE; 67 virtual void ReleaseSharedBuffer(scoped_refptr<SharedBuffer> buffer) OVERRIDE;
55 68
56 // VideoFrameCapturer::Delegate implementation. 69 // VideoFrameCapturer::Delegate implementation.
57 virtual void OnCaptureCompleted( 70 virtual void OnCaptureCompleted(
58 scoped_refptr<CaptureData> capture_data) OVERRIDE; 71 scoped_refptr<CaptureData> capture_data) OVERRIDE;
59 virtual void OnCursorShapeChanged( 72 virtual void OnCursorShapeChanged(
60 scoped_ptr<protocol::CursorShapeInfo> cursor_shape) OVERRIDE; 73 scoped_ptr<protocol::CursorShapeInfo> cursor_shape) OVERRIDE;
61 74
62 // Forwards a local clipboard event though the IPC channel to the network 75 // Forwards a local clipboard event though the IPC channel to the network
63 // process. 76 // process.
64 void InjectClipboardEvent(const protocol::ClipboardEvent& event); 77 void InjectClipboardEvent(const protocol::ClipboardEvent& event);
65 78
66 // Creates desktop integration components and a connected IPC channel to be 79 // 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 80 // used to access them. The client end of the channel is returned in
68 // the variable pointed by |desktop_pipe_out|. 81 // the variable pointed by |desktop_pipe_out|.
69 // 82 bool Start(const base::WeakPtr<Delegate>& delegate,
70 // |disconnected_task| is invoked on |caller_task_runner_| to notify
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); 83 IPC::PlatformFileForTransit* desktop_pipe_out);
74 84
75 // Stops the agent asynchronously. 85 // Stops the agent asynchronously.
76 void Stop(); 86 void Stop();
77 87
78 protected: 88 protected:
79 DesktopSessionAgent( 89 DesktopSessionAgent(
80 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, 90 scoped_refptr<AutoThreadTaskRunner> caller_task_runner,
81 scoped_refptr<AutoThreadTaskRunner> input_task_runner, 91 scoped_refptr<AutoThreadTaskRunner> input_task_runner,
82 scoped_refptr<AutoThreadTaskRunner> io_task_runner, 92 scoped_refptr<AutoThreadTaskRunner> io_task_runner,
83 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner); 93 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner);
84 94
85 friend class base::RefCountedThreadSafe<DesktopSessionAgent>; 95 friend class base::RefCountedThreadSafe<DesktopSessionAgent>;
86 virtual ~DesktopSessionAgent(); 96 virtual ~DesktopSessionAgent();
87 97
88 // Creates a connected IPC channel to be used to access the screen/audio 98 // Creates a connected IPC channel to be used to access the screen/audio
89 // recorders and input stubs. 99 // recorders and input stubs.
90 virtual bool CreateChannelForNetworkProcess( 100 virtual bool CreateChannelForNetworkProcess(
91 IPC::PlatformFileForTransit* client_out, 101 IPC::PlatformFileForTransit* client_out,
92 scoped_ptr<IPC::ChannelProxy>* server_out) = 0; 102 scoped_ptr<IPC::ChannelProxy>* server_out) = 0;
93 103
104 // Creates an event executor specific to the platform.
105 virtual scoped_ptr<EventExecutor> CreateEventExecutor() = 0;
106
94 // Handles CaptureFrame requests from the client. 107 // Handles CaptureFrame requests from the client.
95 void OnCaptureFrame(); 108 void OnCaptureFrame();
96 109
97 // Handles InvalidateRegion requests from the client. 110 // Handles InvalidateRegion requests from the client.
98 void OnInvalidateRegion(const std::vector<SkIRect>& invalid_rects); 111 void OnInvalidateRegion(const std::vector<SkIRect>& invalid_rects);
99 112
100 // Handles SharedBufferCreated notification from the client. 113 // Handles SharedBufferCreated notification from the client.
101 void OnSharedBufferCreated(int id); 114 void OnSharedBufferCreated(int id);
102 115
103 // Handles event executor requests from the client. 116 // Handles event executor requests from the client.
(...skipping 21 matching lines...) Expand all
125 } 138 }
126 139
127 scoped_refptr<AutoThreadTaskRunner> io_task_runner() const { 140 scoped_refptr<AutoThreadTaskRunner> io_task_runner() const {
128 return io_task_runner_; 141 return io_task_runner_;
129 } 142 }
130 143
131 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner() const { 144 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner() const {
132 return video_capture_task_runner_; 145 return video_capture_task_runner_;
133 } 146 }
134 147
148 const base::WeakPtr<Delegate>& delegate() const {
149 return delegate_;
150 }
151
135 private: 152 private:
136 // Task runner on which public methods of this class should be called. 153 // Task runner on which public methods of this class should be called.
137 scoped_refptr<AutoThreadTaskRunner> caller_task_runner_; 154 scoped_refptr<AutoThreadTaskRunner> caller_task_runner_;
138 155
139 // Task runner on which keyboard/mouse input is injected. 156 // Task runner on which keyboard/mouse input is injected.
140 scoped_refptr<AutoThreadTaskRunner> input_task_runner_; 157 scoped_refptr<AutoThreadTaskRunner> input_task_runner_;
141 158
142 // Task runner used by the IPC channel. 159 // Task runner used by the IPC channel.
143 scoped_refptr<AutoThreadTaskRunner> io_task_runner_; 160 scoped_refptr<AutoThreadTaskRunner> io_task_runner_;
144 161
145 // Task runner dedicated to running methods of |video_capturer_|. 162 // Task runner dedicated to running methods of |video_capturer_|.
146 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner_; 163 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner_;
147 164
148 // Runs on |caller_task_runner_| to notify the caller that the network-to- 165 base::WeakPtr<Delegate> delegate_;
149 // desktop channel has been disconnected.
150 base::Closure disconnected_task_;
151 166
152 // Executes keyboard, mouse and clipboard events. 167 // Executes keyboard, mouse and clipboard events.
153 scoped_ptr<EventExecutor> event_executor_; 168 scoped_ptr<EventExecutor> event_executor_;
154 169
155 // IPC channel connecting the desktop process with the network process. 170 // IPC channel connecting the desktop process with the network process.
156 scoped_ptr<IPC::ChannelProxy> network_channel_; 171 scoped_ptr<IPC::ChannelProxy> network_channel_;
157 172
158 // Next shared buffer ID to be used. 173 // Next shared buffer ID to be used.
159 int next_shared_buffer_id_; 174 int next_shared_buffer_id_;
160 175
161 // List of the shared buffers registered via |SharedBufferFactory| interface. 176 // List of the shared buffers registered via |SharedBufferFactory| interface.
162 typedef std::list<scoped_refptr<SharedBuffer> > SharedBuffers; 177 typedef std::list<scoped_refptr<SharedBuffer> > SharedBuffers;
163 SharedBuffers shared_buffers_; 178 SharedBuffers shared_buffers_;
164 179
165 // Captures the screen. 180 // Captures the screen.
166 scoped_ptr<VideoFrameCapturer> video_capturer_; 181 scoped_ptr<VideoFrameCapturer> video_capturer_;
167 182
168 DISALLOW_COPY_AND_ASSIGN(DesktopSessionAgent); 183 DISALLOW_COPY_AND_ASSIGN(DesktopSessionAgent);
169 }; 184 };
170 185
171 } // namespace remoting 186 } // namespace remoting
172 187
173 #endif // REMOTING_HOST_DESKTOP_SESSION_AGENT_H_ 188 #endif // REMOTING_HOST_DESKTOP_SESSION_AGENT_H_
OLDNEW
« no previous file with comments | « remoting/host/desktop_process.cc ('k') | remoting/host/desktop_session_agent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698