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" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 void CrossProcessFrameConnector::OnFrameRectChanged( | 226 void CrossProcessFrameConnector::OnFrameRectChanged( |
227 const gfx::Rect& frame_rect) { | 227 const gfx::Rect& frame_rect) { |
228 if (!frame_rect.size().IsEmpty()) | 228 if (!frame_rect.size().IsEmpty()) |
229 SetSize(frame_rect); | 229 SetSize(frame_rect); |
230 } | 230 } |
231 | 231 |
232 void CrossProcessFrameConnector::OnVisibilityChanged(bool visible) { | 232 void CrossProcessFrameConnector::OnVisibilityChanged(bool visible) { |
233 if (!view_) | 233 if (!view_) |
234 return; | 234 return; |
235 | 235 |
| 236 // If there is an inner WebContents, it should be notified of the change in |
| 237 // the visibility. The Show/Hide methods will not be called if an inner |
| 238 // WebContents exists since the corresponding WebContents will itself call |
| 239 // Show/Hide on all the RenderWidgetHostViews (including this) one. |
| 240 if (frame_proxy_in_parent_renderer_->frame_tree_node() |
| 241 ->render_manager() |
| 242 ->ForInnerDelegate()) { |
| 243 RenderWidgetHostImpl::From(view_->GetRenderWidgetHost()) |
| 244 ->delegate() |
| 245 ->OnRenderFrameProxyVisibilityChanged(visible); |
| 246 return; |
| 247 } |
| 248 |
236 if (visible) | 249 if (visible) |
237 view_->Show(); | 250 view_->Show(); |
238 else | 251 else |
239 view_->Hide(); | 252 view_->Hide(); |
240 } | 253 } |
241 | 254 |
242 void CrossProcessFrameConnector::SetDeviceScaleFactor(float scale_factor) { | 255 void CrossProcessFrameConnector::SetDeviceScaleFactor(float scale_factor) { |
243 device_scale_factor_ = scale_factor; | 256 device_scale_factor_ = scale_factor; |
244 // The RenderWidgetHost is null in unit tests. | 257 // The RenderWidgetHost is null in unit tests. |
245 if (view_ && view_->GetRenderWidgetHost()) { | 258 if (view_ && view_->GetRenderWidgetHost()) { |
(...skipping 18 matching lines...) Expand all Loading... |
264 // in the case of nested WebContents. | 277 // in the case of nested WebContents. |
265 while (top_host->frame_tree_node()->render_manager()->ForInnerDelegate()) { | 278 while (top_host->frame_tree_node()->render_manager()->ForInnerDelegate()) { |
266 top_host = top_host->frame_tree_node()->render_manager()-> | 279 top_host = top_host->frame_tree_node()->render_manager()-> |
267 GetOuterDelegateNode()->frame_tree()->root()->current_frame_host(); | 280 GetOuterDelegateNode()->frame_tree()->root()->current_frame_host(); |
268 } | 281 } |
269 | 282 |
270 return static_cast<RenderWidgetHostViewBase*>(top_host->GetView()); | 283 return static_cast<RenderWidgetHostViewBase*>(top_host->GetView()); |
271 } | 284 } |
272 | 285 |
273 } // namespace content | 286 } // namespace content |
OLD | NEW |