| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/core/blimp_client_context_impl.h" | 5 #include "blimp/client/core/blimp_client_context_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/threading/sequenced_task_runner_handle.h" | 13 #include "base/threading/sequenced_task_runner_handle.h" |
| 14 #include "blimp/client/core/blimp_client_switches.h" | 14 #include "blimp/client/core/blimp_client_switches.h" |
| 15 #include "blimp/client/core/compositor/blimp_compositor_dependencies.h" | 15 #include "blimp/client/core/compositor/blimp_compositor_dependencies.h" |
| 16 #include "blimp/client/core/compositor/blob_channel_feature.h" |
| 16 #include "blimp/client/core/contents/blimp_contents_impl.h" | 17 #include "blimp/client/core/contents/blimp_contents_impl.h" |
| 17 #include "blimp/client/core/contents/blimp_contents_manager.h" | 18 #include "blimp/client/core/contents/blimp_contents_manager.h" |
| 18 #include "blimp/client/core/contents/ime_feature.h" | 19 #include "blimp/client/core/contents/ime_feature.h" |
| 19 #include "blimp/client/core/contents/navigation_feature.h" | 20 #include "blimp/client/core/contents/navigation_feature.h" |
| 20 #include "blimp/client/core/contents/tab_control_feature.h" | 21 #include "blimp/client/core/contents/tab_control_feature.h" |
| 21 #include "blimp/client/core/geolocation/geolocation_feature.h" | 22 #include "blimp/client/core/geolocation/geolocation_feature.h" |
| 22 #include "blimp/client/core/render_widget/render_widget_feature.h" | 23 #include "blimp/client/core/render_widget/render_widget_feature.h" |
| 23 #include "blimp/client/core/session/cross_thread_network_event_observer.h" | 24 #include "blimp/client/core/session/cross_thread_network_event_observer.h" |
| 24 #include "blimp/client/core/settings/settings_feature.h" | 25 #include "blimp/client/core/settings/settings_feature.h" |
| 25 #include "blimp/client/public/blimp_client_context_delegate.h" | 26 #include "blimp/client/public/blimp_client_context_delegate.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 BlimpClientContextImpl::BlimpClientContextImpl( | 64 BlimpClientContextImpl::BlimpClientContextImpl( |
| 64 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, | 65 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, |
| 65 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner, | 66 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner, |
| 66 std::unique_ptr<CompositorDependencies> compositor_dependencies) | 67 std::unique_ptr<CompositorDependencies> compositor_dependencies) |
| 67 : BlimpClientContext(), | 68 : BlimpClientContext(), |
| 68 io_thread_task_runner_(io_thread_task_runner), | 69 io_thread_task_runner_(io_thread_task_runner), |
| 69 file_thread_task_runner_(file_thread_task_runner), | 70 file_thread_task_runner_(file_thread_task_runner), |
| 70 blimp_compositor_dependencies_( | 71 blimp_compositor_dependencies_( |
| 71 base::MakeUnique<BlimpCompositorDependencies>( | 72 base::MakeUnique<BlimpCompositorDependencies>( |
| 72 std::move(compositor_dependencies))), | 73 std::move(compositor_dependencies))), |
| 74 blob_channel_feature_(new BlobChannelFeature(this)), |
| 73 geolocation_feature_(base::MakeUnique<GeolocationFeature>( | 75 geolocation_feature_(base::MakeUnique<GeolocationFeature>( |
| 74 base::MakeUnique<device::LocationArbitrator>( | 76 base::MakeUnique<device::LocationArbitrator>( |
| 75 base::MakeUnique<device::GeolocationDelegate>()))), | 77 base::MakeUnique<device::GeolocationDelegate>()))), |
| 76 ime_feature_(new ImeFeature), | 78 ime_feature_(new ImeFeature), |
| 77 navigation_feature_(new NavigationFeature), | 79 navigation_feature_(new NavigationFeature), |
| 78 render_widget_feature_(new RenderWidgetFeature), | 80 render_widget_feature_(new RenderWidgetFeature), |
| 79 settings_feature_(new SettingsFeature), | 81 settings_feature_(new SettingsFeature), |
| 80 tab_control_feature_(new TabControlFeature), | 82 tab_control_feature_(new TabControlFeature), |
| 81 blimp_contents_manager_( | 83 blimp_contents_manager_( |
| 82 new BlimpContentsManager(blimp_compositor_dependencies_.get(), | 84 new BlimpContentsManager(blimp_compositor_dependencies_.get(), |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 173 } |
| 172 | 174 |
| 173 io_thread_task_runner_->PostTask( | 175 io_thread_task_runner_->PostTask( |
| 174 FROM_HERE, | 176 FROM_HERE, |
| 175 base::Bind(&ClientNetworkComponents::ConnectWithAssignment, | 177 base::Bind(&ClientNetworkComponents::ConnectWithAssignment, |
| 176 base::Unretained(net_components_.get()), assignment)); | 178 base::Unretained(net_components_.get()), assignment)); |
| 177 } | 179 } |
| 178 | 180 |
| 179 void BlimpClientContextImpl::RegisterFeatures() { | 181 void BlimpClientContextImpl::RegisterFeatures() { |
| 180 // Register features' message senders and receivers. | 182 // Register features' message senders and receivers. |
| 183 thread_pipe_manager_->RegisterFeature(BlimpMessage::kBlobChannel, |
| 184 blob_channel_feature_.get()); |
| 181 geolocation_feature_->set_outgoing_message_processor( | 185 geolocation_feature_->set_outgoing_message_processor( |
| 182 thread_pipe_manager_->RegisterFeature(BlimpMessage::kGeolocation, | 186 thread_pipe_manager_->RegisterFeature(BlimpMessage::kGeolocation, |
| 183 geolocation_feature_.get())); | 187 geolocation_feature_.get())); |
| 184 ime_feature_->set_outgoing_message_processor( | 188 ime_feature_->set_outgoing_message_processor( |
| 185 thread_pipe_manager_->RegisterFeature(BlimpMessage::kIme, | 189 thread_pipe_manager_->RegisterFeature(BlimpMessage::kIme, |
| 186 ime_feature_.get())); | 190 ime_feature_.get())); |
| 187 navigation_feature_->set_outgoing_message_processor( | 191 navigation_feature_->set_outgoing_message_processor( |
| 188 thread_pipe_manager_->RegisterFeature(BlimpMessage::kNavigation, | 192 thread_pipe_manager_->RegisterFeature(BlimpMessage::kNavigation, |
| 189 navigation_feature_.get())); | 193 navigation_feature_.get())); |
| 190 render_widget_feature_->set_outgoing_input_message_processor( | 194 render_widget_feature_->set_outgoing_input_message_processor( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 208 switches::kDownloadWholeDocument)) | 212 switches::kDownloadWholeDocument)) |
| 209 settings_feature_->SetRecordWholeDocument(true); | 213 settings_feature_->SetRecordWholeDocument(true); |
| 210 } | 214 } |
| 211 | 215 |
| 212 void BlimpClientContextImpl::CreateIdentitySource() { | 216 void BlimpClientContextImpl::CreateIdentitySource() { |
| 213 identity_source_ = base::MakeUnique<IdentitySource>( | 217 identity_source_ = base::MakeUnique<IdentitySource>( |
| 214 delegate_, base::Bind(&BlimpClientContextImpl::ConnectToAssignmentSource, | 218 delegate_, base::Bind(&BlimpClientContextImpl::ConnectToAssignmentSource, |
| 215 base::Unretained(this))); | 219 base::Unretained(this))); |
| 216 } | 220 } |
| 217 | 221 |
| 222 void BlimpClientContextImpl::OnImageDecodeError() { |
| 223 // Currently we just drop the connection on image decoding error. |
| 224 io_thread_task_runner_->PostTask( |
| 225 FROM_HERE, |
| 226 base::Bind( |
| 227 &BrowserConnectionHandler::DropCurrentConnection, |
| 228 base::Unretained(net_components_->GetBrowserConnectionHandler()))); |
| 229 } |
| 230 |
| 218 } // namespace client | 231 } // namespace client |
| 219 } // namespace blimp | 232 } // namespace blimp |
| OLD | NEW |