From 0578a5011ceff5a50c9e2905d48d5747cf72569b Mon Sep 17 00:00:00 2001 From: "erikkay@google.com" Date: Mon, 10 Nov 2008 19:34:43 +0000 Subject: Change old code from "unloadListnerChanged" model to new WebKit EnableSuddenTermination, unforking a bunch of code. BUG=http://crbug.com/4064 Review URL: http://codereview.chromium.org/9746 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5116 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/renderer/render_view.cc | 24 ++++++------------------ chrome/renderer/render_view.h | 3 ++- 2 files changed, 8 insertions(+), 19 deletions(-) (limited to 'chrome') diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index cbae9d0..66a5092 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -1647,24 +1647,12 @@ bool RenderView::RunBeforeUnloadConfirm(WebView* webview, return success; } -void RenderView::OnUnloadListenerChanged(WebView* webview, WebFrame* webframe) { - bool has_listener = false; - if (!has_unload_listener_) { - has_listener = webframe->HasUnloadListener(); - } else { - WebFrame* frame = webview->GetMainFrame(); - while (frame != NULL) { - if (frame->HasUnloadListener()) { - has_listener = true; - break; - } - frame = webview->GetNextFrameAfter(frame, false); - } - } - if (has_listener != has_unload_listener_) { - has_unload_listener_ = has_listener; - Send(new ViewHostMsg_UnloadListenerChanged(routing_id_, has_listener)); - } +void RenderView::EnableSuddenTermination() { + Send(new ViewHostMsg_UnloadListenerChanged(routing_id_, false)); +} + +void RenderView::DisableSuddenTermination() { + Send(new ViewHostMsg_UnloadListenerChanged(routing_id_, true)); } void RenderView::QueryFormFieldAutofill(const std::wstring& field_name, diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index 8484afd..3006448 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -126,7 +126,8 @@ class RenderView : public RenderWidget, public WebViewDelegate, std::wstring* result); virtual bool RunBeforeUnloadConfirm(WebView* webview, const std::wstring& message); - virtual void OnUnloadListenerChanged(WebView* webview, WebFrame* webframe); + virtual void EnableSuddenTermination(); + virtual void DisableSuddenTermination(); virtual void QueryFormFieldAutofill(const std::wstring& field_name, const std::wstring& text, int64 node_id); -- cgit v1.1