Chromium Code Reviews| 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/engine/session/tab.h" | 5 #include "blimp/engine/session/tab.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
| 9 #include "blimp/common/create_blimp_message.h" | 9 #include "blimp/common/create_blimp_message.h" |
| 10 #include "blimp/common/proto/blimp_message.pb.h" | 10 #include "blimp/common/proto/blimp_message.pb.h" |
| 11 #include "blimp/common/proto/render_widget.pb.h" | 11 #include "blimp/common/proto/render_widget.pb.h" |
| 12 #include "blimp/common/proto/tab_control.pb.h" | 12 #include "blimp/common/proto/tab_control.pb.h" |
| 13 #include "blimp/engine/common/blimp_user_agent.h" | 13 #include "blimp/engine/common/blimp_user_agent.h" |
| 14 #include "blimp/engine/feature/engine_render_widget_feature.h" | 14 #include "blimp/engine/feature/engine_render_widget_feature.h" |
| 15 #include "blimp/net/blimp_message_processor.h" | 15 #include "blimp/net/blimp_message_processor.h" |
| 16 #include "content/public/browser/navigation_controller.h" | 16 #include "content/public/browser/navigation_controller.h" |
| 17 #include "content/public/browser/navigation_entry.h" | 17 #include "content/public/browser/navigation_entry.h" |
| 18 #include "content/public/browser/render_view_host.h" | 18 #include "content/public/browser/render_view_host.h" |
| 19 #include "content/public/browser/render_widget_host.h" | 19 #include "content/public/browser/render_widget_host.h" |
| 20 #include "content/public/browser/render_widget_host_view.h" | 20 #include "content/public/browser/render_widget_host_view.h" |
| 21 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
| 22 #include "content/public/common/renderer_preferences.h" | |
| 22 #include "ui/aura/window.h" | 23 #include "ui/aura/window.h" |
| 23 #include "ui/gfx/geometry/size.h" | 24 #include "ui/gfx/geometry/size.h" |
| 24 | 25 |
| 25 namespace blimp { | 26 namespace blimp { |
| 26 namespace engine { | 27 namespace engine { |
| 27 | 28 |
| 28 Tab::Tab(std::unique_ptr<content::WebContents> web_contents, | 29 Tab::Tab(std::unique_ptr<content::WebContents> web_contents, |
| 29 const int tab_id, | 30 const int tab_id, |
| 30 EngineRenderWidgetFeature* render_widget_feature, | 31 EngineRenderWidgetFeature* render_widget_feature, |
| 31 BlimpMessageProcessor* navigation_message_sender) | 32 BlimpMessageProcessor* navigation_message_sender) |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 web_contents_->GetController().GoForward(); | 97 web_contents_->GetController().GoForward(); |
| 97 } | 98 } |
| 98 | 99 |
| 99 void Tab::Reload() { | 100 void Tab::Reload() { |
| 100 DVLOG(1) << "Reload in tab " << tab_id_; | 101 DVLOG(1) << "Reload in tab " << tab_id_; |
| 101 web_contents_->GetController().Reload(true); | 102 web_contents_->GetController().Reload(true); |
| 102 } | 103 } |
| 103 | 104 |
| 104 void Tab::RenderViewCreated(content::RenderViewHost* render_view_host) { | 105 void Tab::RenderViewCreated(content::RenderViewHost* render_view_host) { |
| 105 DCHECK(render_view_host); | 106 DCHECK(render_view_host); |
| 107 web_contents_->GetMutableRendererPrefs()->caret_blink_interval = 0; | |
| 108 render_view_host->SyncRendererPrefs(); | |
|
Khushal
2016/10/10 18:57:09
Would it be nicer if content gave a callback befor
| |
| 109 | |
| 106 render_widget_feature_->OnRenderWidgetCreated(tab_id_, | 110 render_widget_feature_->OnRenderWidgetCreated(tab_id_, |
| 107 render_view_host->GetWidget()); | 111 render_view_host->GetWidget()); |
| 108 } | 112 } |
| 109 | 113 |
| 110 void Tab::RenderViewHostChanged(content::RenderViewHost* old_host, | 114 void Tab::RenderViewHostChanged(content::RenderViewHost* old_host, |
| 111 content::RenderViewHost* new_host) { | 115 content::RenderViewHost* new_host) { |
| 112 render_widget_feature_->OnRenderWidgetInitialized(tab_id_, | 116 render_widget_feature_->OnRenderWidgetInitialized(tab_id_, |
| 113 new_host->GetWidget()); | 117 new_host->GetWidget()); |
| 114 } | 118 } |
| 115 | 119 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 167 void Tab::OnCompositorMessageReceived( | 171 void Tab::OnCompositorMessageReceived( |
| 168 content::RenderWidgetHost* render_widget_host, | 172 content::RenderWidgetHost* render_widget_host, |
| 169 const std::vector<uint8_t>& message) { | 173 const std::vector<uint8_t>& message) { |
| 170 TRACE_EVENT0("blimp", "Tab::OnCompositorMessageReceived"); | 174 TRACE_EVENT0("blimp", "Tab::OnCompositorMessageReceived"); |
| 171 | 175 |
| 172 render_widget_host->HandleCompositorProto(message); | 176 render_widget_host->HandleCompositorProto(message); |
| 173 } | 177 } |
| 174 | 178 |
| 175 } // namespace engine | 179 } // namespace engine |
| 176 } // namespace blimp | 180 } // namespace blimp |
| OLD | NEW |