Chromium Code Reviews| Index: content/browser/browser_plugin/browser_plugin_embedder.cc |
| diff --git a/content/browser/browser_plugin/browser_plugin_embedder.cc b/content/browser/browser_plugin/browser_plugin_embedder.cc |
| index eb4588d0c9c3a6058a1bb5528fc610319473a493..ba1c2c869daa639827e3bbf7fb9ac338fe8ff2d7 100644 |
| --- a/content/browser/browser_plugin/browser_plugin_embedder.cc |
| +++ b/content/browser/browser_plugin/browser_plugin_embedder.cc |
| @@ -34,7 +34,8 @@ BrowserPluginEmbedder::BrowserPluginEmbedder( |
| WebContentsImpl* web_contents, |
| RenderViewHost* render_view_host) |
| : WebContentsObserver(web_contents), |
| - render_view_host_(render_view_host) { |
| + render_view_host_(render_view_host), |
| + visible_(true) { |
| // Listen to visibility changes so that an embedder hides its guests |
| // as well. |
| registrar_.Add(this, |
| @@ -249,15 +250,14 @@ void BrowserPluginEmbedder::RenderViewGone(base::TerminationStatus status) { |
| } |
| void BrowserPluginEmbedder::WebContentsVisibilityChanged(bool visible) { |
| + visible_ = visible; |
| // If the embedder is hidden we need to hide the guests as well. |
| for (ContainerInstanceMap::const_iterator it = |
| guest_web_contents_by_instance_id_.begin(); |
| it != guest_web_contents_by_instance_id_.end(); ++it) { |
| - WebContents* web_contents = it->second; |
| - if (visible) |
| - web_contents->WasShown(); |
| - else |
| - web_contents->WasHidden(); |
| + WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(it->second); |
| + BrowserPluginGuest* guest = web_contents->GetBrowserPluginGuest(); |
| + guest->SetVisibility(visible, guest->visible()); |
| } |
| } |
| @@ -265,6 +265,13 @@ void BrowserPluginEmbedder::PluginDestroyed(int instance_id) { |
| DestroyGuestByInstanceID(instance_id); |
| } |
| +void BrowserPluginEmbedder::SetGuestVisibility(int instance_id, |
| + bool guest_visible) { |
| + BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id); |
| + if (guest) |
| + guest->SetVisibility(visible(), guest_visible); |
|
Charlie Reis
2012/10/05 00:33:18
Just use visible_.
Fady Samuel
2012/10/05 15:22:07
Done.
|
| +} |
| + |
| void BrowserPluginEmbedder::Go(int instance_id, int relative_index) { |
| BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id); |
| if (guest) |