| 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 f9ba939d844ad18acc9ababcfad18f576437144e..ba1faa7ae09dbe1d5f53f4bec8bec92123c767cf 100644
|
| --- a/content/browser/web_contents/web_contents_impl.cc
|
| +++ b/content/browser/web_contents/web_contents_impl.cc
|
| @@ -925,6 +925,9 @@ void WebContentsImpl::IncrementCapturerCount(const gfx::Size& capture_size) {
|
| preferred_size_for_capture_ = capture_size;
|
| OnPreferredSizeChanged(preferred_size_);
|
| }
|
| +
|
| + // Ensure that all views are un-occluded before capture begins.
|
| + WasUnOccluded();
|
| }
|
|
|
| void WebContentsImpl::DecrementCapturerCount() {
|
| @@ -1025,14 +1028,11 @@ base::TimeTicks WebContentsImpl::GetLastActiveTime() const {
|
| void WebContentsImpl::WasShown() {
|
| controller_.SetActive(true);
|
|
|
| - std::set<RenderWidgetHostView*> widgets = GetRenderWidgetHostViewsInTree();
|
| - for (std::set<RenderWidgetHostView*>::iterator iter = widgets.begin();
|
| - iter != widgets.end();
|
| - iter++) {
|
| - if (*iter) {
|
| - (*iter)->Show();
|
| + for (RenderWidgetHostView* view : GetRenderWidgetHostViewsInTree()) {
|
| + if (view) {
|
| + view->Show();
|
| #if defined(OS_MACOSX)
|
| - (*iter)->SetActive(true);
|
| + view->SetActive(true);
|
| #endif
|
| }
|
| }
|
| @@ -1066,12 +1066,9 @@ void WebContentsImpl::WasHidden() {
|
| // removes the |GetRenderViewHost()|; then when we actually destroy the
|
| // window, OnWindowPosChanged() notices and calls WasHidden() (which
|
| // calls us).
|
| - std::set<RenderWidgetHostView*> widgets = GetRenderWidgetHostViewsInTree();
|
| - for (std::set<RenderWidgetHostView*>::iterator iter = widgets.begin();
|
| - iter != widgets.end();
|
| - iter++) {
|
| - if (*iter)
|
| - (*iter)->Hide();
|
| + for (RenderWidgetHostView* view : GetRenderWidgetHostViewsInTree()) {
|
| + if (view)
|
| + view->Hide();
|
| }
|
|
|
| // Release any video power save blockers held as video is not visible.
|
| @@ -1083,6 +1080,23 @@ void WebContentsImpl::WasHidden() {
|
| should_normally_be_visible_ = false;
|
| }
|
|
|
| +void WebContentsImpl::WasOccluded() {
|
| + if (capturer_count_ > 0)
|
| + return;
|
| +
|
| + for (RenderWidgetHostView* view : GetRenderWidgetHostViewsInTree()) {
|
| + if (view)
|
| + view->WasOccluded();
|
| + }
|
| +}
|
| +
|
| +void WebContentsImpl::WasUnOccluded() {
|
| + for (RenderWidgetHostView* view : GetRenderWidgetHostViewsInTree()) {
|
| + if (view)
|
| + view->WasUnOccluded();
|
| + }
|
| +}
|
| +
|
| bool WebContentsImpl::NeedToFireBeforeUnload() {
|
| // TODO(creis): Should we fire even for interstitial pages?
|
| return WillNotifyDisconnection() &&
|
|
|