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 #ifndef REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ | 5 #ifndef REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ |
6 #define REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ | 6 #define REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 class DesktopSize; | 57 class DesktopSize; |
58 class DesktopVector; | 58 class DesktopVector; |
59 } // namespace webrtc | 59 } // namespace webrtc |
60 | 60 |
61 namespace remoting { | 61 namespace remoting { |
62 | 62 |
63 class PepperAudioPlayer; | 63 class PepperAudioPlayer; |
64 class ChromotingClient; | 64 class ChromotingClient; |
65 class ClientContext; | 65 class ClientContext; |
66 class DelegatingSignalStrategy; | 66 class DelegatingSignalStrategy; |
| 67 class LogToUI; |
67 class PepperAudioPlayer; | 68 class PepperAudioPlayer; |
68 class PepperMouseLocker; | 69 class PepperMouseLocker; |
69 | 70 |
70 class ChromotingInstance : public ClientUserInterface, | 71 class ChromotingInstance : public ClientUserInterface, |
71 public PepperVideoRenderer::EventHandler, | 72 public PepperVideoRenderer::EventHandler, |
72 public protocol::ClipboardStub, | 73 public protocol::ClipboardStub, |
73 public protocol::CursorShapeStub, | 74 public protocol::CursorShapeStub, |
74 public pp::Instance { | 75 public pp::Instance { |
75 public: | 76 public: |
76 // Plugin API version. This should be incremented whenever the API | 77 // Plugin API version. This should be incremented whenever the API |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 130 |
130 // protocol::CursorShapeStub interface. | 131 // protocol::CursorShapeStub interface. |
131 void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) override; | 132 void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) override; |
132 | 133 |
133 // PepperVideoRenderer::EventHandler interface. | 134 // PepperVideoRenderer::EventHandler interface. |
134 void OnVideoDecodeError() override; | 135 void OnVideoDecodeError() override; |
135 void OnVideoFirstFrameReceived() override; | 136 void OnVideoFirstFrameReceived() override; |
136 void OnVideoFrameDirtyRegion( | 137 void OnVideoFrameDirtyRegion( |
137 const webrtc::DesktopRegion& dirty_region) override; | 138 const webrtc::DesktopRegion& dirty_region) override; |
138 | 139 |
139 // Registers a global log message handler that redirects the log output to | 140 // Registers a global log message listener that redirects the log output to |
140 // our plugin instance. | 141 // our plugin instance. |
141 // This is called by the plugin's PPP_InitializeModule. | 142 // This is called by the plugin's PPP_InitializeModule. |
142 // Note that no logging will be processed unless a ChromotingInstance has been | 143 // Note that no logging will be processed unless a ChromotingInstance has been |
143 // registered for logging (see RegisterLoggingInstance). | 144 // registered for logging (see RegisterLoggingInstance). |
144 static void RegisterLogMessageHandler(); | 145 static void RegisterLogMessageListener(); |
145 | 146 |
146 // Registers this instance so it processes messages sent by the global log | 147 // Registers this instance so it processes messages sent by the global log |
147 // message handler. This overwrites any previously registered instance. | 148 // message handler. This overwrites any previously registered instance. |
148 void RegisterLoggingInstance(); | 149 void RegisterLoggingInstance(); |
149 | 150 |
150 // Unregisters this instance so that debug log messages will no longer be sent | 151 // Unregisters this instance so that debug log messages will no longer be sent |
151 // to it. If this instance is not the currently registered logging instance, | 152 // to it. If this instance is not the currently registered logging instance, |
152 // then the currently registered instance will stay in effect. | 153 // then the currently registered instance will stay in effect. |
153 void UnregisterLoggingInstance(); | 154 void UnregisterLoggingInstance(); |
154 | 155 |
155 // A Log Message Handler that is called after each LOG message has been | |
156 // processed. This must be of type LogMessageHandlerFunction defined in | |
157 // base/logging.h. | |
158 static bool LogToUI(int severity, const char* file, int line, | |
159 size_t message_start, const std::string& str); | |
160 | |
161 // Requests the webapp to fetch a third-party token. | 156 // Requests the webapp to fetch a third-party token. |
162 void FetchThirdPartyToken( | 157 void FetchThirdPartyToken( |
163 const std::string& host_public_key, | 158 const std::string& host_public_key, |
164 const std::string& token_url, | 159 const std::string& token_url, |
165 const std::string& scope, | 160 const std::string& scope, |
166 const protocol::ThirdPartyTokenFetchedCallback& token_fetched_callback); | 161 const protocol::ThirdPartyTokenFetchedCallback& token_fetched_callback); |
167 | 162 |
168 // Updates the specified UMA enumeration histogram with the input value. | 163 // Updates the specified UMA enumeration histogram with the input value. |
169 void UpdateUmaEnumHistogram(const std::string& histogram_name, | 164 void UpdateUmaEnumHistogram(const std::string& histogram_name, |
170 int64_t value, | 165 int64_t value, |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 | 281 |
287 base::RepeatingTimer stats_update_timer_; | 282 base::RepeatingTimer stats_update_timer_; |
288 | 283 |
289 base::TimeTicks connection_started_time; | 284 base::TimeTicks connection_started_time; |
290 base::TimeTicks connection_authenticated_time_; | 285 base::TimeTicks connection_authenticated_time_; |
291 base::TimeTicks connection_connected_time_; | 286 base::TimeTicks connection_connected_time_; |
292 | 287 |
293 // Weak reference to this instance, used for global logging and task posting. | 288 // Weak reference to this instance, used for global logging and task posting. |
294 base::WeakPtrFactory<ChromotingInstance> weak_factory_; | 289 base::WeakPtrFactory<ChromotingInstance> weak_factory_; |
295 | 290 |
| 291 std::unique_ptr<LogToUI> log_to_ui_; |
| 292 |
296 DISALLOW_COPY_AND_ASSIGN(ChromotingInstance); | 293 DISALLOW_COPY_AND_ASSIGN(ChromotingInstance); |
297 }; | 294 }; |
298 | 295 |
299 } // namespace remoting | 296 } // namespace remoting |
300 | 297 |
301 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ | 298 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ |
OLD | NEW |