OLD | NEW |
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 Loading... |
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/pin_fetcher_factory.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 |
52 namespace remoting { | 53 namespace remoting { |
53 | 54 |
54 class ChromotingClient; | 55 class ChromotingClient; |
55 class ChromotingStats; | 56 class ChromotingStats; |
56 class ClientContext; | 57 class ClientContext; |
57 class FrameConsumerProxy; | 58 class FrameConsumerProxy; |
58 class PepperAudioPlayer; | 59 class PepperAudioPlayer; |
| 60 class PepperPinFetcher; |
59 class PepperView; | 61 class PepperView; |
60 class PepperXmppProxy; | 62 class PepperXmppProxy; |
61 class RectangleUpdateDecoder; | 63 class RectangleUpdateDecoder; |
62 | 64 |
63 struct ClientConfig; | 65 struct ClientConfig; |
64 | 66 |
65 class ChromotingInstance : | 67 class ChromotingInstance : |
66 public ClientUserInterface, | 68 public ClientUserInterface, |
67 public protocol::ClipboardStub, | 69 public protocol::ClipboardStub, |
68 public protocol::CursorShapeStub, | 70 public protocol::CursorShapeStub, |
| 71 public protocol::PinFetcherFactory, |
69 public pp::Instance, | 72 public pp::Instance, |
70 public base::SupportsWeakPtr<ChromotingInstance> { | 73 public base::SupportsWeakPtr<ChromotingInstance> { |
71 public: | 74 public: |
72 // Plugin API version. This should be incremented whenever the API | 75 // Plugin API version. This should be incremented whenever the API |
73 // interface changes. | 76 // interface changes. |
74 static const int kApiVersion = 7; | 77 static const int kApiVersion = 7; |
75 | 78 |
76 // Plugin API features. This allows orthogonal features to be supported | 79 // Plugin API features. This allows orthogonal features to be supported |
77 // without bumping the API version. | 80 // without bumping the API version. |
78 static const char kApiFeatures[]; | 81 static const char kApiFeatures[]; |
(...skipping 21 matching lines...) Expand all Loading... |
100 const char* argv[]) OVERRIDE; | 103 const char* argv[]) OVERRIDE; |
101 virtual void HandleMessage(const pp::Var& message) OVERRIDE; | 104 virtual void HandleMessage(const pp::Var& message) OVERRIDE; |
102 virtual bool HandleInputEvent(const pp::InputEvent& event) OVERRIDE; | 105 virtual bool HandleInputEvent(const pp::InputEvent& event) OVERRIDE; |
103 | 106 |
104 // ClientUserInterface interface. | 107 // ClientUserInterface interface. |
105 virtual void OnConnectionState(protocol::ConnectionToHost::State state, | 108 virtual void OnConnectionState(protocol::ConnectionToHost::State state, |
106 protocol::ErrorCode error) OVERRIDE; | 109 protocol::ErrorCode error) OVERRIDE; |
107 virtual void OnConnectionReady(bool ready) OVERRIDE; | 110 virtual void OnConnectionReady(bool ready) OVERRIDE; |
108 virtual protocol::ClipboardStub* GetClipboardStub() OVERRIDE; | 111 virtual protocol::ClipboardStub* GetClipboardStub() OVERRIDE; |
109 virtual protocol::CursorShapeStub* GetCursorShapeStub() OVERRIDE; | 112 virtual protocol::CursorShapeStub* GetCursorShapeStub() OVERRIDE; |
| 113 virtual protocol::PinFetcherFactory* GetPinFetcherFactory() OVERRIDE; |
110 | 114 |
111 // protocol::ClipboardStub interface. | 115 // protocol::ClipboardStub interface. |
112 virtual void InjectClipboardEvent( | 116 virtual void InjectClipboardEvent( |
113 const protocol::ClipboardEvent& event) OVERRIDE; | 117 const protocol::ClipboardEvent& event) OVERRIDE; |
114 | 118 |
115 // protocol::CursorShapeStub interface. | 119 // protocol::CursorShapeStub interface. |
116 virtual void SetCursorShape( | 120 virtual void SetCursorShape( |
117 const protocol::CursorShapeInfo& cursor_shape) OVERRIDE; | 121 const protocol::CursorShapeInfo& cursor_shape) OVERRIDE; |
118 | 122 |
| 123 // protocol::PinFetcherFactory interface. |
| 124 virtual scoped_ptr<protocol::PinFetcher> CreatePinFetcher() OVERRIDE; |
| 125 |
| 126 // Called by PepperPinFetcher. |
| 127 void FetchPin(base::WeakPtr<PepperPinFetcher> pin_fetcher); |
| 128 |
119 // Called by PepperView. | 129 // Called by PepperView. |
120 void SetDesktopSize(const SkISize& size, const SkIPoint& dpi); | 130 void SetDesktopSize(const SkISize& size, const SkIPoint& dpi); |
121 void OnFirstFrameReceived(); | 131 void OnFirstFrameReceived(); |
122 | 132 |
123 // Message handlers for messages that come from JavaScript. Called | 133 // Message handlers for messages that come from JavaScript. Called |
124 // from HandleMessage(). | 134 // from HandleMessage(). |
125 void Connect(const ClientConfig& config); | 135 void Connect(const ClientConfig& config); |
126 void Disconnect(); | 136 void Disconnect(); |
127 void OnIncomingIq(const std::string& iq); | 137 void OnIncomingIq(const std::string& iq); |
128 void ReleaseAllKeys(); | 138 void ReleaseAllKeys(); |
129 void InjectKeyEvent(const protocol::KeyEvent& event); | 139 void InjectKeyEvent(const protocol::KeyEvent& event); |
130 void RemapKey(uint32 in_usb_keycode, uint32 out_usb_keycode); | 140 void RemapKey(uint32 in_usb_keycode, uint32 out_usb_keycode); |
131 void TrapKey(uint32 usb_keycode, bool trap); | 141 void TrapKey(uint32 usb_keycode, bool trap); |
132 void SendClipboardItem(const std::string& mime_type, const std::string& item); | 142 void SendClipboardItem(const std::string& mime_type, const std::string& item); |
133 void NotifyClientResolution(int width, int height, int x_dpi, int y_dpi); | 143 void NotifyClientResolution(int width, int height, int x_dpi, int y_dpi); |
134 void PauseVideo(bool pause); | 144 void PauseVideo(bool pause); |
135 void PauseAudio(bool pause); | 145 void PauseAudio(bool pause); |
| 146 void OnPinFetched(const std::string& shared_secret); |
136 | 147 |
137 // Return statistics record by ChromotingClient. | 148 // Return statistics record by ChromotingClient. |
138 // If no connection is currently active then NULL will be returned. | 149 // If no connection is currently active then NULL will be returned. |
139 ChromotingStats* GetStats(); | 150 ChromotingStats* GetStats(); |
140 | 151 |
141 // Registers a global log message handler that redirects the log output to | 152 // Registers a global log message handler that redirects the log output to |
142 // our plugin instance. | 153 // our plugin instance. |
143 // This is called by the plugin's PPP_InitializeModule. | 154 // This is called by the plugin's PPP_InitializeModule. |
144 // Note that no logging will be processed unless a ChromotingInstance has been | 155 // Note that no logging will be processed unless a ChromotingInstance has been |
145 // registered for logging (see RegisterLoggingInstance). | 156 // registered for logging (see RegisterLoggingInstance). |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 #endif | 214 #endif |
204 KeyEventMapper key_mapper_; | 215 KeyEventMapper key_mapper_; |
205 PepperInputHandler input_handler_; | 216 PepperInputHandler input_handler_; |
206 | 217 |
207 // XmppProxy is a refcounted interface used to perform thread-switching and | 218 // XmppProxy is a refcounted interface used to perform thread-switching and |
208 // detaching between objects whose lifetimes are controlled by pepper, and | 219 // detaching between objects whose lifetimes are controlled by pepper, and |
209 // jingle_glue objects. This is used when if we start a sandboxed jingle | 220 // jingle_glue objects. This is used when if we start a sandboxed jingle |
210 // connection. | 221 // connection. |
211 scoped_refptr<PepperXmppProxy> xmpp_proxy_; | 222 scoped_refptr<PepperXmppProxy> xmpp_proxy_; |
212 | 223 |
| 224 // PIN Fetcher. |
| 225 bool use_async_pin_dialog_; |
| 226 base::WeakPtr<PepperPinFetcher> pin_fetcher_; |
| 227 |
213 base::WeakPtrFactory<ChromotingInstance> weak_factory_; | 228 base::WeakPtrFactory<ChromotingInstance> weak_factory_; |
214 | 229 |
215 DISALLOW_COPY_AND_ASSIGN(ChromotingInstance); | 230 DISALLOW_COPY_AND_ASSIGN(ChromotingInstance); |
216 }; | 231 }; |
217 | 232 |
218 } // namespace remoting | 233 } // namespace remoting |
219 | 234 |
220 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ | 235 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ |
OLD | NEW |