Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/frame_host/cross_process_frame_connector.h" | 5 #include "content/browser/frame_host/cross_process_frame_connector.h" |
| 6 | 6 |
| 7 #include "cc/surfaces/surface.h" | 7 #include "cc/surfaces/surface.h" |
| 8 #include "cc/surfaces/surface_manager.h" | 8 #include "cc/surfaces/surface_manager.h" |
| 9 #include "content/browser/compositor/surface_utils.h" | 9 #include "content/browser/compositor/surface_utils.h" |
| 10 #include "content/browser/frame_host/frame_tree.h" | 10 #include "content/browser/frame_host/frame_tree.h" |
| 11 #include "content/browser/frame_host/frame_tree_node.h" | 11 #include "content/browser/frame_host/frame_tree_node.h" |
| 12 #include "content/browser/frame_host/render_frame_host_manager.h" | 12 #include "content/browser/frame_host/render_frame_host_manager.h" |
| 13 #include "content/browser/frame_host/render_frame_proxy_host.h" | 13 #include "content/browser/frame_host/render_frame_proxy_host.h" |
| 14 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | 14 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| 15 #include "content/browser/renderer_host/render_view_host_impl.h" | 15 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 16 #include "content/browser/renderer_host/render_widget_host_delegate.h" | |
| 16 #include "content/browser/renderer_host/render_widget_host_impl.h" | 17 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 17 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 18 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 18 #include "content/common/frame_messages.h" | 19 #include "content/common/frame_messages.h" |
| 19 #include "content/common/gpu/gpu_messages.h" | 20 #include "content/common/gpu/gpu_messages.h" |
| 20 #include "third_party/WebKit/public/web/WebInputEvent.h" | 21 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 21 | 22 |
| 22 namespace content { | 23 namespace content { |
| 23 | 24 |
| 24 CrossProcessFrameConnector::CrossProcessFrameConnector( | 25 CrossProcessFrameConnector::CrossProcessFrameConnector( |
| 25 RenderFrameProxyHost* frame_proxy_in_parent_renderer) | 26 RenderFrameProxyHost* frame_proxy_in_parent_renderer) |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 36 bool CrossProcessFrameConnector::OnMessageReceived(const IPC::Message& msg) { | 37 bool CrossProcessFrameConnector::OnMessageReceived(const IPC::Message& msg) { |
| 37 bool handled = true; | 38 bool handled = true; |
| 38 | 39 |
| 39 IPC_BEGIN_MESSAGE_MAP(CrossProcessFrameConnector, msg) | 40 IPC_BEGIN_MESSAGE_MAP(CrossProcessFrameConnector, msg) |
| 40 IPC_MESSAGE_HANDLER(FrameHostMsg_CompositorFrameSwappedACK, | 41 IPC_MESSAGE_HANDLER(FrameHostMsg_CompositorFrameSwappedACK, |
| 41 OnCompositorFrameSwappedACK) | 42 OnCompositorFrameSwappedACK) |
| 42 IPC_MESSAGE_HANDLER(FrameHostMsg_ReclaimCompositorResources, | 43 IPC_MESSAGE_HANDLER(FrameHostMsg_ReclaimCompositorResources, |
| 43 OnReclaimCompositorResources) | 44 OnReclaimCompositorResources) |
| 44 IPC_MESSAGE_HANDLER(FrameHostMsg_ForwardInputEvent, OnForwardInputEvent) | 45 IPC_MESSAGE_HANDLER(FrameHostMsg_ForwardInputEvent, OnForwardInputEvent) |
| 45 IPC_MESSAGE_HANDLER(FrameHostMsg_FrameRectChanged, OnFrameRectChanged) | 46 IPC_MESSAGE_HANDLER(FrameHostMsg_FrameRectChanged, OnFrameRectChanged) |
| 47 IPC_MESSAGE_HANDLER(FrameHostMsg_VisibilityChanged, OnVisibilityChanged) | |
| 46 IPC_MESSAGE_HANDLER(FrameHostMsg_InitializeChildFrame, | 48 IPC_MESSAGE_HANDLER(FrameHostMsg_InitializeChildFrame, |
| 47 OnInitializeChildFrame) | 49 OnInitializeChildFrame) |
| 48 IPC_MESSAGE_HANDLER(FrameHostMsg_SatisfySequence, OnSatisfySequence) | 50 IPC_MESSAGE_HANDLER(FrameHostMsg_SatisfySequence, OnSatisfySequence) |
| 49 IPC_MESSAGE_HANDLER(FrameHostMsg_RequireSequence, OnRequireSequence) | 51 IPC_MESSAGE_HANDLER(FrameHostMsg_RequireSequence, OnRequireSequence) |
| 50 IPC_MESSAGE_UNHANDLED(handled = false) | 52 IPC_MESSAGE_UNHANDLED(handled = false) |
| 51 IPC_END_MESSAGE_MAP() | 53 IPC_END_MESSAGE_MAP() |
| 52 | 54 |
| 53 return handled; | 55 return handled; |
| 54 } | 56 } |
| 55 | 57 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 return; | 211 return; |
| 210 } | 212 } |
| 211 } | 213 } |
| 212 | 214 |
| 213 void CrossProcessFrameConnector::OnFrameRectChanged( | 215 void CrossProcessFrameConnector::OnFrameRectChanged( |
| 214 const gfx::Rect& frame_rect) { | 216 const gfx::Rect& frame_rect) { |
| 215 if (!frame_rect.size().IsEmpty()) | 217 if (!frame_rect.size().IsEmpty()) |
| 216 SetSize(frame_rect); | 218 SetSize(frame_rect); |
| 217 } | 219 } |
| 218 | 220 |
| 221 void CrossProcessFrameConnector::OnVisibilityChanged(bool visible) { | |
| 222 if (!view_) | |
| 223 return; | |
| 224 if (static_cast<RenderWidgetHostImpl*>(view_->GetRenderWidgetHost()) | |
|
lazyboy
2015/11/11 22:04:27
1) If you only want to check if this is for a gues
EhsanK
2015/11/12 19:54:30
Done.
| |
| 225 ->delegate() | |
| 226 ->DidForwardVisibilityChangeToGuest(visible)) | |
| 227 return; | |
| 228 if (visible) | |
| 229 view_->Show(); | |
| 230 else | |
| 231 view_->Hide(); | |
| 232 } | |
| 233 | |
| 219 void CrossProcessFrameConnector::SetDeviceScaleFactor(float scale_factor) { | 234 void CrossProcessFrameConnector::SetDeviceScaleFactor(float scale_factor) { |
| 220 device_scale_factor_ = scale_factor; | 235 device_scale_factor_ = scale_factor; |
| 221 // The RenderWidgetHost is null in unit tests. | 236 // The RenderWidgetHost is null in unit tests. |
| 222 if (view_ && view_->GetRenderWidgetHost()) { | 237 if (view_ && view_->GetRenderWidgetHost()) { |
| 223 RenderWidgetHostImpl* child_widget = | 238 RenderWidgetHostImpl* child_widget = |
| 224 RenderWidgetHostImpl::From(view_->GetRenderWidgetHost()); | 239 RenderWidgetHostImpl::From(view_->GetRenderWidgetHost()); |
| 225 child_widget->NotifyScreenInfoChanged(); | 240 child_widget->NotifyScreenInfoChanged(); |
| 226 } | 241 } |
| 227 } | 242 } |
| 228 | 243 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 241 // in the case of nested WebContents. | 256 // in the case of nested WebContents. |
| 242 while (top_host->frame_tree_node()->render_manager()->ForInnerDelegate()) { | 257 while (top_host->frame_tree_node()->render_manager()->ForInnerDelegate()) { |
| 243 top_host = top_host->frame_tree_node()->render_manager()-> | 258 top_host = top_host->frame_tree_node()->render_manager()-> |
| 244 GetOuterDelegateNode()->frame_tree()->root()->current_frame_host(); | 259 GetOuterDelegateNode()->frame_tree()->root()->current_frame_host(); |
| 245 } | 260 } |
| 246 | 261 |
| 247 return static_cast<RenderWidgetHostViewBase*>(top_host->GetView()); | 262 return static_cast<RenderWidgetHostViewBase*>(top_host->GetView()); |
| 248 } | 263 } |
| 249 | 264 |
| 250 } // namespace content | 265 } // namespace content |
| OLD | NEW |