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 #include "remoting/client/plugin/chromoting_instance.h" | 5 #include "remoting/client/plugin/chromoting_instance.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/json/json_reader.h" | 12 #include "base/json/json_reader.h" |
13 #include "base/json/json_writer.h" | 13 #include "base/json/json_writer.h" |
14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/stringprintf.h" | 16 #include "base/stringprintf.h" |
17 #include "base/string_split.h" | 17 #include "base/string_split.h" |
18 #include "base/synchronization/lock.h" | 18 #include "base/synchronization/lock.h" |
19 #include "base/synchronization/waitable_event.h" | 19 #include "base/synchronization/waitable_event.h" |
20 #include "base/threading/thread.h" | 20 #include "base/threading/thread.h" |
21 #include "base/values.h" | 21 #include "base/values.h" |
22 #include "jingle/glue/thread_wrapper.h" | 22 #include "jingle/glue/thread_wrapper.h" |
23 #include "media/base/media.h" | 23 #include "media/base/media.h" |
| 24 #include "net/socket/ssl_server_socket.h" |
24 #include "ppapi/cpp/completion_callback.h" | 25 #include "ppapi/cpp/completion_callback.h" |
25 #include "ppapi/cpp/input_event.h" | 26 #include "ppapi/cpp/input_event.h" |
26 #include "ppapi/cpp/mouse_cursor.h" | 27 #include "ppapi/cpp/mouse_cursor.h" |
27 #include "ppapi/cpp/rect.h" | 28 #include "ppapi/cpp/rect.h" |
28 #include "remoting/base/constants.h" | 29 #include "remoting/base/constants.h" |
29 #include "remoting/base/util.h" | 30 #include "remoting/base/util.h" |
30 #include "remoting/client/client_config.h" | 31 #include "remoting/client/client_config.h" |
31 #include "remoting/client/chromoting_client.h" | 32 #include "remoting/client/chromoting_client.h" |
32 #include "remoting/client/frame_consumer_proxy.h" | 33 #include "remoting/client/frame_consumer_proxy.h" |
33 #include "remoting/client/plugin/pepper_input_handler.h" | 34 #include "remoting/client/plugin/pepper_input_handler.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 181 |
181 VLOG(1) << "Started ChromotingInstance::Init"; | 182 VLOG(1) << "Started ChromotingInstance::Init"; |
182 | 183 |
183 // Check to make sure the media library is initialized. | 184 // Check to make sure the media library is initialized. |
184 // http://crbug.com/91521. | 185 // http://crbug.com/91521. |
185 if (!media::IsMediaLibraryInitialized()) { | 186 if (!media::IsMediaLibraryInitialized()) { |
186 LOG(ERROR) << "Media library not initialized."; | 187 LOG(ERROR) << "Media library not initialized."; |
187 return false; | 188 return false; |
188 } | 189 } |
189 | 190 |
| 191 // Enable support for SSL server sockets, which must be done as early as |
| 192 // possible, preferably before any NSS SSL sockets (client or server) have |
| 193 // been created. |
| 194 // It's possible that the hosting process has already made use of SSL, in |
| 195 // which case, there may be a slight race. |
| 196 net::EnableSSLServerSockets(); |
| 197 |
190 // Start all the threads. | 198 // Start all the threads. |
191 context_.Start(); | 199 context_.Start(); |
192 | 200 |
193 // Create the chromoting objects that don't depend on the network connection. | 201 // Create the chromoting objects that don't depend on the network connection. |
194 // RectangleUpdateDecoder runs on a separate thread so for now we wrap | 202 // RectangleUpdateDecoder runs on a separate thread so for now we wrap |
195 // PepperView with a ref-counted proxy object. | 203 // PepperView with a ref-counted proxy object. |
196 scoped_refptr<FrameConsumerProxy> consumer_proxy = | 204 scoped_refptr<FrameConsumerProxy> consumer_proxy = |
197 new FrameConsumerProxy(plugin_message_loop_); | 205 new FrameConsumerProxy(plugin_message_loop_); |
198 rectangle_decoder_ = new RectangleUpdateDecoder( | 206 rectangle_decoder_ = new RectangleUpdateDecoder( |
199 context_.decode_task_runner(), consumer_proxy); | 207 context_.decode_task_runner(), consumer_proxy); |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 PostChromotingMessage("logDebugMessage", data.Pass()); | 707 PostChromotingMessage("logDebugMessage", data.Pass()); |
700 g_logging_to_plugin = false; | 708 g_logging_to_plugin = false; |
701 } | 709 } |
702 | 710 |
703 bool ChromotingInstance::IsConnected() { | 711 bool ChromotingInstance::IsConnected() { |
704 return host_connection_.get() && | 712 return host_connection_.get() && |
705 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); | 713 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); |
706 } | 714 } |
707 | 715 |
708 } // namespace remoting | 716 } // namespace remoting |
OLD | NEW |