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 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
14 #include "base/trace_event/trace_event.h" | 14 #include "base/trace_event/trace_event.h" |
| 15 #include "blimp/common/blob_cache/in_memory_blob_cache.h" |
15 #include "blimp/common/create_blimp_message.h" | 16 #include "blimp/common/create_blimp_message.h" |
16 #include "blimp/common/proto/tab_control.pb.h" | 17 #include "blimp/common/proto/tab_control.pb.h" |
17 #include "blimp/engine/app/blimp_engine_config.h" | 18 #include "blimp/engine/app/blimp_engine_config.h" |
18 #include "blimp/engine/app/settings_manager.h" | 19 #include "blimp/engine/app/settings_manager.h" |
19 #include "blimp/engine/app/switches.h" | 20 #include "blimp/engine/app/switches.h" |
20 #include "blimp/engine/app/ui/blimp_layout_manager.h" | 21 #include "blimp/engine/app/ui/blimp_layout_manager.h" |
21 #include "blimp/engine/app/ui/blimp_screen.h" | 22 #include "blimp/engine/app/ui/blimp_screen.h" |
22 #include "blimp/engine/app/ui/blimp_window_tree_client.h" | 23 #include "blimp/engine/app/ui/blimp_window_tree_client.h" |
23 #include "blimp/engine/app/ui/blimp_window_tree_host.h" | 24 #include "blimp/engine/app/ui/blimp_window_tree_host.h" |
24 #include "blimp/engine/common/blimp_browser_context.h" | 25 #include "blimp/engine/common/blimp_browser_context.h" |
25 #include "blimp/engine/common/blimp_user_agent.h" | 26 #include "blimp/engine/common/blimp_user_agent.h" |
26 #include "blimp/engine/session/tab.h" | 27 #include "blimp/engine/session/tab.h" |
27 #include "blimp/net/blimp_connection.h" | 28 #include "blimp/net/blimp_connection.h" |
28 #include "blimp/net/blimp_connection_statistics.h" | 29 #include "blimp/net/blimp_connection_statistics.h" |
29 #include "blimp/net/blimp_message_multiplexer.h" | 30 #include "blimp/net/blimp_message_multiplexer.h" |
30 #include "blimp/net/blimp_message_thread_pipe.h" | 31 #include "blimp/net/blimp_message_thread_pipe.h" |
| 32 #include "blimp/net/blob_channel/blob_channel_sender_impl.h" |
| 33 #include "blimp/net/blob_channel/helium_blob_sender_delegate.h" |
31 #include "blimp/net/browser_connection_handler.h" | 34 #include "blimp/net/browser_connection_handler.h" |
32 #include "blimp/net/common.h" | 35 #include "blimp/net/common.h" |
33 #include "blimp/net/engine_authentication_handler.h" | 36 #include "blimp/net/engine_authentication_handler.h" |
34 #include "blimp/net/engine_connection_manager.h" | 37 #include "blimp/net/engine_connection_manager.h" |
35 #include "blimp/net/null_blimp_message_processor.h" | 38 #include "blimp/net/null_blimp_message_processor.h" |
36 #include "blimp/net/tcp_engine_transport.h" | 39 #include "blimp/net/tcp_engine_transport.h" |
37 #include "blimp/net/thread_pipe_manager.h" | 40 #include "blimp/net/thread_pipe_manager.h" |
38 #include "content/public/browser/browser_context.h" | 41 #include "content/public/browser/browser_context.h" |
39 #include "content/public/browser/browser_thread.h" | 42 #include "content/public/browser/browser_thread.h" |
40 #include "content/public/browser/navigation_controller.h" | 43 #include "content/public/browser/navigation_controller.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 browser_context_(std::move(browser_context)), | 219 browser_context_(std::move(browser_context)), |
217 engine_config_(engine_config), | 220 engine_config_(engine_config), |
218 settings_manager_(settings_manager), | 221 settings_manager_(settings_manager), |
219 settings_feature_(settings_manager_), | 222 settings_feature_(settings_manager_), |
220 render_widget_feature_(settings_manager_), | 223 render_widget_feature_(settings_manager_), |
221 net_components_( | 224 net_components_( |
222 new EngineNetworkComponents(net_log, | 225 new EngineNetworkComponents(net_log, |
223 QuitCurrentMessageLoopClosure())) { | 226 QuitCurrentMessageLoopClosure())) { |
224 DCHECK(engine_config_); | 227 DCHECK(engine_config_); |
225 DCHECK(settings_manager_); | 228 DCHECK(settings_manager_); |
226 screen_->UpdateDisplayScaleAndSize(kDefaultScaleFactor, | 229 |
227 gfx::Size(kDefaultDisplayWidth, | 230 screen_->UpdateDisplayScaleAndSize( |
228 kDefaultDisplayHeight)); | 231 kDefaultScaleFactor, |
| 232 gfx::Size(kDefaultDisplayWidth, kDefaultDisplayHeight)); |
229 render_widget_feature_.SetDelegate(kDummyTabId, this); | 233 render_widget_feature_.SetDelegate(kDummyTabId, this); |
| 234 |
| 235 std::unique_ptr<HeliumBlobSenderDelegate> helium_blob_delegate( |
| 236 new HeliumBlobSenderDelegate); |
| 237 blob_delegate_ = helium_blob_delegate.get(); |
| 238 blob_channel_sender_ = base::WrapUnique( |
| 239 new BlobChannelSenderImpl(base::WrapUnique(new InMemoryBlobCache), |
| 240 std::move(helium_blob_delegate))); |
230 } | 241 } |
231 | 242 |
232 BlimpEngineSession::~BlimpEngineSession() { | 243 BlimpEngineSession::~BlimpEngineSession() { |
233 render_widget_feature_.RemoveDelegate(kDummyTabId); | 244 render_widget_feature_.RemoveDelegate(kDummyTabId); |
234 | 245 |
235 window_tree_host_->GetInputMethod()->RemoveObserver(this); | 246 window_tree_host_->GetInputMethod()->RemoveObserver(this); |
236 | 247 |
237 // Ensure that all tabs are torn down first, since teardown will | 248 // Ensure that all tabs are torn down first, since teardown will |
238 // trigger RenderViewDeleted callbacks to their observers, which will in turn | 249 // trigger RenderViewDeleted callbacks to their observers, which will in turn |
239 // send messages to net_components_, which is already deleted due to the line | 250 // send messages to net_components_, which is already deleted due to the line |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 &render_widget_feature_)); | 317 &render_widget_feature_)); |
307 render_widget_feature_.set_input_message_sender( | 318 render_widget_feature_.set_input_message_sender( |
308 thread_pipe_manager_->RegisterFeature(BlimpMessage::kInput, | 319 thread_pipe_manager_->RegisterFeature(BlimpMessage::kInput, |
309 &render_widget_feature_)); | 320 &render_widget_feature_)); |
310 render_widget_feature_.set_compositor_message_sender( | 321 render_widget_feature_.set_compositor_message_sender( |
311 thread_pipe_manager_->RegisterFeature(BlimpMessage::kCompositor, | 322 thread_pipe_manager_->RegisterFeature(BlimpMessage::kCompositor, |
312 &render_widget_feature_)); | 323 &render_widget_feature_)); |
313 render_widget_feature_.set_ime_message_sender( | 324 render_widget_feature_.set_ime_message_sender( |
314 thread_pipe_manager_->RegisterFeature(BlimpMessage::kIme, | 325 thread_pipe_manager_->RegisterFeature(BlimpMessage::kIme, |
315 &render_widget_feature_)); | 326 &render_widget_feature_)); |
| 327 blob_delegate_->set_outgoing_message_processor( |
| 328 thread_pipe_manager_->RegisterFeature(BlimpMessage::kBlobChannel, |
| 329 blob_delegate_)); |
316 | 330 |
317 // The Settings feature does not need an outgoing message processor, since we | 331 // The Settings feature does not need an outgoing message processor, since we |
318 // don't send any messages to the client right now. | 332 // don't send any messages to the client right now. |
319 thread_pipe_manager_->RegisterFeature(BlimpMessage::kSettings, | 333 thread_pipe_manager_->RegisterFeature(BlimpMessage::kSettings, |
320 &settings_feature_); | 334 &settings_feature_); |
321 } | 335 } |
322 | 336 |
323 bool BlimpEngineSession::CreateTab(const int target_tab_id) { | 337 bool BlimpEngineSession::CreateTab(const int target_tab_id) { |
324 DVLOG(1) << "Create tab " << target_tab_id; | 338 DVLOG(1) << "Create tab " << target_tab_id; |
325 if (tab_) { | 339 if (tab_) { |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 content::NavigationController::LoadURLParams load_url_params(params.url); | 507 content::NavigationController::LoadURLParams load_url_params(params.url); |
494 load_url_params.source_site_instance = params.source_site_instance; | 508 load_url_params.source_site_instance = params.source_site_instance; |
495 load_url_params.referrer = params.referrer; | 509 load_url_params.referrer = params.referrer; |
496 load_url_params.frame_tree_node_id = params.frame_tree_node_id; | 510 load_url_params.frame_tree_node_id = params.frame_tree_node_id; |
497 load_url_params.transition_type = params.transition; | 511 load_url_params.transition_type = params.transition; |
498 load_url_params.extra_headers = params.extra_headers; | 512 load_url_params.extra_headers = params.extra_headers; |
499 load_url_params.should_replace_current_entry = | 513 load_url_params.should_replace_current_entry = |
500 params.should_replace_current_entry; | 514 params.should_replace_current_entry; |
501 load_url_params.is_renderer_initiated = params.is_renderer_initiated; | 515 load_url_params.is_renderer_initiated = params.is_renderer_initiated; |
502 load_url_params.override_user_agent = | 516 load_url_params.override_user_agent = |
503 content::NavigationController::UA_OVERRIDE_TRUE; | 517 content::NavigationController::UA_OVERRIDE_TRUE; |
504 | 518 |
505 source->GetController().LoadURLWithParams(load_url_params); | 519 source->GetController().LoadURLWithParams(load_url_params); |
506 return source; | 520 return source; |
507 } | 521 } |
508 | 522 |
509 void BlimpEngineSession::RequestToLockMouse(content::WebContents* web_contents, | 523 void BlimpEngineSession::RequestToLockMouse(content::WebContents* web_contents, |
510 bool user_gesture, | 524 bool user_gesture, |
511 bool last_unlocked_by_target) { | 525 bool last_unlocked_by_target) { |
512 web_contents->GotResponseToLockMouseRequest(true); | 526 web_contents->GotResponseToLockMouseRequest(true); |
513 } | 527 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 parent->AddChild(content); | 563 parent->AddChild(content); |
550 content->Show(); | 564 content->Show(); |
551 | 565 |
552 tab_ = base::WrapUnique(new Tab(std::move(new_contents), target_tab_id, | 566 tab_ = base::WrapUnique(new Tab(std::move(new_contents), target_tab_id, |
553 &render_widget_feature_, | 567 &render_widget_feature_, |
554 navigation_message_sender_.get())); | 568 navigation_message_sender_.get())); |
555 } | 569 } |
556 | 570 |
557 } // namespace engine | 571 } // namespace engine |
558 } // namespace blimp | 572 } // namespace blimp |
OLD | NEW |