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/thread_task_runner_handle.h" | 13 #include "base/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/net/blimp_connection.h" | 26 #include "blimp/net/blimp_connection.h" |
26 #include "blimp/net/blimp_message_multiplexer.h" | 27 #include "blimp/net/blimp_message_multiplexer.h" |
27 #include "blimp/net/blimp_message_thread_pipe.h" | 28 #include "blimp/net/blimp_message_thread_pipe.h" |
29 #include "blimp/net/blob_channel/blob_channel_sender.h" | |
30 #include "blimp/net/blob_channel/helium_blob_sender_delegate.h" | |
28 #include "blimp/net/browser_connection_handler.h" | 31 #include "blimp/net/browser_connection_handler.h" |
29 #include "blimp/net/common.h" | 32 #include "blimp/net/common.h" |
30 #include "blimp/net/engine_authentication_handler.h" | 33 #include "blimp/net/engine_authentication_handler.h" |
31 #include "blimp/net/engine_connection_manager.h" | 34 #include "blimp/net/engine_connection_manager.h" |
32 #include "blimp/net/null_blimp_message_processor.h" | 35 #include "blimp/net/null_blimp_message_processor.h" |
33 #include "blimp/net/tcp_engine_transport.h" | 36 #include "blimp/net/tcp_engine_transport.h" |
34 #include "blimp/net/thread_pipe_manager.h" | 37 #include "blimp/net/thread_pipe_manager.h" |
35 #include "content/public/browser/browser_context.h" | 38 #include "content/public/browser/browser_context.h" |
36 #include "content/public/browser/browser_thread.h" | 39 #include "content/public/browser/browser_thread.h" |
37 #include "content/public/browser/navigation_controller.h" | 40 #include "content/public/browser/navigation_controller.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
206 std::unique_ptr<BlimpBrowserContext> browser_context, | 209 std::unique_ptr<BlimpBrowserContext> browser_context, |
207 net::NetLog* net_log, | 210 net::NetLog* net_log, |
208 BlimpEngineConfig* engine_config, | 211 BlimpEngineConfig* engine_config, |
209 SettingsManager* settings_manager) | 212 SettingsManager* settings_manager) |
210 : browser_context_(std::move(browser_context)), | 213 : browser_context_(std::move(browser_context)), |
211 engine_config_(engine_config), | 214 engine_config_(engine_config), |
212 screen_(new BlimpScreen), | 215 screen_(new BlimpScreen), |
213 settings_manager_(settings_manager), | 216 settings_manager_(settings_manager), |
214 settings_feature_(settings_manager_), | 217 settings_feature_(settings_manager_), |
215 render_widget_feature_(settings_manager_), | 218 render_widget_feature_(settings_manager_), |
219 blob_delegate_(new HeliumBlobSenderDelegate), | |
220 blob_sender_(base::WrapUnique( | |
221 new BlobChannelSender(base::WrapUnique(new InMemoryBlobCache), | |
222 base::WrapUnique(blob_delegate_)))), | |
Wez
2016/05/21 01:08:05
Ick! Really not keen on this thing of passing owne
Kevin M
2016/05/27 22:35:31
Done.
Wez
2016/06/07 01:18:31
Looks like you're still doing the same thing, exce
| |
216 net_components_( | 223 net_components_( |
217 new EngineNetworkComponents(net_log, | 224 new EngineNetworkComponents(net_log, |
218 QuitCurrentMessageLoopClosure())) { | 225 QuitCurrentMessageLoopClosure())) { |
219 DCHECK(engine_config_); | 226 DCHECK(engine_config_); |
220 DCHECK(settings_manager_); | 227 DCHECK(settings_manager_); |
221 screen_->UpdateDisplayScaleAndSize(kDefaultScaleFactor, | 228 screen_->UpdateDisplayScaleAndSize( |
222 gfx::Size(kDefaultDisplayWidth, | 229 kDefaultScaleFactor, |
223 kDefaultDisplayHeight)); | 230 gfx::Size(kDefaultDisplayWidth, kDefaultDisplayHeight)); |
224 render_widget_feature_.SetDelegate(kDummyTabId, this); | 231 render_widget_feature_.SetDelegate(kDummyTabId, this); |
225 } | 232 } |
226 | 233 |
227 BlimpEngineSession::~BlimpEngineSession() { | 234 BlimpEngineSession::~BlimpEngineSession() { |
228 render_widget_feature_.RemoveDelegate(kDummyTabId); | 235 render_widget_feature_.RemoveDelegate(kDummyTabId); |
229 | 236 |
230 window_tree_host_->GetInputMethod()->RemoveObserver(this); | 237 window_tree_host_->GetInputMethod()->RemoveObserver(this); |
231 | 238 |
232 // Ensure that all WebContents are torn down first, since teardown will | 239 // Ensure that all WebContents are torn down first, since teardown will |
233 // trigger RenderViewDeleted callbacks to their observers. | 240 // trigger RenderViewDeleted callbacks to their observers. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
301 &render_widget_feature_)); | 308 &render_widget_feature_)); |
302 render_widget_feature_.set_input_message_sender( | 309 render_widget_feature_.set_input_message_sender( |
303 thread_pipe_manager_->RegisterFeature(BlimpMessage::INPUT, | 310 thread_pipe_manager_->RegisterFeature(BlimpMessage::INPUT, |
304 &render_widget_feature_)); | 311 &render_widget_feature_)); |
305 render_widget_feature_.set_compositor_message_sender( | 312 render_widget_feature_.set_compositor_message_sender( |
306 thread_pipe_manager_->RegisterFeature(BlimpMessage::COMPOSITOR, | 313 thread_pipe_manager_->RegisterFeature(BlimpMessage::COMPOSITOR, |
307 &render_widget_feature_)); | 314 &render_widget_feature_)); |
308 render_widget_feature_.set_ime_message_sender( | 315 render_widget_feature_.set_ime_message_sender( |
309 thread_pipe_manager_->RegisterFeature(BlimpMessage::IME, | 316 thread_pipe_manager_->RegisterFeature(BlimpMessage::IME, |
310 &render_widget_feature_)); | 317 &render_widget_feature_)); |
318 blob_delegate_->set_outgoing_message_processor( | |
319 thread_pipe_manager_->RegisterFeature(BlimpMessage::BLOB_CHANNEL, | |
320 blob_delegate_)); | |
311 | 321 |
312 // The Settings feature does not need an outgoing message processor, since we | 322 // The Settings feature does not need an outgoing message processor, since we |
313 // don't send any messages to the client right now. | 323 // don't send any messages to the client right now. |
314 thread_pipe_manager_->RegisterFeature(BlimpMessage::SETTINGS, | 324 thread_pipe_manager_->RegisterFeature(BlimpMessage::SETTINGS, |
315 &settings_feature_); | 325 &settings_feature_); |
316 } | 326 } |
317 | 327 |
318 bool BlimpEngineSession::CreateWebContents(const int target_tab_id) { | 328 bool BlimpEngineSession::CreateWebContents(const int target_tab_id) { |
319 DVLOG(1) << "Create tab " << target_tab_id; | 329 DVLOG(1) << "Create tab " << target_tab_id; |
320 // TODO(haibinlu): Support more than one active WebContents (crbug/547231). | 330 // TODO(haibinlu): Support more than one active WebContents (crbug/547231). |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
585 if (changed_flags & content::InvalidateTypes::INVALIDATE_TYPE_TITLE) | 595 if (changed_flags & content::InvalidateTypes::INVALIDATE_TYPE_TITLE) |
586 details->set_title(base::UTF16ToUTF8(source->GetTitle())); | 596 details->set_title(base::UTF16ToUTF8(source->GetTitle())); |
587 | 597 |
588 if (changed_flags & content::InvalidateTypes::INVALIDATE_TYPE_LOAD) | 598 if (changed_flags & content::InvalidateTypes::INVALIDATE_TYPE_LOAD) |
589 details->set_loading(source->IsLoading()); | 599 details->set_loading(source->IsLoading()); |
590 | 600 |
591 navigation_message_sender_->ProcessMessage(std::move(message), | 601 navigation_message_sender_->ProcessMessage(std::move(message), |
592 net::CompletionCallback()); | 602 net::CompletionCallback()); |
593 } | 603 } |
594 | 604 |
595 void BlimpEngineSession::LoadProgressChanged( | 605 void BlimpEngineSession::LoadProgressChanged(content::WebContents* source, |
596 content::WebContents* source, double progress) { | 606 double progress) { |
597 if (source != web_contents_.get()) | 607 if (source != web_contents_.get()) |
598 return; | 608 return; |
599 | 609 |
600 bool page_load_completed = (progress == 1.0); | 610 bool page_load_completed = (progress == 1.0); |
601 | 611 |
602 // If the client has been notified of a page load completed change, avoid | 612 // If the client has been notified of a page load completed change, avoid |
603 // sending another message. For the first navigation, the initial value used | 613 // sending another message. For the first navigation, the initial value used |
604 // by the client is already false. | 614 // by the client is already false. |
605 if (last_page_load_completed_value_ == page_load_completed) | 615 if (last_page_load_completed_value_ == page_load_completed) |
606 return; | 616 return; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
648 | 658 |
649 aura::Window* parent = window_tree_host_->window(); | 659 aura::Window* parent = window_tree_host_->window(); |
650 aura::Window* content = web_contents_->GetNativeView(); | 660 aura::Window* content = web_contents_->GetNativeView(); |
651 if (!parent->Contains(content)) | 661 if (!parent->Contains(content)) |
652 parent->AddChild(content); | 662 parent->AddChild(content); |
653 content->Show(); | 663 content->Show(); |
654 } | 664 } |
655 | 665 |
656 } // namespace engine | 666 } // namespace engine |
657 } // namespace blimp | 667 } // namespace blimp |
OLD | NEW |