OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/json/json_reader.h" | 11 #include "base/json/json_reader.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "base/stringprintf.h" | 14 #include "base/stringprintf.h" |
15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
16 #include "base/synchronization/waitable_event.h" | 16 #include "base/synchronization/waitable_event.h" |
17 #include "base/task.h" | 17 #include "base/task.h" |
18 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
19 #include "base/values.h" | 19 #include "base/values.h" |
20 // TODO(sergeyu): We should not depend on renderer here. Instead P2P | |
21 // Pepper API should be used. Remove this dependency. | |
22 // crbug.com/74951 | |
23 #include "content/renderer/p2p/ipc_network_manager.h" | |
24 #include "content/renderer/p2p/ipc_socket_factory.h" | |
25 #include "media/base/media.h" | 20 #include "media/base/media.h" |
26 #include "ppapi/c/dev/ppb_query_policy_dev.h" | 21 #include "ppapi/c/dev/ppb_query_policy_dev.h" |
27 #include "ppapi/cpp/completion_callback.h" | 22 #include "ppapi/cpp/completion_callback.h" |
28 #include "ppapi/cpp/input_event.h" | 23 #include "ppapi/cpp/input_event.h" |
29 #include "ppapi/cpp/rect.h" | 24 #include "ppapi/cpp/rect.h" |
30 // TODO(wez): Remove this when crbug.com/86353 is complete. | 25 // TODO(wez): Remove this when crbug.com/86353 is complete. |
31 #include "ppapi/cpp/private/var_private.h" | 26 #include "ppapi/cpp/private/var_private.h" |
32 #include "remoting/base/task_thread_proxy.h" | 27 #include "remoting/base/task_thread_proxy.h" |
33 #include "remoting/base/util.h" | 28 #include "remoting/base/util.h" |
34 #include "remoting/client/client_config.h" | 29 #include "remoting/client/client_config.h" |
35 #include "remoting/client/chromoting_client.h" | 30 #include "remoting/client/chromoting_client.h" |
36 #include "remoting/client/ipc_host_resolver.h" | |
37 #include "remoting/client/plugin/chromoting_scriptable_object.h" | 31 #include "remoting/client/plugin/chromoting_scriptable_object.h" |
38 #include "remoting/client/plugin/pepper_input_handler.h" | 32 #include "remoting/client/plugin/pepper_input_handler.h" |
39 #include "remoting/client/plugin/pepper_port_allocator_session.h" | 33 #include "remoting/client/plugin/pepper_port_allocator_session.h" |
40 #include "remoting/client/plugin/pepper_view.h" | 34 #include "remoting/client/plugin/pepper_view.h" |
41 #include "remoting/client/plugin/pepper_view_proxy.h" | 35 #include "remoting/client/plugin/pepper_view_proxy.h" |
42 #include "remoting/client/plugin/pepper_xmpp_proxy.h" | 36 #include "remoting/client/plugin/pepper_xmpp_proxy.h" |
43 #include "remoting/client/rectangle_update_decoder.h" | 37 #include "remoting/client/rectangle_update_decoder.h" |
44 #include "remoting/proto/auth.pb.h" | 38 #include "remoting/proto/auth.pb.h" |
45 #include "remoting/protocol/connection_to_host.h" | 39 #include "remoting/protocol/connection_to_host.h" |
46 #include "remoting/protocol/host_stub.h" | 40 #include "remoting/protocol/host_stub.h" |
47 // TODO(sergeyu): This is a hack: plugin should not depend on webkit | |
48 // glue. It is used here to get P2PPacketDispatcher corresponding to | |
49 // the current RenderView. Use P2P Pepper API for connection and | |
50 // remove these includes. | |
51 // crbug.com/74951 | |
52 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | |
53 #include "webkit/plugins/ppapi/resource_tracker.h" | |
54 | 41 |
55 namespace remoting { | 42 namespace remoting { |
56 | 43 |
57 namespace { | 44 namespace { |
58 | 45 |
59 const char kClientFirewallTraversalPolicyName[] = | 46 const char kClientFirewallTraversalPolicyName[] = |
60 "remote_access.client_firewall_traversal"; | 47 "remote_access.client_firewall_traversal"; |
61 | 48 |
62 } // namespace | 49 } // namespace |
63 | 50 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // occurs before the enterprise policy is read. We are guaranteed that the | 150 // occurs before the enterprise policy is read. We are guaranteed that the |
164 // enterprise policy is pushed at least once, we we delay the connect call. | 151 // enterprise policy is pushed at least once, we we delay the connect call. |
165 if (!initial_policy_received_) { | 152 if (!initial_policy_received_) { |
166 LOG(INFO) << "Delaying connect until initial policy is read."; | 153 LOG(INFO) << "Delaying connect until initial policy is read."; |
167 delayed_connect_.reset( | 154 delayed_connect_.reset( |
168 task_factory_.NewRunnableMethod(&ChromotingInstance::Connect, config)); | 155 task_factory_.NewRunnableMethod(&ChromotingInstance::Connect, config)); |
169 return; | 156 return; |
170 } | 157 } |
171 | 158 |
172 host_connection_.reset(new protocol::ConnectionToHost( | 159 host_connection_.reset(new protocol::ConnectionToHost( |
173 context_.network_message_loop(), this, NULL, NULL, NULL, NULL, | 160 context_.network_message_loop(), this, enable_client_nat_traversal_)); |
174 enable_client_nat_traversal_)); | |
175 | 161 |
176 input_handler_.reset(new PepperInputHandler(&context_, | 162 input_handler_.reset(new PepperInputHandler(&context_, |
177 host_connection_.get(), | 163 host_connection_.get(), |
178 view_proxy_)); | 164 view_proxy_)); |
179 | 165 |
180 client_.reset(new ChromotingClient(config, &context_, host_connection_.get(), | 166 client_.reset(new ChromotingClient(config, &context_, host_connection_.get(), |
181 view_proxy_, rectangle_decoder_.get(), | 167 view_proxy_, rectangle_decoder_.get(), |
182 input_handler_.get(), NULL)); | 168 input_handler_.get(), NULL)); |
183 | 169 |
184 LOG(INFO) << "Connecting."; | 170 LOG(INFO) << "Connecting."; |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 } | 512 } |
527 | 513 |
528 initial_policy_received_ = true; | 514 initial_policy_received_ = true; |
529 enable_client_nat_traversal_ = traversal_policy; | 515 enable_client_nat_traversal_ = traversal_policy; |
530 | 516 |
531 if (delayed_connect_.get()) | 517 if (delayed_connect_.get()) |
532 plugin_message_loop_->PostTask(FROM_HERE, delayed_connect_.release()); | 518 plugin_message_loop_->PostTask(FROM_HERE, delayed_connect_.release()); |
533 } | 519 } |
534 | 520 |
535 } // namespace remoting | 521 } // namespace remoting |
OLD | NEW |