Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Side by Side Diff: content/browser/frame_host/cross_process_frame_connector.cc

Issue 1414663011: Notifying the Out of Process Renderer about Visibility Change of a Remote Frame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added WebContentsImpl::ForwardVisibilityChangeToInnerContents(bool) Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 return; 222 return;
221 } 223 }
222 } 224 }
223 225
224 void CrossProcessFrameConnector::OnFrameRectChanged( 226 void CrossProcessFrameConnector::OnFrameRectChanged(
225 const gfx::Rect& frame_rect) { 227 const gfx::Rect& frame_rect) {
226 if (!frame_rect.size().IsEmpty()) 228 if (!frame_rect.size().IsEmpty())
227 SetSize(frame_rect); 229 SetSize(frame_rect);
228 } 230 }
229 231
232 void CrossProcessFrameConnector::OnVisibilityChanged(bool visible) {
233 if (!view_)
234 return;
235
236 if (frame_proxy_in_parent_renderer_->frame_tree_node()
Charlie Reis 2015/12/10 07:45:19 I feel like this is a bit hard to follow. Can you
EhsanK 2015/12/10 17:08:31 This part is checking if the corresponding RWHVCF
237 ->render_manager()
238 ->ForInnerDelegate()) {
239 RenderWidgetHostImpl::From(view_->GetRenderWidgetHost())
240 ->delegate()
241 ->ForwardVisibilityChangeToInnerContents(visible);
242 return;
243 }
244
245 if (visible)
246 view_->Show();
247 else
248 view_->Hide();
249 }
250
230 void CrossProcessFrameConnector::SetDeviceScaleFactor(float scale_factor) { 251 void CrossProcessFrameConnector::SetDeviceScaleFactor(float scale_factor) {
231 device_scale_factor_ = scale_factor; 252 device_scale_factor_ = scale_factor;
232 // The RenderWidgetHost is null in unit tests. 253 // The RenderWidgetHost is null in unit tests.
233 if (view_ && view_->GetRenderWidgetHost()) { 254 if (view_ && view_->GetRenderWidgetHost()) {
234 RenderWidgetHostImpl* child_widget = 255 RenderWidgetHostImpl* child_widget =
235 RenderWidgetHostImpl::From(view_->GetRenderWidgetHost()); 256 RenderWidgetHostImpl::From(view_->GetRenderWidgetHost());
236 child_widget->NotifyScreenInfoChanged(); 257 child_widget->NotifyScreenInfoChanged();
237 } 258 }
238 } 259 }
239 260
(...skipping 12 matching lines...) Expand all
252 // in the case of nested WebContents. 273 // in the case of nested WebContents.
253 while (top_host->frame_tree_node()->render_manager()->ForInnerDelegate()) { 274 while (top_host->frame_tree_node()->render_manager()->ForInnerDelegate()) {
254 top_host = top_host->frame_tree_node()->render_manager()-> 275 top_host = top_host->frame_tree_node()->render_manager()->
255 GetOuterDelegateNode()->frame_tree()->root()->current_frame_host(); 276 GetOuterDelegateNode()->frame_tree()->root()->current_frame_host();
256 } 277 }
257 278
258 return static_cast<RenderWidgetHostViewBase*>(top_host->GetView()); 279 return static_cast<RenderWidgetHostViewBase*>(top_host->GetView());
259 } 280 }
260 281
261 } // namespace content 282 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698