Chromium Code Reviews| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 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/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
| 15 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
| 16 #include "blimp/common/blob_cache/in_memory_blob_cache.h" | 16 #include "blimp/common/blob_cache/in_memory_blob_cache.h" |
| 17 #include "blimp/common/create_blimp_message.h" | 17 #include "blimp/common/create_blimp_message.h" |
| 18 #include "blimp/common/proto/tab_control.pb.h" | 18 #include "blimp/common/proto/tab_control.pb.h" |
| 19 #include "blimp/engine/app/blimp_engine_config.h" | 19 #include "blimp/engine/app/blimp_engine_config.h" |
| 20 #include "blimp/engine/app/settings_manager.h" | 20 #include "blimp/engine/app/settings_manager.h" |
| 21 #include "blimp/engine/app/switches.h" | 21 #include "blimp/engine/app/switches.h" |
| 22 #include "blimp/engine/app/ui/blimp_layout_manager.h" | 22 #include "blimp/engine/app/ui/blimp_layout_manager.h" |
| 23 #include "blimp/engine/app/ui/blimp_screen.h" | 23 #include "blimp/engine/app/ui/blimp_screen.h" |
| 24 #include "blimp/engine/app/ui/blimp_window_tree_client.h" | 24 #include "blimp/engine/app/ui/blimp_window_tree_client.h" |
| 25 #include "blimp/engine/app/ui/blimp_window_tree_host.h" | 25 #include "blimp/engine/app/ui/blimp_window_tree_host.h" |
| 26 #include "blimp/engine/common/blimp_browser_context.h" | 26 #include "blimp/engine/common/blimp_browser_context.h" |
| 27 #include "blimp/engine/common/blimp_user_agent.h" | 27 #include "blimp/engine/common/blimp_user_agent.h" |
| 28 #include "blimp/engine/mojo/blob_channel_service.h" | |
| 28 #include "blimp/engine/session/tab.h" | 29 #include "blimp/engine/session/tab.h" |
| 29 #include "blimp/net/blimp_connection.h" | 30 #include "blimp/net/blimp_connection.h" |
| 30 #include "blimp/net/blimp_connection_statistics.h" | 31 #include "blimp/net/blimp_connection_statistics.h" |
| 31 #include "blimp/net/blimp_message_multiplexer.h" | 32 #include "blimp/net/blimp_message_multiplexer.h" |
| 32 #include "blimp/net/blimp_message_thread_pipe.h" | 33 #include "blimp/net/blimp_message_thread_pipe.h" |
| 33 #include "blimp/net/blob_channel/blob_channel_sender_impl.h" | 34 #include "blimp/net/blob_channel/blob_channel_sender_impl.h" |
| 34 #include "blimp/net/blob_channel/helium_blob_sender_delegate.h" | 35 #include "blimp/net/blob_channel/helium_blob_sender_delegate.h" |
| 35 #include "blimp/net/browser_connection_handler.h" | 36 #include "blimp/net/browser_connection_handler.h" |
| 36 #include "blimp/net/common.h" | 37 #include "blimp/net/common.h" |
| 37 #include "blimp/net/engine_authentication_handler.h" | 38 #include "blimp/net/engine_authentication_handler.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 234 kDefaultScaleFactor, | 235 kDefaultScaleFactor, |
| 235 gfx::Size(kDefaultDisplayWidth, kDefaultDisplayHeight)); | 236 gfx::Size(kDefaultDisplayWidth, kDefaultDisplayHeight)); |
| 236 render_widget_feature_.SetDelegate(kDummyTabId, this); | 237 render_widget_feature_.SetDelegate(kDummyTabId, this); |
| 237 | 238 |
| 238 std::unique_ptr<HeliumBlobSenderDelegate> helium_blob_delegate( | 239 std::unique_ptr<HeliumBlobSenderDelegate> helium_blob_delegate( |
| 239 new HeliumBlobSenderDelegate); | 240 new HeliumBlobSenderDelegate); |
| 240 blob_delegate_ = helium_blob_delegate.get(); | 241 blob_delegate_ = helium_blob_delegate.get(); |
| 241 blob_channel_sender_ = base::WrapUnique( | 242 blob_channel_sender_ = base::WrapUnique( |
| 242 new BlobChannelSenderImpl(base::WrapUnique(new InMemoryBlobCache), | 243 new BlobChannelSenderImpl(base::WrapUnique(new InMemoryBlobCache), |
| 243 std::move(helium_blob_delegate))); | 244 std::move(helium_blob_delegate))); |
| 244 | 245 blob_channel_service_ = |
|
Kevin M
2016/07/28 18:14:47
Switch this to MakeUnique
CJ
2016/07/28 19:54:15
Done.
| |
| 246 base::WrapUnique(new BlobChannelService(blob_channel_sender_.get())); | |
| 245 content::GeolocationProvider::SetGeolocationDelegate( | 247 content::GeolocationProvider::SetGeolocationDelegate( |
| 246 geolocation_feature_.CreateGeolocationDelegate()); | 248 geolocation_feature_.CreateGeolocationDelegate()); |
| 247 } | 249 } |
| 248 | 250 |
| 249 BlimpEngineSession::~BlimpEngineSession() { | 251 BlimpEngineSession::~BlimpEngineSession() { |
| 250 render_widget_feature_.RemoveDelegate(kDummyTabId); | 252 render_widget_feature_.RemoveDelegate(kDummyTabId); |
| 251 | 253 |
| 252 window_tree_host_->GetInputMethod()->RemoveObserver(this); | 254 window_tree_host_->GetInputMethod()->RemoveObserver(this); |
| 253 | 255 |
| 254 // Ensure that all tabs are torn down first, since teardown will | 256 // Ensure that all tabs are torn down first, since teardown will |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 291 | 293 |
| 292 // Initialize must only be posted after the RegisterFeature calls have | 294 // Initialize must only be posted after the RegisterFeature calls have |
| 293 // completed. | 295 // completed. |
| 294 content::BrowserThread::PostTask( | 296 content::BrowserThread::PostTask( |
| 295 content::BrowserThread::IO, FROM_HERE, | 297 content::BrowserThread::IO, FROM_HERE, |
| 296 base::Bind(&EngineNetworkComponents::Initialize, | 298 base::Bind(&EngineNetworkComponents::Initialize, |
| 297 base::Unretained(net_components_.get()), | 299 base::Unretained(net_components_.get()), |
| 298 engine_config_->client_token())); | 300 engine_config_->client_token())); |
| 299 } | 301 } |
| 300 | 302 |
| 303 EngineGeolocationFeature* BlimpEngineSession::GetGeolocationFeature() { | |
|
Kevin M
2016/07/28 18:14:47
??
CJ
2016/07/28 19:54:15
I think I screwed up merging. Fixing.
| |
| 304 return &geolocation_feature_; | |
| 305 } | |
| 306 | |
| 301 void BlimpEngineSession::GetEnginePortForTesting( | 307 void BlimpEngineSession::GetEnginePortForTesting( |
| 302 const GetPortCallback& callback) { | 308 const GetPortCallback& callback) { |
| 303 content::BrowserThread::PostTaskAndReplyWithResult( | 309 content::BrowserThread::PostTaskAndReplyWithResult( |
| 304 content::BrowserThread::IO, FROM_HERE, | 310 content::BrowserThread::IO, FROM_HERE, |
| 305 base::Bind(&EngineNetworkComponents::GetPortForTesting, | 311 base::Bind(&EngineNetworkComponents::GetPortForTesting, |
| 306 base::Unretained(net_components_.get())), | 312 base::Unretained(net_components_.get())), |
| 307 callback); | 313 callback); |
| 308 } | 314 } |
| 309 | 315 |
| 310 void BlimpEngineSession::RegisterFeatures() { | 316 void BlimpEngineSession::RegisterFeatures() { |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 572 parent->AddChild(content); | 578 parent->AddChild(content); |
| 573 content->Show(); | 579 content->Show(); |
| 574 | 580 |
| 575 tab_ = base::WrapUnique(new Tab(std::move(new_contents), target_tab_id, | 581 tab_ = base::WrapUnique(new Tab(std::move(new_contents), target_tab_id, |
| 576 &render_widget_feature_, | 582 &render_widget_feature_, |
| 577 navigation_message_sender_.get())); | 583 navigation_message_sender_.get())); |
| 578 } | 584 } |
| 579 | 585 |
| 580 } // namespace engine | 586 } // namespace engine |
| 581 } // namespace blimp | 587 } // namespace blimp |
| OLD | NEW |