| 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/client/session/blimp_client_session.h" | 5 #include "blimp/client/session/blimp_client_session.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
| 13 #include "base/threading/sequenced_task_runner_handle.h" | 13 #include "base/threading/sequenced_task_runner_handle.h" |
| 14 #include "blimp/client/app/blimp_client_switches.h" | 14 #include "blimp/client/app/blimp_client_switches.h" |
| 15 #include "blimp/client/feature/ime_feature.h" | 15 #include "blimp/client/feature/ime_feature.h" |
| 16 #include "blimp/client/feature/navigation_feature.h" | 16 #include "blimp/client/feature/navigation_feature.h" |
| 17 #include "blimp/client/feature/render_widget_feature.h" | 17 #include "blimp/client/feature/render_widget_feature.h" |
| 18 #include "blimp/client/feature/settings_feature.h" | 18 #include "blimp/client/feature/settings_feature.h" |
| 19 #include "blimp/client/feature/tab_control_feature.h" | 19 #include "blimp/client/feature/tab_control_feature.h" |
| 20 #include "blimp/common/protocol_version.h" |
| 20 #include "blimp/net/blimp_connection.h" | 21 #include "blimp/net/blimp_connection.h" |
| 21 #include "blimp/net/blimp_message_processor.h" | 22 #include "blimp/net/blimp_message_processor.h" |
| 22 #include "blimp/net/blimp_message_thread_pipe.h" | 23 #include "blimp/net/blimp_message_thread_pipe.h" |
| 23 #include "blimp/net/browser_connection_handler.h" | 24 #include "blimp/net/browser_connection_handler.h" |
| 24 #include "blimp/net/client_connection_manager.h" | 25 #include "blimp/net/client_connection_manager.h" |
| 25 #include "blimp/net/common.h" | 26 #include "blimp/net/common.h" |
| 26 #include "blimp/net/connection_handler.h" | 27 #include "blimp/net/connection_handler.h" |
| 27 #include "blimp/net/null_blimp_message_processor.h" | 28 #include "blimp/net/null_blimp_message_processor.h" |
| 28 #include "blimp/net/ssl_client_transport.h" | 29 #include "blimp/net/ssl_client_transport.h" |
| 29 #include "blimp/net/tcp_client_transport.h" | 30 #include "blimp/net/tcp_client_transport.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 connection->AddConnectionErrorObserver(this); | 142 connection->AddConnectionErrorObserver(this); |
| 142 network_observer_->OnConnected(); | 143 network_observer_->OnConnected(); |
| 143 connection_handler_->HandleConnection(std::move(connection)); | 144 connection_handler_->HandleConnection(std::move(connection)); |
| 144 } | 145 } |
| 145 | 146 |
| 146 void ClientNetworkComponents::OnConnectionError(int result) { | 147 void ClientNetworkComponents::OnConnectionError(int result) { |
| 147 network_observer_->OnDisconnected(result); | 148 network_observer_->OnDisconnected(result); |
| 148 } | 149 } |
| 149 | 150 |
| 150 BlimpClientSession::BlimpClientSession() | 151 BlimpClientSession::BlimpClientSession() |
| 151 : io_thread_("BlimpIOThread"), | 152 : engineVersion_(blimp::kEngineVersion), |
| 153 io_thread_("BlimpIOThread"), |
| 152 tab_control_feature_(new TabControlFeature), | 154 tab_control_feature_(new TabControlFeature), |
| 153 navigation_feature_(new NavigationFeature), | 155 navigation_feature_(new NavigationFeature), |
| 154 ime_feature_(new ImeFeature), | 156 ime_feature_(new ImeFeature), |
| 155 render_widget_feature_(new RenderWidgetFeature), | 157 render_widget_feature_(new RenderWidgetFeature), |
| 156 settings_feature_(new SettingsFeature), | 158 settings_feature_(new SettingsFeature), |
| 157 weak_factory_(this) { | 159 weak_factory_(this) { |
| 158 net_components_.reset(new ClientNetworkComponents( | 160 net_components_.reset(new ClientNetworkComponents( |
| 159 make_scoped_ptr(new CrossThreadNetworkEventObserver( | 161 make_scoped_ptr(new CrossThreadNetworkEventObserver( |
| 160 weak_factory_.GetWeakPtr(), | 162 weak_factory_.GetWeakPtr(), |
| 161 base::SequencedTaskRunnerHandle::Get())))); | 163 base::SequencedTaskRunnerHandle::Get())))); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 182 void BlimpClientSession::Connect(const std::string& client_auth_token) { | 184 void BlimpClientSession::Connect(const std::string& client_auth_token) { |
| 183 assignment_source_->GetAssignment( | 185 assignment_source_->GetAssignment( |
| 184 client_auth_token, base::Bind(&BlimpClientSession::ConnectWithAssignment, | 186 client_auth_token, base::Bind(&BlimpClientSession::ConnectWithAssignment, |
| 185 weak_factory_.GetWeakPtr())); | 187 weak_factory_.GetWeakPtr())); |
| 186 } | 188 } |
| 187 | 189 |
| 188 void BlimpClientSession::ConnectWithAssignment(AssignmentSource::Result result, | 190 void BlimpClientSession::ConnectWithAssignment(AssignmentSource::Result result, |
| 189 const Assignment& assignment) { | 191 const Assignment& assignment) { |
| 190 OnAssignmentConnectionAttempted(result); | 192 OnAssignmentConnectionAttempted(result); |
| 191 | 193 |
| 194 engineIPAddress_ = IPAddressToStringWithPort( |
| 195 assignment.engine_endpoint.address(), assignment.engine_endpoint.port()); |
| 196 |
| 192 if (result != AssignmentSource::Result::RESULT_OK) { | 197 if (result != AssignmentSource::Result::RESULT_OK) { |
| 193 VLOG(1) << "Assignment request failed: " << result; | 198 VLOG(1) << "Assignment request failed: " << result; |
| 194 return; | 199 return; |
| 195 } | 200 } |
| 196 | 201 |
| 197 io_thread_.task_runner()->PostTask( | 202 io_thread_.task_runner()->PostTask( |
| 198 FROM_HERE, | 203 FROM_HERE, |
| 199 base::Bind(&ClientNetworkComponents::ConnectWithAssignment, | 204 base::Bind(&ClientNetworkComponents::ConnectWithAssignment, |
| 200 base::Unretained(net_components_.get()), assignment)); | 205 base::Unretained(net_components_.get()), assignment)); |
| 201 } | 206 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 ImeFeature* BlimpClientSession::GetImeFeature() const { | 259 ImeFeature* BlimpClientSession::GetImeFeature() const { |
| 255 return ime_feature_.get(); | 260 return ime_feature_.get(); |
| 256 } | 261 } |
| 257 | 262 |
| 258 RenderWidgetFeature* BlimpClientSession::GetRenderWidgetFeature() const { | 263 RenderWidgetFeature* BlimpClientSession::GetRenderWidgetFeature() const { |
| 259 return render_widget_feature_.get(); | 264 return render_widget_feature_.get(); |
| 260 } | 265 } |
| 261 | 266 |
| 262 } // namespace client | 267 } // namespace client |
| 263 } // namespace blimp | 268 } // namespace blimp |
| OLD | NEW |