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 4672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4683 void WebContentsImpl::OnDialogClosed(int render_process_id, | 4683 void WebContentsImpl::OnDialogClosed(int render_process_id, |
| 4684 int render_frame_id, | 4684 int render_frame_id, |
| 4685 IPC::Message* reply_msg, | 4685 IPC::Message* reply_msg, |
| 4686 bool dialog_was_suppressed, | 4686 bool dialog_was_suppressed, |
| 4687 bool success, | 4687 bool success, |
| 4688 const base::string16& user_input) { | 4688 const base::string16& user_input) { |
| 4689 RenderFrameHostImpl* rfh = RenderFrameHostImpl::FromID(render_process_id, | 4689 RenderFrameHostImpl* rfh = RenderFrameHostImpl::FromID(render_process_id, |
| 4690 render_frame_id); | 4690 render_frame_id); |
| 4691 last_dialog_suppressed_ = dialog_was_suppressed; | 4691 last_dialog_suppressed_ = dialog_was_suppressed; |
| 4692 | 4692 |
| 4693 if (is_showing_before_unload_dialog_ && !success) { | 4693 // It is possible for the RenderFrameHost to have been swapped out in the |
| 4694 // meantime. Do not reset the navigation state in that case. | |
| 4695 if (is_showing_before_unload_dialog_ && !success && rfh == GetMainFrame()) { | |
|
Charlie Reis
2016/03/24 21:50:41
This won't work for subframes. (I know we have so
clamy
2016/03/25 13:43:48
I don't quite see which NavigationHandle I should
Charlie Reis
2016/03/25 23:59:43
Ok. I hadn't looked closely enough to see which R
clamy
2016/03/29 13:01:50
Done.
| |
| 4694 if (rfh) | 4696 if (rfh) |
| 4695 rfh->frame_tree_node()->BeforeUnloadCanceled(); | 4697 rfh->frame_tree_node()->BeforeUnloadCanceled(); |
| 4696 controller_.DiscardNonCommittedEntries(); | 4698 controller_.DiscardNonCommittedEntries(); |
| 4697 | 4699 |
| 4698 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 4700 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 4699 BeforeUnloadDialogCancelled()); | 4701 BeforeUnloadDialogCancelled()); |
|
Charlie Reis
2016/03/25 23:59:43
Is it safe to skip this? Looks like it might conf
clamy
2016/03/29 13:01:50
Since this could be problematic, I now only skip t
| |
| 4700 } | 4702 } |
| 4701 | 4703 |
| 4702 is_showing_before_unload_dialog_ = false; | 4704 is_showing_before_unload_dialog_ = false; |
| 4703 if (rfh) { | 4705 if (rfh) { |
| 4704 rfh->JavaScriptDialogClosed(reply_msg, success, user_input, | 4706 rfh->JavaScriptDialogClosed(reply_msg, success, user_input, |
| 4705 dialog_was_suppressed); | 4707 dialog_was_suppressed); |
| 4706 } else { | 4708 } else { |
| 4707 // Don't leak the sync IPC reply if the RFH or process is gone. | 4709 // Don't leak the sync IPC reply if the RFH or process is gone. |
| 4708 delete reply_msg; | 4710 delete reply_msg; |
| 4709 } | 4711 } |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4839 else | 4841 else |
| 4840 WasHidden(); | 4842 WasHidden(); |
| 4841 } | 4843 } |
| 4842 | 4844 |
| 4843 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 4845 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
| 4844 JavaScriptDialogManager* dialog_manager) { | 4846 JavaScriptDialogManager* dialog_manager) { |
| 4845 dialog_manager_ = dialog_manager; | 4847 dialog_manager_ = dialog_manager; |
| 4846 } | 4848 } |
| 4847 | 4849 |
| 4848 } // namespace content | 4850 } // namespace content |
| OLD | NEW |