OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #import "ios/web/interstitials/web_interstitial_impl.h" | 5 #import "ios/web/interstitials/web_interstitial_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ios/web/interstitials/web_interstitial_facade_delegate.h" | 8 #include "ios/web/interstitials/web_interstitial_facade_delegate.h" |
9 #include "ios/web/navigation/crw_session_controller.h" | 9 #include "ios/web/navigation/crw_session_controller.h" |
10 #include "ios/web/navigation/navigation_manager_impl.h" | 10 #include "ios/web/navigation/navigation_manager_impl.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 76 } |
77 | 77 |
78 void WebInterstitialImpl::DontProceed() { | 78 void WebInterstitialImpl::DontProceed() { |
79 // Proceed() and DontProceed() are not re-entrant, as they delete |this|. | 79 // Proceed() and DontProceed() are not re-entrant, as they delete |this|. |
80 if (action_taken_) | 80 if (action_taken_) |
81 return; | 81 return; |
82 action_taken_ = true; | 82 action_taken_ = true; |
83 | 83 |
84 // Clear the pending entry, since that's the page that's not being | 84 // Clear the pending entry, since that's the page that's not being |
85 // proceeded to. | 85 // proceeded to. |
86 GetWebStateImpl()->GetNavigationManager()->DiscardNonCommittedItems(); | 86 NavigationManager* nav_manager = GetWebStateImpl()->GetNavigationManager(); |
| 87 nav_manager->DiscardNonCommittedItems(); |
87 | 88 |
88 Hide(); | 89 Hide(); |
89 | 90 |
90 GetDelegate()->OnDontProceed(); | 91 GetDelegate()->OnDontProceed(); |
| 92 |
| 93 // Reload last committed entry. |
| 94 nav_manager->Reload(true /* check_for_repost */); |
| 95 |
91 delete this; | 96 delete this; |
92 } | 97 } |
93 | 98 |
94 void WebInterstitialImpl::Proceed() { | 99 void WebInterstitialImpl::Proceed() { |
95 // Proceed() and DontProceed() are not re-entrant, as they delete |this|. | 100 // Proceed() and DontProceed() are not re-entrant, as they delete |this|. |
96 if (action_taken_) | 101 if (action_taken_) |
97 return; | 102 return; |
98 action_taken_ = true; | 103 action_taken_ = true; |
99 Hide(); | 104 Hide(); |
100 GetDelegate()->OnProceed(); | 105 GetDelegate()->OnProceed(); |
101 delete this; | 106 delete this; |
102 } | 107 } |
103 | 108 |
104 void WebInterstitialImpl::WebStateDestroyed() { | 109 void WebInterstitialImpl::WebStateDestroyed() { |
105 DontProceed(); | 110 DontProceed(); |
106 } | 111 } |
107 | 112 |
108 WebStateImpl* WebInterstitialImpl::GetWebStateImpl() const { | 113 WebStateImpl* WebInterstitialImpl::GetWebStateImpl() const { |
109 return static_cast<web::WebStateImpl*>(web_state()); | 114 return static_cast<web::WebStateImpl*>(web_state()); |
110 } | 115 } |
111 | 116 |
112 } // namespace web | 117 } // namespace web |
OLD | NEW |