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

Unified Diff: content/browser/browser_plugin/browser_plugin_embedder.cc

Issue 11066032: Browser Plugin: Update Guest WebContents Visibility on BrowserPlugin Visiblity Change. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nits Created 8 years, 2 months 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 side-by-side diff with in-line comments
Download patch
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..091c00c90b0bb8c400514743bb4431de4d7e1599 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);
+}
+
void BrowserPluginEmbedder::Go(int instance_id, int relative_index) {
BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id);
if (guest)

Powered by Google App Engine
This is Rietveld 408576698