| 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 <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
| 15 #include "base/sequenced_task_runner.h" | 15 #include "base/sequenced_task_runner.h" |
| 16 #include "base/threading/sequenced_task_runner_handle.h" | 16 #include "base/threading/sequenced_task_runner_handle.h" |
| 17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
| 18 #include "base/threading/thread_task_runner_handle.h" | 18 #include "base/threading/thread_task_runner_handle.h" |
| 19 #include "blimp/client/core/blimp_client_switches.h" | 19 #include "blimp/client/core/blimp_client_switches.h" |
| 20 #include "blimp/client/core/contents/ime_feature.h" | 20 #include "blimp/client/core/contents/ime_feature.h" |
| 21 #include "blimp/client/core/contents/navigation_feature.h" | 21 #include "blimp/client/core/contents/navigation_feature.h" |
| 22 #include "blimp/client/core/contents/tab_control_feature.h" | 22 #include "blimp/client/core/contents/tab_control_feature.h" |
| 23 #include "blimp/client/core/geolocation/geolocation_feature.h" |
| 23 #include "blimp/client/core/session/client_network_components.h" | 24 #include "blimp/client/core/session/client_network_components.h" |
| 24 #include "blimp/client/core/session/cross_thread_network_event_observer.h" | 25 #include "blimp/client/core/session/cross_thread_network_event_observer.h" |
| 25 #include "blimp/client/feature/render_widget_feature.h" | 26 #include "blimp/client/feature/render_widget_feature.h" |
| 26 #include "blimp/client/feature/settings_feature.h" | 27 #include "blimp/client/feature/settings_feature.h" |
| 27 #include "blimp/common/blob_cache/in_memory_blob_cache.h" | 28 #include "blimp/common/blob_cache/in_memory_blob_cache.h" |
| 28 #include "blimp/net/blimp_message_thread_pipe.h" | 29 #include "blimp/net/blimp_message_thread_pipe.h" |
| 29 #include "blimp/net/blimp_stats.h" | 30 #include "blimp/net/blimp_stats.h" |
| 30 #include "blimp/net/blob_channel/blob_channel_receiver.h" | 31 #include "blimp/net/blob_channel/blob_channel_receiver.h" |
| 31 #include "blimp/net/blob_channel/helium_blob_receiver_delegate.h" | 32 #include "blimp/net/blob_channel/helium_blob_receiver_delegate.h" |
| 32 #include "blimp/net/thread_pipe_manager.h" | 33 #include "blimp/net/thread_pipe_manager.h" |
| 34 #include "device/geolocation/geolocation_delegate.h" |
| 35 #include "device/geolocation/location_arbitrator.h" |
| 33 #include "url/gurl.h" | 36 #include "url/gurl.h" |
| 34 | 37 |
| 35 namespace blimp { | 38 namespace blimp { |
| 36 namespace client { | 39 namespace client { |
| 37 | 40 |
| 38 BlimpClientSession::BlimpClientSession(const GURL& assigner_endpoint) | 41 BlimpClientSession::BlimpClientSession(const GURL& assigner_endpoint) |
| 39 : io_thread_("BlimpIOThread"), | 42 : io_thread_("BlimpIOThread"), |
| 43 geolocation_delegate_(new device::GeolocationDelegate), |
| 44 geolocation_feature_( |
| 45 new GeolocationFeature(base::MakeUnique<device::LocationArbitrator>( |
| 46 geolocation_delegate_.get()))), |
| 40 tab_control_feature_(new TabControlFeature), | 47 tab_control_feature_(new TabControlFeature), |
| 41 navigation_feature_(new NavigationFeature), | 48 navigation_feature_(new NavigationFeature), |
| 42 ime_feature_(new ImeFeature), | 49 ime_feature_(new ImeFeature), |
| 43 render_widget_feature_(new RenderWidgetFeature), | 50 render_widget_feature_(new RenderWidgetFeature), |
| 44 settings_feature_(new SettingsFeature), | 51 settings_feature_(new SettingsFeature), |
| 45 weak_factory_(this) { | 52 weak_factory_(this) { |
| 46 base::Thread::Options options; | 53 base::Thread::Options options; |
| 47 options.message_loop_type = base::MessageLoop::TYPE_IO; | 54 options.message_loop_type = base::MessageLoop::TYPE_IO; |
| 48 io_thread_.StartWithOptions(options); | 55 io_thread_.StartWithOptions(options); |
| 49 net_components_.reset(new ClientNetworkComponents( | 56 net_components_.reset(new ClientNetworkComponents( |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 108 |
| 102 void BlimpClientSession::OnAssignmentConnectionAttempted( | 109 void BlimpClientSession::OnAssignmentConnectionAttempted( |
| 103 AssignmentRequestResult result, | 110 AssignmentRequestResult result, |
| 104 const Assignment& assignment) {} | 111 const Assignment& assignment) {} |
| 105 | 112 |
| 106 void BlimpClientSession::RegisterFeatures() { | 113 void BlimpClientSession::RegisterFeatures() { |
| 107 thread_pipe_manager_ = base::MakeUnique<ThreadPipeManager>( | 114 thread_pipe_manager_ = base::MakeUnique<ThreadPipeManager>( |
| 108 io_thread_.task_runner(), net_components_->GetBrowserConnectionHandler()); | 115 io_thread_.task_runner(), net_components_->GetBrowserConnectionHandler()); |
| 109 | 116 |
| 110 // Register features' message senders and receivers. | 117 // Register features' message senders and receivers. |
| 118 geolocation_feature_->set_outgoing_message_processor( |
| 119 thread_pipe_manager_->RegisterFeature(BlimpMessage::kGeolocation, |
| 120 geolocation_feature_.get())); |
| 111 tab_control_feature_->set_outgoing_message_processor( | 121 tab_control_feature_->set_outgoing_message_processor( |
| 112 thread_pipe_manager_->RegisterFeature(BlimpMessage::kTabControl, | 122 thread_pipe_manager_->RegisterFeature(BlimpMessage::kTabControl, |
| 113 tab_control_feature_.get())); | 123 tab_control_feature_.get())); |
| 114 navigation_feature_->set_outgoing_message_processor( | 124 navigation_feature_->set_outgoing_message_processor( |
| 115 thread_pipe_manager_->RegisterFeature(BlimpMessage::kNavigation, | 125 thread_pipe_manager_->RegisterFeature(BlimpMessage::kNavigation, |
| 116 navigation_feature_.get())); | 126 navigation_feature_.get())); |
| 117 render_widget_feature_->set_outgoing_input_message_processor( | 127 render_widget_feature_->set_outgoing_input_message_processor( |
| 118 thread_pipe_manager_->RegisterFeature(BlimpMessage::kInput, | 128 thread_pipe_manager_->RegisterFeature(BlimpMessage::kInput, |
| 119 render_widget_feature_.get())); | 129 render_widget_feature_.get())); |
| 120 render_widget_feature_->set_outgoing_compositor_message_processor( | 130 render_widget_feature_->set_outgoing_compositor_message_processor( |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 RenderWidgetFeature* BlimpClientSession::GetRenderWidgetFeature() const { | 177 RenderWidgetFeature* BlimpClientSession::GetRenderWidgetFeature() const { |
| 168 return render_widget_feature_.get(); | 178 return render_widget_feature_.get(); |
| 169 } | 179 } |
| 170 | 180 |
| 171 SettingsFeature* BlimpClientSession::GetSettingsFeature() const { | 181 SettingsFeature* BlimpClientSession::GetSettingsFeature() const { |
| 172 return settings_feature_.get(); | 182 return settings_feature_.get(); |
| 173 } | 183 } |
| 174 | 184 |
| 175 } // namespace client | 185 } // namespace client |
| 176 } // namespace blimp | 186 } // namespace blimp |
| OLD | NEW |