| Index: content/browser/web_contents/web_contents_impl.cc
|
| diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
|
| index 3103e95e56624064e720877fba1a733c05020155..d08a20988a0bea07fadf417175b7853dcb9524f4 100644
|
| --- a/content/browser/web_contents/web_contents_impl.cc
|
| +++ b/content/browser/web_contents/web_contents_impl.cc
|
| @@ -338,6 +338,7 @@ WebContentsImpl::WebContentsImpl(BrowserContext* browser_context)
|
| did_first_visually_non_empty_paint_(false),
|
| capturer_count_(0),
|
| should_normally_be_visible_(true),
|
| + did_first_set_visible_(false),
|
| is_being_destroyed_(false),
|
| notify_disconnection_(false),
|
| dialog_manager_(NULL),
|
| @@ -4798,6 +4799,29 @@ void WebContentsImpl::MediaStoppedPlaying(
|
| FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id));
|
| }
|
|
|
| +void WebContentsImpl::UpdateWebContentsVisibility(bool visible) {
|
| + if (!did_first_set_visible_) {
|
| + // If this WebContents has not yet been set to be visible for the first
|
| + // time, ignore any requests to make it hidden, since resources would
|
| + // immediately be destroyed and only re-created after content loaded. In
|
| + // this state the window content is undefined and can show garbage.
|
| + // However, the page load mechanism requires an activation call through a
|
| + // visibility call to (re)load.
|
| + if (visible) {
|
| + did_first_set_visible_ = true;
|
| + WasShown();
|
| + }
|
| + return;
|
| + }
|
| + if (visible == should_normally_be_visible_)
|
| + return;
|
| +
|
| + if (visible)
|
| + WasShown();
|
| + else
|
| + WasHidden();
|
| +}
|
| +
|
| void WebContentsImpl::SetJavaScriptDialogManagerForTesting(
|
| JavaScriptDialogManager* dialog_manager) {
|
| dialog_manager_ = dialog_manager;
|
|
|