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

Side by Side Diff: chrome/renderer/prerender/prerender_helper.cc

Issue 1991273003: Fire visibilityChange event on out-of-process iframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: WebView->WebFrame Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/prerender/prerender_helper.h" 5 #include "chrome/renderer/prerender/prerender_helper.h"
6 6
7 #include "base/metrics/field_trial.h" 7 #include "base/metrics/field_trial.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "chrome/common/prerender_messages.h" 9 #include "chrome/common/prerender_messages.h"
10 #include "content/public/renderer/document_state.h" 10 #include "content/public/renderer/document_state.h"
11 #include "content/public/renderer/render_frame.h" 11 #include "content/public/renderer/render_frame.h"
12 #include "content/public/renderer/render_view.h" 12 #include "content/public/renderer/render_view.h"
13 #include "third_party/WebKit/public/web/WebFrame.h" 13 #include "third_party/WebKit/public/web/WebFrame.h"
14 #include "third_party/WebKit/public/web/WebView.h" 14 #include "third_party/WebKit/public/web/WebView.h"
15 15
16 using content::DocumentState; 16 using content::DocumentState;
17 17
18 namespace { 18 namespace {
19 19
20 // Updates the visibility state of the RenderFrame. Must be called whenever 20 // Updates the visibility state of the RenderFrame. Must be called whenever
21 // prerendering starts or finishes and the page is about to be show. At both 21 // prerendering starts or finishes and the page is about to be show. At both
22 // those times, the RenderFrame is hidden. 22 // those times, the RenderFrame is hidden.
23 void UpdateVisibilityState(content::RenderFrame* render_frame) { 23 void UpdateVisibilityState(content::RenderFrame* render_frame) {
24 // TODO(jam): until the prerendering code works on frames instead of views, we 24 // TODO(jam): until the prerendering code works on frames instead of views, we
25 // have to do this awkward check. 25 // have to do this awkward check.
26 content::RenderView* render_view = render_frame->GetRenderView(); 26 content::RenderView* render_view = render_frame->GetRenderView();
27 if (render_view->GetMainRenderFrame() == render_frame) { 27 if (render_view->GetMainRenderFrame() == render_frame) {
28 render_view->GetWebView()->setVisibilityState( 28 render_view->GetWebView()->setVisibilityState(
29 render_view->GetVisibilityState(), false); 29 render_frame->GetVisibilityState(), false);
30 } 30 }
31 } 31 }
32 32
33 } // namespace 33 } // namespace
34 34
35 namespace prerender { 35 namespace prerender {
36 36
37 PrerenderHelper::PrerenderHelper(content::RenderFrame* render_frame) 37 PrerenderHelper::PrerenderHelper(content::RenderFrame* render_frame)
38 : content::RenderFrameObserver(render_frame), 38 : content::RenderFrameObserver(render_frame),
39 content::RenderFrameObserverTracker<PrerenderHelper>(render_frame) { 39 content::RenderFrameObserverTracker<PrerenderHelper>(render_frame) {
(...skipping 27 matching lines...) Expand all
67 content::RenderFrame* frame = render_frame(); 67 content::RenderFrame* frame = render_frame();
68 // |this| must be deleted so PrerenderHelper::IsPrerendering returns false 68 // |this| must be deleted so PrerenderHelper::IsPrerendering returns false
69 // when the visibility state is updated, so the visibility state string will 69 // when the visibility state is updated, so the visibility state string will
70 // not be "prerendered". 70 // not be "prerendered".
71 delete this; 71 delete this;
72 72
73 UpdateVisibilityState(frame); 73 UpdateVisibilityState(frame);
74 } 74 }
75 75
76 } // namespace prerender 76 } // namespace prerender
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_manager.cc » ('j') | content/renderer/render_view_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698