Commit 9462cefe authored by lfg's avatar lfg Committed by Commit bot

Ignore show messages from RemoteFrames when the WebContents is hidden.

BUG=628325
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation

Review-Url: https://codereview.chromium.org/2154833002
Cr-Commit-Position: refs/heads/master@{#406153}
parent e3b09da0
...@@ -276,10 +276,14 @@ void CrossProcessFrameConnector::OnVisibilityChanged(bool visible) { ...@@ -276,10 +276,14 @@ void CrossProcessFrameConnector::OnVisibilityChanged(bool visible) {
return; return;
} }
if (visible) if (visible &&
!RenderWidgetHostImpl::From(view_->GetRenderWidgetHost())
->delegate()
->IsHidden()) {
view_->Show(); view_->Show();
else } else if (!visible) {
view_->Hide(); view_->Hide();
}
} }
void CrossProcessFrameConnector::SetDeviceScaleFactor(float scale_factor) { void CrossProcessFrameConnector::SetDeviceScaleFactor(float scale_factor) {
......
...@@ -71,4 +71,8 @@ TextInputManager* RenderWidgetHostDelegate::GetTextInputManager() { ...@@ -71,4 +71,8 @@ TextInputManager* RenderWidgetHostDelegate::GetTextInputManager() {
return nullptr; return nullptr;
} }
bool RenderWidgetHostDelegate::IsHidden() {
return false;
}
} // namespace content } // namespace content
...@@ -192,7 +192,7 @@ class CONTENT_EXPORT RenderWidgetHostDelegate { ...@@ -192,7 +192,7 @@ class CONTENT_EXPORT RenderWidgetHostDelegate {
virtual void ForwardCompositorProto(RenderWidgetHostImpl* render_widget_host, virtual void ForwardCompositorProto(RenderWidgetHostImpl* render_widget_host,
const std::vector<uint8_t>& proto) {} const std::vector<uint8_t>& proto) {}
// Called when the visibility of the RenderFrameProxyHost in outter // Called when the visibility of the RenderFrameProxyHost in outer
// WebContents changes. This method is only called on an inner WebContents and // WebContents changes. This method is only called on an inner WebContents and
// will eventually notify all the RenderWidgetHostViews belonging to that // will eventually notify all the RenderWidgetHostViews belonging to that
// WebContents. // WebContents.
...@@ -209,6 +209,12 @@ class CONTENT_EXPORT RenderWidgetHostDelegate { ...@@ -209,6 +209,12 @@ class CONTENT_EXPORT RenderWidgetHostDelegate {
// Returns the TextInputManager tracking text input state. // Returns the TextInputManager tracking text input state.
virtual TextInputManager* GetTextInputManager(); virtual TextInputManager* GetTextInputManager();
// Returns true if this RenderWidgetHost should remain hidden. This is used by
// the RenderWidgetHost to ask the delegate if it can be shown in the event of
// something other than the WebContents attempting to enable visibility of
// this RenderWidgetHost.
virtual bool IsHidden();
protected: protected:
virtual ~RenderWidgetHostDelegate() {} virtual ~RenderWidgetHostDelegate() {}
}; };
......
...@@ -1951,9 +1951,9 @@ void WebContentsImpl::ForwardCompositorProto( ...@@ -1951,9 +1951,9 @@ void WebContentsImpl::ForwardCompositorProto(
} }
void WebContentsImpl::OnRenderFrameProxyVisibilityChanged(bool visible) { void WebContentsImpl::OnRenderFrameProxyVisibilityChanged(bool visible) {
if (visible) if (visible && !GetOuterWebContents()->IsHidden())
WasShown(); WasShown();
else else if (!visible)
WasHidden(); WasHidden();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment