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 4659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4670 int render_frame_id, | 4670 int render_frame_id, |
4671 IPC::Message* reply_msg, | 4671 IPC::Message* reply_msg, |
4672 bool dialog_was_suppressed, | 4672 bool dialog_was_suppressed, |
4673 bool success, | 4673 bool success, |
4674 const base::string16& user_input) { | 4674 const base::string16& user_input) { |
4675 RenderFrameHostImpl* rfh = RenderFrameHostImpl::FromID(render_process_id, | 4675 RenderFrameHostImpl* rfh = RenderFrameHostImpl::FromID(render_process_id, |
4676 render_frame_id); | 4676 render_frame_id); |
4677 last_dialog_suppressed_ = dialog_was_suppressed; | 4677 last_dialog_suppressed_ = dialog_was_suppressed; |
4678 | 4678 |
4679 if (is_showing_before_unload_dialog_ && !success) { | 4679 if (is_showing_before_unload_dialog_ && !success) { |
4680 if (rfh) | 4680 // It is possible for the RenderFrameHost to have been swapped out in the |
nasko
2016/03/29 20:19:06
nit: Let's start avoiding using "swapped out" as t
clamy
2016/03/30 13:31:11
Done.
| |
4681 // meantime. Do not reset the navigation state in that case. | |
4682 if (rfh && rfh == rfh->frame_tree_node()->current_frame_host()) { | |
4681 rfh->frame_tree_node()->BeforeUnloadCanceled(); | 4683 rfh->frame_tree_node()->BeforeUnloadCanceled(); |
4682 controller_.DiscardNonCommittedEntries(); | 4684 controller_.DiscardNonCommittedEntries(); |
4685 } | |
4683 | 4686 |
4684 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 4687 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
4685 BeforeUnloadDialogCancelled()); | 4688 BeforeUnloadDialogCancelled()); |
4686 } | 4689 } |
4687 | 4690 |
4688 is_showing_before_unload_dialog_ = false; | 4691 is_showing_before_unload_dialog_ = false; |
4689 if (rfh) { | 4692 if (rfh) { |
4690 rfh->JavaScriptDialogClosed(reply_msg, success, user_input, | 4693 rfh->JavaScriptDialogClosed(reply_msg, success, user_input, |
4691 dialog_was_suppressed); | 4694 dialog_was_suppressed); |
4692 } else { | 4695 } else { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4825 else | 4828 else |
4826 WasHidden(); | 4829 WasHidden(); |
4827 } | 4830 } |
4828 | 4831 |
4829 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 4832 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
4830 JavaScriptDialogManager* dialog_manager) { | 4833 JavaScriptDialogManager* dialog_manager) { |
4831 dialog_manager_ = dialog_manager; | 4834 dialog_manager_ = dialog_manager; |
4832 } | 4835 } |
4833 | 4836 |
4834 } // namespace content | 4837 } // namespace content |
OLD | NEW |