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

Side by Side Diff: remoting/client/plugin/chromoting_instance.h

Issue 12518027: Protocol / client plugin changes to support interactively asking for a PIN (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix comments Created 7 years, 9 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 unified diff | Download patch
« no previous file with comments | « remoting/client/client_config.h ('k') | remoting/client/plugin/chromoting_instance.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 // TODO(ajwong): We need to come up with a better description of the 5 // TODO(ajwong): We need to come up with a better description of the
6 // responsibilities for each thread. 6 // responsibilities for each thread.
7 7
8 #ifndef REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ 8 #ifndef REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_
9 #define REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ 9 #define REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_
10 10
(...skipping 21 matching lines...) Expand all
32 #include "remoting/client/key_event_mapper.h" 32 #include "remoting/client/key_event_mapper.h"
33 #include "remoting/client/plugin/mac_key_event_processor.h" 33 #include "remoting/client/plugin/mac_key_event_processor.h"
34 #include "remoting/client/plugin/pepper_input_handler.h" 34 #include "remoting/client/plugin/pepper_input_handler.h"
35 #include "remoting/client/plugin/pepper_plugin_thread_delegate.h" 35 #include "remoting/client/plugin/pepper_plugin_thread_delegate.h"
36 #include "remoting/proto/event.pb.h" 36 #include "remoting/proto/event.pb.h"
37 #include "remoting/protocol/clipboard_stub.h" 37 #include "remoting/protocol/clipboard_stub.h"
38 #include "remoting/protocol/connection_to_host.h" 38 #include "remoting/protocol/connection_to_host.h"
39 #include "remoting/protocol/cursor_shape_stub.h" 39 #include "remoting/protocol/cursor_shape_stub.h"
40 #include "remoting/protocol/input_event_tracker.h" 40 #include "remoting/protocol/input_event_tracker.h"
41 #include "remoting/protocol/mouse_input_filter.h" 41 #include "remoting/protocol/mouse_input_filter.h"
42 #include "remoting/protocol/negotiating_authenticator.h"
42 43
43 namespace base { 44 namespace base {
44 class DictionaryValue; 45 class DictionaryValue;
45 } // namespace base 46 } // namespace base
46 47
47 namespace pp { 48 namespace pp {
48 class InputEvent; 49 class InputEvent;
49 class Module; 50 class Module;
50 } // namespace pp 51 } // namespace pp
51 52
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 const protocol::ClipboardEvent& event) OVERRIDE; 114 const protocol::ClipboardEvent& event) OVERRIDE;
114 115
115 // protocol::CursorShapeStub interface. 116 // protocol::CursorShapeStub interface.
116 virtual void SetCursorShape( 117 virtual void SetCursorShape(
117 const protocol::CursorShapeInfo& cursor_shape) OVERRIDE; 118 const protocol::CursorShapeInfo& cursor_shape) OVERRIDE;
118 119
119 // Called by PepperView. 120 // Called by PepperView.
120 void SetDesktopSize(const SkISize& size, const SkIPoint& dpi); 121 void SetDesktopSize(const SkISize& size, const SkIPoint& dpi);
121 void OnFirstFrameReceived(); 122 void OnFirstFrameReceived();
122 123
123 // Message handlers for messages that come from JavaScript. Called
124 // from HandleMessage().
125 void Connect(const ClientConfig& config);
126 void Disconnect();
127 void OnIncomingIq(const std::string& iq);
128 void ReleaseAllKeys();
129 void InjectKeyEvent(const protocol::KeyEvent& event);
130 void RemapKey(uint32 in_usb_keycode, uint32 out_usb_keycode);
131 void TrapKey(uint32 usb_keycode, bool trap);
132 void SendClipboardItem(const std::string& mime_type, const std::string& item);
133 void NotifyClientResolution(int width, int height, int x_dpi, int y_dpi);
134 void PauseVideo(bool pause);
135 void PauseAudio(bool pause);
136
137 // Return statistics record by ChromotingClient. 124 // Return statistics record by ChromotingClient.
138 // If no connection is currently active then NULL will be returned. 125 // If no connection is currently active then NULL will be returned.
139 ChromotingStats* GetStats(); 126 ChromotingStats* GetStats();
140 127
141 // Registers a global log message handler that redirects the log output to 128 // Registers a global log message handler that redirects the log output to
142 // our plugin instance. 129 // our plugin instance.
143 // This is called by the plugin's PPP_InitializeModule. 130 // This is called by the plugin's PPP_InitializeModule.
144 // Note that no logging will be processed unless a ChromotingInstance has been 131 // Note that no logging will be processed unless a ChromotingInstance has been
145 // registered for logging (see RegisterLoggingInstance). 132 // registered for logging (see RegisterLoggingInstance).
146 static void RegisterLogMessageHandler(); 133 static void RegisterLogMessageHandler();
147 134
148 // Registers this instance so it processes messages sent by the global log 135 // Registers this instance so it processes messages sent by the global log
149 // message handler. This overwrites any previously registered instance. 136 // message handler. This overwrites any previously registered instance.
150 void RegisterLoggingInstance(); 137 void RegisterLoggingInstance();
151 138
152 // Unregisters this instance so that debug log messages will no longer be sent 139 // Unregisters this instance so that debug log messages will no longer be sent
153 // to it. If this instance is not the currently registered logging instance, 140 // to it. If this instance is not the currently registered logging instance,
154 // then the currently registered instance will stay in effect. 141 // then the currently registered instance will stay in effect.
155 void UnregisterLoggingInstance(); 142 void UnregisterLoggingInstance();
156 143
157 // A Log Message Handler that is called after each LOG message has been 144 // A Log Message Handler that is called after each LOG message has been
158 // processed. This must be of type LogMessageHandlerFunction defined in 145 // processed. This must be of type LogMessageHandlerFunction defined in
159 // base/logging.h. 146 // base/logging.h.
160 static bool LogToUI(int severity, const char* file, int line, 147 static bool LogToUI(int severity, const char* file, int line,
161 size_t message_start, const std::string& str); 148 size_t message_start, const std::string& str);
162 149
163 private: 150 private:
164 FRIEND_TEST_ALL_PREFIXES(ChromotingInstanceTest, TestCaseSetup); 151 FRIEND_TEST_ALL_PREFIXES(ChromotingInstanceTest, TestCaseSetup);
165 152
153 // Used as the |FetchSecretCallback| for IT2Me (or Me2Me from old webapps).
154 // Immediately calls |secret_fetched_callback| with |shared_secret|.
155 static void FetchSecretFromString(
156 const std::string& shared_secret,
157 const protocol::SecretFetchedCallback& secret_fetched_callback);
158
159 // Message handlers for messages that come from JavaScript. Called
160 // from HandleMessage().
161 void Connect(const ClientConfig& config);
162 void Disconnect();
163 void OnIncomingIq(const std::string& iq);
164 void ReleaseAllKeys();
165 void InjectKeyEvent(const protocol::KeyEvent& event);
166 void RemapKey(uint32 in_usb_keycode, uint32 out_usb_keycode);
167 void TrapKey(uint32 usb_keycode, bool trap);
168 void SendClipboardItem(const std::string& mime_type, const std::string& item);
169 void NotifyClientResolution(int width, int height, int x_dpi, int y_dpi);
170 void PauseVideo(bool pause);
171 void PauseAudio(bool pause);
172 void OnPinFetched(const std::string& pin);
173
166 // Helper method to post messages to the webapp. 174 // Helper method to post messages to the webapp.
167 void PostChromotingMessage(const std::string& method, 175 void PostChromotingMessage(const std::string& method,
168 scoped_ptr<base::DictionaryValue> data); 176 scoped_ptr<base::DictionaryValue> data);
169 177
170 // Posts trapped keys to the web-app to handle. 178 // Posts trapped keys to the web-app to handle.
171 void SendTrappedKey(uint32 usb_keycode, bool pressed); 179 void SendTrappedKey(uint32 usb_keycode, bool pressed);
172 180
173 // Callback for PepperXmppProxy. 181 // Callback for PepperXmppProxy.
174 void SendOutgoingIq(const std::string& iq); 182 void SendOutgoingIq(const std::string& iq);
175 183
176 void SendPerfStats(); 184 void SendPerfStats();
177 185
178 void ProcessLogToUI(const std::string& message); 186 void ProcessLogToUI(const std::string& message);
179 187
180 // Returns true if the hosting content has the chrome-extension:// scheme. 188 // Returns true if the hosting content has the chrome-extension:// scheme.
181 bool IsCallerAppOrExtension(); 189 bool IsCallerAppOrExtension();
182 190
183 // Returns true if there is a ConnectionToHost and it is connected. 191 // Returns true if there is a ConnectionToHost and it is connected.
184 bool IsConnected(); 192 bool IsConnected();
185 193
194 // Used as the |FetchSecretCallback| for Me2Me connections.
195 // Uses the PIN request dialog in the webapp to obtain the shared secret.
196 void FetchSecretFromDialog(
197 const protocol::SecretFetchedCallback& secret_fetched_callback);
198
186 bool initialized_; 199 bool initialized_;
187 200
188 PepperPluginThreadDelegate plugin_thread_delegate_; 201 PepperPluginThreadDelegate plugin_thread_delegate_;
189 scoped_refptr<PluginThreadTaskRunner> plugin_task_runner_; 202 scoped_refptr<PluginThreadTaskRunner> plugin_task_runner_;
190 ClientContext context_; 203 ClientContext context_;
191 scoped_refptr<RectangleUpdateDecoder> rectangle_decoder_; 204 scoped_refptr<RectangleUpdateDecoder> rectangle_decoder_;
192 scoped_ptr<PepperView> view_; 205 scoped_ptr<PepperView> view_;
193 pp::View plugin_view_; 206 pp::View plugin_view_;
194 207
195 scoped_ptr<protocol::ConnectionToHost> host_connection_; 208 scoped_ptr<protocol::ConnectionToHost> host_connection_;
196 scoped_ptr<ChromotingClient> client_; 209 scoped_ptr<ChromotingClient> client_;
197 210
198 // Input pipeline components, in reverse order of distance from input source. 211 // Input pipeline components, in reverse order of distance from input source.
199 protocol::MouseInputFilter mouse_input_filter_; 212 protocol::MouseInputFilter mouse_input_filter_;
200 protocol::InputEventTracker input_tracker_; 213 protocol::InputEventTracker input_tracker_;
201 #if defined(OS_MACOSX) 214 #if defined(OS_MACOSX)
202 MacKeyEventProcessor mac_key_event_processor_; 215 MacKeyEventProcessor mac_key_event_processor_;
203 #endif 216 #endif
204 KeyEventMapper key_mapper_; 217 KeyEventMapper key_mapper_;
205 PepperInputHandler input_handler_; 218 PepperInputHandler input_handler_;
206 219
207 // XmppProxy is a refcounted interface used to perform thread-switching and 220 // XmppProxy is a refcounted interface used to perform thread-switching and
208 // detaching between objects whose lifetimes are controlled by pepper, and 221 // detaching between objects whose lifetimes are controlled by pepper, and
209 // jingle_glue objects. This is used when if we start a sandboxed jingle 222 // jingle_glue objects. This is used when if we start a sandboxed jingle
210 // connection. 223 // connection.
211 scoped_refptr<PepperXmppProxy> xmpp_proxy_; 224 scoped_refptr<PepperXmppProxy> xmpp_proxy_;
212 225
226 // PIN Fetcher.
227 bool use_async_pin_dialog_;
228 protocol::SecretFetchedCallback secret_fetched_callback_;
229
213 base::WeakPtrFactory<ChromotingInstance> weak_factory_; 230 base::WeakPtrFactory<ChromotingInstance> weak_factory_;
214 231
215 DISALLOW_COPY_AND_ASSIGN(ChromotingInstance); 232 DISALLOW_COPY_AND_ASSIGN(ChromotingInstance);
216 }; 233 };
217 234
218 } // namespace remoting 235 } // namespace remoting
219 236
220 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ 237 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_
OLDNEW
« no previous file with comments | « remoting/client/client_config.h ('k') | remoting/client/plugin/chromoting_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698