| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "blimp/engine/session/blimp_engine_session.h" | 5 #include "blimp/engine/session/blimp_engine_session.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
| 14 #include "base/trace_event/trace_event.h" | 14 #include "base/trace_event/trace_event.h" |
| 15 #include "blimp/common/create_blimp_message.h" | 15 #include "blimp/common/create_blimp_message.h" |
| 16 #include "blimp/common/proto/tab_control.pb.h" | 16 #include "blimp/common/proto/tab_control.pb.h" |
| 17 #include "blimp/engine/app/blimp_engine_config.h" | 17 #include "blimp/engine/app/blimp_engine_config.h" |
| 18 #include "blimp/engine/app/settings_manager.h" | 18 #include "blimp/engine/app/settings_manager.h" |
| 19 #include "blimp/engine/app/switches.h" | 19 #include "blimp/engine/app/switches.h" |
| 20 #include "blimp/engine/app/ui/blimp_layout_manager.h" | 20 #include "blimp/engine/app/ui/blimp_layout_manager.h" |
| 21 #include "blimp/engine/app/ui/blimp_screen.h" | 21 #include "blimp/engine/app/ui/blimp_screen.h" |
| 22 #include "blimp/engine/app/ui/blimp_window_tree_client.h" | 22 #include "blimp/engine/app/ui/blimp_window_tree_client.h" |
| 23 #include "blimp/engine/app/ui/blimp_window_tree_host.h" | 23 #include "blimp/engine/app/ui/blimp_window_tree_host.h" |
| 24 #include "blimp/engine/common/blimp_browser_context.h" | 24 #include "blimp/engine/common/blimp_browser_context.h" |
| 25 #include "blimp/net/blimp_connection.h" | 25 #include "blimp/net/blimp_connection.h" |
| 26 #include "blimp/net/blimp_connection_statistics.h" | |
| 27 #include "blimp/net/blimp_message_multiplexer.h" | 26 #include "blimp/net/blimp_message_multiplexer.h" |
| 28 #include "blimp/net/blimp_message_thread_pipe.h" | 27 #include "blimp/net/blimp_message_thread_pipe.h" |
| 29 #include "blimp/net/browser_connection_handler.h" | 28 #include "blimp/net/browser_connection_handler.h" |
| 30 #include "blimp/net/common.h" | 29 #include "blimp/net/common.h" |
| 31 #include "blimp/net/engine_authentication_handler.h" | 30 #include "blimp/net/engine_authentication_handler.h" |
| 32 #include "blimp/net/engine_connection_manager.h" | 31 #include "blimp/net/engine_connection_manager.h" |
| 33 #include "blimp/net/null_blimp_message_processor.h" | 32 #include "blimp/net/null_blimp_message_processor.h" |
| 34 #include "blimp/net/tcp_engine_transport.h" | 33 #include "blimp/net/tcp_engine_transport.h" |
| 35 #include "blimp/net/thread_pipe_manager.h" | 34 #include "blimp/net/thread_pipe_manager.h" |
| 36 #include "content/public/browser/browser_context.h" | 35 #include "content/public/browser/browser_context.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // terminated. | 141 // terminated. |
| 143 void OnConnectionError(int error) override; | 142 void OnConnectionError(int error) override; |
| 144 | 143 |
| 145 net::NetLog* net_log_; | 144 net::NetLog* net_log_; |
| 146 base::Closure quit_closure_; | 145 base::Closure quit_closure_; |
| 147 uint16_t port_ = 0; | 146 uint16_t port_ = 0; |
| 148 | 147 |
| 149 std::unique_ptr<BrowserConnectionHandler> connection_handler_; | 148 std::unique_ptr<BrowserConnectionHandler> connection_handler_; |
| 150 std::unique_ptr<EngineAuthenticationHandler> authentication_handler_; | 149 std::unique_ptr<EngineAuthenticationHandler> authentication_handler_; |
| 151 std::unique_ptr<EngineConnectionManager> connection_manager_; | 150 std::unique_ptr<EngineConnectionManager> connection_manager_; |
| 152 BlimpConnectionStatistics blimp_connection_statistics_; | |
| 153 | 151 |
| 154 DISALLOW_COPY_AND_ASSIGN(EngineNetworkComponents); | 152 DISALLOW_COPY_AND_ASSIGN(EngineNetworkComponents); |
| 155 }; | 153 }; |
| 156 | 154 |
| 157 EngineNetworkComponents::EngineNetworkComponents( | 155 EngineNetworkComponents::EngineNetworkComponents( |
| 158 net::NetLog* net_log, | 156 net::NetLog* net_log, |
| 159 const base::Closure& quit_closure) | 157 const base::Closure& quit_closure) |
| 160 : net_log_(net_log), | 158 : net_log_(net_log), |
| 161 quit_closure_(quit_closure), | 159 quit_closure_(quit_closure), |
| 162 connection_handler_(new BrowserConnectionHandler) {} | 160 connection_handler_(new BrowserConnectionHandler) {} |
| (...skipping 10 matching lines...) Expand all Loading... |
| 173 // to |this| (which will then pass it to |connection_handler_|. | 171 // to |this| (which will then pass it to |connection_handler_|. |
| 174 authentication_handler_ = | 172 authentication_handler_ = |
| 175 base::WrapUnique(new EngineAuthenticationHandler(this, client_token)); | 173 base::WrapUnique(new EngineAuthenticationHandler(this, client_token)); |
| 176 | 174 |
| 177 // Plumb unauthenticated connections to |authentication_handler_|. | 175 // Plumb unauthenticated connections to |authentication_handler_|. |
| 178 connection_manager_ = base::WrapUnique( | 176 connection_manager_ = base::WrapUnique( |
| 179 new EngineConnectionManager(authentication_handler_.get())); | 177 new EngineConnectionManager(authentication_handler_.get())); |
| 180 | 178 |
| 181 // Adds BlimpTransports to connection_manager_. | 179 // Adds BlimpTransports to connection_manager_. |
| 182 net::IPEndPoint address(GetIPv4AnyAddress(), GetListeningPort()); | 180 net::IPEndPoint address(GetIPv4AnyAddress(), GetListeningPort()); |
| 183 TCPEngineTransport* transport = | 181 TCPEngineTransport* transport = new TCPEngineTransport(address, net_log_); |
| 184 new TCPEngineTransport(address, &blimp_connection_statistics_, net_log_); | |
| 185 connection_manager_->AddTransport(base::WrapUnique(transport)); | 182 connection_manager_->AddTransport(base::WrapUnique(transport)); |
| 186 | 183 |
| 187 transport->GetLocalAddress(&address); | 184 transport->GetLocalAddress(&address); |
| 188 port_ = address.port(); | 185 port_ = address.port(); |
| 189 } | 186 } |
| 190 | 187 |
| 191 void EngineNetworkComponents::HandleConnection( | 188 void EngineNetworkComponents::HandleConnection( |
| 192 std::unique_ptr<BlimpConnection> connection) { | 189 std::unique_ptr<BlimpConnection> connection) { |
| 193 // Observe |connection| for disconnection events. | 190 // Observe |connection| for disconnection events. |
| 194 connection->AddConnectionErrorObserver(this); | 191 connection->AddConnectionErrorObserver(this); |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 | 648 |
| 652 aura::Window* parent = window_tree_host_->window(); | 649 aura::Window* parent = window_tree_host_->window(); |
| 653 aura::Window* content = web_contents_->GetNativeView(); | 650 aura::Window* content = web_contents_->GetNativeView(); |
| 654 if (!parent->Contains(content)) | 651 if (!parent->Contains(content)) |
| 655 parent->AddChild(content); | 652 parent->AddChild(content); |
| 656 content->Show(); | 653 content->Show(); |
| 657 } | 654 } |
| 658 | 655 |
| 659 } // namespace engine | 656 } // namespace engine |
| 660 } // namespace blimp | 657 } // namespace blimp |
| OLD | NEW |