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

Side by Side Diff: ui/views/controls/webview/web_dialog_view.cc

Issue 2803633004: Revert of Keep track in the browser of which frames have onunload and onbeforeunload handlers. (Closed)
Patch Set: 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
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/views/controls/webview/web_dialog_view.h" 5 #include "ui/views/controls/webview/web_dialog_view.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "content/public/browser/browser_context.h" 10 #include "content/public/browser/browser_context.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // If CloseContents() is called before CanClose(), which is called by 103 // If CloseContents() is called before CanClose(), which is called by
104 // RenderViewHostImpl::ClosePageIgnoringUnloadEvents, it indicates 104 // RenderViewHostImpl::ClosePageIgnoringUnloadEvents, it indicates
105 // beforeunload event should not be fired during closing. 105 // beforeunload event should not be fired during closing.
106 if ((is_attempting_close_dialog_ && before_unload_fired_) || 106 if ((is_attempting_close_dialog_ && before_unload_fired_) ||
107 close_contents_called_) { 107 close_contents_called_) {
108 is_attempting_close_dialog_ = false; 108 is_attempting_close_dialog_ = false;
109 before_unload_fired_ = false; 109 before_unload_fired_ = false;
110 return true; 110 return true;
111 } 111 }
112 112
113 if (!is_attempting_close_dialog_ && 113 if (!is_attempting_close_dialog_) {
114 web_view_->web_contents()->NeedToFireBeforeUnload()) {
115 // Fire beforeunload event when user attempts to close the dialog. 114 // Fire beforeunload event when user attempts to close the dialog.
116 is_attempting_close_dialog_ = true; 115 is_attempting_close_dialog_ = true;
117 web_view_->web_contents()->DispatchBeforeUnload(); 116 web_view_->web_contents()->DispatchBeforeUnload();
118 } 117 }
119 return false; 118 return false;
120 } 119 }
121 120
122 //////////////////////////////////////////////////////////////////////////////// 121 ////////////////////////////////////////////////////////////////////////////////
123 // WebDialogView, views::WidgetDelegate implementation: 122 // WebDialogView, views::WidgetDelegate implementation:
124 123
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 web_contents->SetDelegate(this); 360 web_contents->SetDelegate(this);
362 361
363 // Set the delegate. This must be done before loading the page. See 362 // Set the delegate. This must be done before loading the page. See
364 // the comment above WebDialogUI in its header file for why. 363 // the comment above WebDialogUI in its header file for why.
365 WebDialogUI::SetDelegate(web_contents, this); 364 WebDialogUI::SetDelegate(web_contents, this);
366 365
367 web_view_->LoadInitialURL(GetDialogContentURL()); 366 web_view_->LoadInitialURL(GetDialogContentURL());
368 } 367 }
369 368
370 } // namespace views 369 } // namespace views
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698