Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 4670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4681 int render_frame_id, | 4681 int render_frame_id, |
| 4682 IPC::Message* reply_msg, | 4682 IPC::Message* reply_msg, |
| 4683 bool dialog_was_suppressed, | 4683 bool dialog_was_suppressed, |
| 4684 bool success, | 4684 bool success, |
| 4685 const base::string16& user_input) { | 4685 const base::string16& user_input) { |
| 4686 RenderFrameHostImpl* rfh = RenderFrameHostImpl::FromID(render_process_id, | 4686 RenderFrameHostImpl* rfh = RenderFrameHostImpl::FromID(render_process_id, |
| 4687 render_frame_id); | 4687 render_frame_id); |
| 4688 last_dialog_suppressed_ = dialog_was_suppressed; | 4688 last_dialog_suppressed_ = dialog_was_suppressed; |
| 4689 | 4689 |
| 4690 if (is_showing_before_unload_dialog_ && !success) { | 4690 if (is_showing_before_unload_dialog_ && !success) { |
| 4691 if (rfh) | 4691 // It is possible for the current RenderFrameHost to have changed in the |
| 4692 // meantime. Do not reset the navigation state in that case. | |
| 4693 if (rfh && rfh == rfh->frame_tree_node()->current_frame_host()) { | |
| 4692 rfh->frame_tree_node()->BeforeUnloadCanceled(); | 4694 rfh->frame_tree_node()->BeforeUnloadCanceled(); |
| 4693 controller_.DiscardNonCommittedEntries(); | 4695 controller_.DiscardNonCommittedEntries(); |
|
carlosk
2016/03/31 09:48:58
This used to be called even if BeforeUnloadCancele
clamy
2016/04/01 10:19:00
Yes. This avoids deleting the entry when we're in
| |
| 4696 } | |
| 4694 | 4697 |
| 4695 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 4698 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 4696 BeforeUnloadDialogCancelled()); | 4699 BeforeUnloadDialogCancelled()); |
| 4697 } | 4700 } |
| 4698 | 4701 |
| 4699 is_showing_before_unload_dialog_ = false; | 4702 is_showing_before_unload_dialog_ = false; |
| 4700 if (rfh) { | 4703 if (rfh) { |
| 4701 rfh->JavaScriptDialogClosed(reply_msg, success, user_input, | 4704 rfh->JavaScriptDialogClosed(reply_msg, success, user_input, |
| 4702 dialog_was_suppressed); | 4705 dialog_was_suppressed); |
| 4703 } else { | 4706 } else { |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4836 else | 4839 else |
| 4837 WasHidden(); | 4840 WasHidden(); |
| 4838 } | 4841 } |
| 4839 | 4842 |
| 4840 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 4843 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
| 4841 JavaScriptDialogManager* dialog_manager) { | 4844 JavaScriptDialogManager* dialog_manager) { |
| 4842 dialog_manager_ = dialog_manager; | 4845 dialog_manager_ = dialog_manager; |
| 4843 } | 4846 } |
| 4844 | 4847 |
| 4845 } // namespace content | 4848 } // namespace content |
| OLD | NEW |