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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 2783723002: Keep track in the browser of which frames have onunload and onbeforeunload handlers. (Closed)
Patch Set: fix tests Created 3 years, 8 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 "content/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 void WebContentsImpl::WasUnOccluded() { 1415 void WebContentsImpl::WasUnOccluded() {
1416 for (RenderWidgetHostView* view : GetRenderWidgetHostViewsInTree()) { 1416 for (RenderWidgetHostView* view : GetRenderWidgetHostViewsInTree()) {
1417 if (view) 1417 if (view)
1418 view->WasUnOccluded(); 1418 view->WasUnOccluded();
1419 } 1419 }
1420 } 1420 }
1421 1421
1422 bool WebContentsImpl::NeedToFireBeforeUnload() { 1422 bool WebContentsImpl::NeedToFireBeforeUnload() {
1423 // TODO(creis): Should we fire even for interstitial pages? 1423 // TODO(creis): Should we fire even for interstitial pages?
1424 return WillNotifyDisconnection() && !ShowingInterstitialPage() && 1424 return WillNotifyDisconnection() && !ShowingInterstitialPage() &&
1425 !GetRenderViewHost()->SuddenTerminationAllowed(); 1425 !GetRenderViewHost()->SuddenTerminationAllowed() &&
1426 (GetMainFrame()->ShouldDispatchBeforeUnload() ||
1427 GetMainFrame()->ShouldDispatchUnload());
nasko 2017/03/29 21:45:17 Why would unload handler matter for NeedToFireBefo
jam 2017/03/29 22:19:09 That was my initial thought as well. I had to add
1426 } 1428 }
1427 1429
1428 void WebContentsImpl::DispatchBeforeUnload() { 1430 void WebContentsImpl::DispatchBeforeUnload() {
1429 bool for_cross_site_transition = false; 1431 bool for_cross_site_transition = false;
1430 GetMainFrame()->DispatchBeforeUnload(for_cross_site_transition, false); 1432 GetMainFrame()->DispatchBeforeUnload(for_cross_site_transition, false);
1431 } 1433 }
1432 1434
1433 void WebContentsImpl::AttachToOuterWebContentsFrame( 1435 void WebContentsImpl::AttachToOuterWebContentsFrame(
1434 WebContents* outer_web_contents, 1436 WebContents* outer_web_contents,
1435 RenderFrameHost* outer_contents_frame) { 1437 RenderFrameHost* outer_contents_frame) {
(...skipping 3975 matching lines...) Expand 10 before | Expand all | Expand 10 after
5411 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); 5413 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host);
5412 if (!render_view_host) 5414 if (!render_view_host)
5413 continue; 5415 continue;
5414 render_view_host_set.insert(render_view_host); 5416 render_view_host_set.insert(render_view_host);
5415 } 5417 }
5416 for (RenderViewHost* render_view_host : render_view_host_set) 5418 for (RenderViewHost* render_view_host : render_view_host_set)
5417 render_view_host->OnWebkitPreferencesChanged(); 5419 render_view_host->OnWebkitPreferencesChanged();
5418 } 5420 }
5419 5421
5420 } // namespace content 5422 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698