| 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/navigation_feature.h" | 15 #include "blimp/client/feature/navigation_feature.h" |
| 16 #include "blimp/client/feature/render_widget_feature.h" | 16 #include "blimp/client/feature/render_widget_feature.h" |
| 17 #include "blimp/client/feature/settings_feature.h" |
| 17 #include "blimp/client/feature/tab_control_feature.h" | 18 #include "blimp/client/feature/tab_control_feature.h" |
| 18 #include "blimp/net/blimp_connection.h" | 19 #include "blimp/net/blimp_connection.h" |
| 19 #include "blimp/net/blimp_message_processor.h" | 20 #include "blimp/net/blimp_message_processor.h" |
| 20 #include "blimp/net/blimp_message_thread_pipe.h" | 21 #include "blimp/net/blimp_message_thread_pipe.h" |
| 21 #include "blimp/net/browser_connection_handler.h" | 22 #include "blimp/net/browser_connection_handler.h" |
| 22 #include "blimp/net/client_connection_manager.h" | 23 #include "blimp/net/client_connection_manager.h" |
| 23 #include "blimp/net/common.h" | 24 #include "blimp/net/common.h" |
| 24 #include "blimp/net/connection_handler.h" | 25 #include "blimp/net/connection_handler.h" |
| 25 #include "blimp/net/null_blimp_message_processor.h" | 26 #include "blimp/net/null_blimp_message_processor.h" |
| 26 #include "blimp/net/ssl_client_transport.h" | 27 #include "blimp/net/ssl_client_transport.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 144 |
| 144 void ClientNetworkComponents::OnConnectionError(int result) { | 145 void ClientNetworkComponents::OnConnectionError(int result) { |
| 145 network_observer_->OnDisconnected(result); | 146 network_observer_->OnDisconnected(result); |
| 146 } | 147 } |
| 147 | 148 |
| 148 BlimpClientSession::BlimpClientSession() | 149 BlimpClientSession::BlimpClientSession() |
| 149 : io_thread_("BlimpIOThread"), | 150 : io_thread_("BlimpIOThread"), |
| 150 tab_control_feature_(new TabControlFeature), | 151 tab_control_feature_(new TabControlFeature), |
| 151 navigation_feature_(new NavigationFeature), | 152 navigation_feature_(new NavigationFeature), |
| 152 render_widget_feature_(new RenderWidgetFeature), | 153 render_widget_feature_(new RenderWidgetFeature), |
| 154 settings_feature_(new SettingsFeature), |
| 153 weak_factory_(this) { | 155 weak_factory_(this) { |
| 154 net_components_.reset(new ClientNetworkComponents( | 156 net_components_.reset(new ClientNetworkComponents( |
| 155 make_scoped_ptr(new CrossThreadNetworkEventObserver( | 157 make_scoped_ptr(new CrossThreadNetworkEventObserver( |
| 156 weak_factory_.GetWeakPtr(), | 158 weak_factory_.GetWeakPtr(), |
| 157 base::SequencedTaskRunnerHandle::Get())))); | 159 base::SequencedTaskRunnerHandle::Get())))); |
| 158 base::Thread::Options options; | 160 base::Thread::Options options; |
| 159 options.message_loop_type = base::MessageLoop::TYPE_IO; | 161 options.message_loop_type = base::MessageLoop::TYPE_IO; |
| 160 io_thread_.StartWithOptions(options); | 162 io_thread_.StartWithOptions(options); |
| 161 | 163 |
| 162 assignment_source_.reset( | 164 assignment_source_.reset( |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 tab_control_feature_.get())); | 212 tab_control_feature_.get())); |
| 211 navigation_feature_->set_outgoing_message_processor( | 213 navigation_feature_->set_outgoing_message_processor( |
| 212 thread_pipe_manager_->RegisterFeature(BlimpMessage::NAVIGATION, | 214 thread_pipe_manager_->RegisterFeature(BlimpMessage::NAVIGATION, |
| 213 navigation_feature_.get())); | 215 navigation_feature_.get())); |
| 214 render_widget_feature_->set_outgoing_input_message_processor( | 216 render_widget_feature_->set_outgoing_input_message_processor( |
| 215 thread_pipe_manager_->RegisterFeature(BlimpMessage::INPUT, | 217 thread_pipe_manager_->RegisterFeature(BlimpMessage::INPUT, |
| 216 render_widget_feature_.get())); | 218 render_widget_feature_.get())); |
| 217 render_widget_feature_->set_outgoing_compositor_message_processor( | 219 render_widget_feature_->set_outgoing_compositor_message_processor( |
| 218 thread_pipe_manager_->RegisterFeature(BlimpMessage::COMPOSITOR, | 220 thread_pipe_manager_->RegisterFeature(BlimpMessage::COMPOSITOR, |
| 219 render_widget_feature_.get())); | 221 render_widget_feature_.get())); |
| 222 settings_feature_->set_outgoing_message_processor( |
| 223 thread_pipe_manager_->RegisterFeature(BlimpMessage::SETTINGS, |
| 224 settings_feature_.get())); |
| 225 |
| 226 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 227 switches::kDownloadWholeDocument)) |
| 228 settings_feature_->SetRecordWholeDocument(true); |
| 220 | 229 |
| 221 // Client will not send send any RenderWidget messages, so don't save the | 230 // Client will not send send any RenderWidget messages, so don't save the |
| 222 // outgoing BlimpMessageProcessor in the RenderWidgetFeature. | 231 // outgoing BlimpMessageProcessor in the RenderWidgetFeature. |
| 223 thread_pipe_manager_->RegisterFeature(BlimpMessage::RENDER_WIDGET, | 232 thread_pipe_manager_->RegisterFeature(BlimpMessage::RENDER_WIDGET, |
| 224 render_widget_feature_.get()); | 233 render_widget_feature_.get()); |
| 225 } | 234 } |
| 226 | 235 |
| 227 void BlimpClientSession::OnConnected() {} | 236 void BlimpClientSession::OnConnected() {} |
| 228 | 237 |
| 229 void BlimpClientSession::OnDisconnected(int result) {} | 238 void BlimpClientSession::OnDisconnected(int result) {} |
| 230 | 239 |
| 231 TabControlFeature* BlimpClientSession::GetTabControlFeature() const { | 240 TabControlFeature* BlimpClientSession::GetTabControlFeature() const { |
| 232 return tab_control_feature_.get(); | 241 return tab_control_feature_.get(); |
| 233 } | 242 } |
| 234 | 243 |
| 235 NavigationFeature* BlimpClientSession::GetNavigationFeature() const { | 244 NavigationFeature* BlimpClientSession::GetNavigationFeature() const { |
| 236 return navigation_feature_.get(); | 245 return navigation_feature_.get(); |
| 237 } | 246 } |
| 238 | 247 |
| 239 RenderWidgetFeature* BlimpClientSession::GetRenderWidgetFeature() const { | 248 RenderWidgetFeature* BlimpClientSession::GetRenderWidgetFeature() const { |
| 240 return render_widget_feature_.get(); | 249 return render_widget_feature_.get(); |
| 241 } | 250 } |
| 242 | 251 |
| 243 } // namespace client | 252 } // namespace client |
| 244 } // namespace blimp | 253 } // namespace blimp |
| OLD | NEW |