| 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 #import "ios/web/navigation/crw_session_controller.h" | 9 #import "ios/web/navigation/crw_session_controller.h" |
| 10 #import "ios/web/navigation/navigation_manager_impl.h" | 10 #import "ios/web/navigation/navigation_manager_impl.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 NavigationManager* nav_manager = GetWebStateImpl()->GetNavigationManager(); | 86 NavigationManager* nav_manager = GetWebStateImpl()->GetNavigationManager(); |
| 87 nav_manager->DiscardNonCommittedItems(); | 87 nav_manager->DiscardNonCommittedItems(); |
| 88 | 88 |
| 89 Hide(); | 89 Hide(); |
| 90 | 90 |
| 91 GetDelegate()->OnDontProceed(); | 91 GetDelegate()->OnDontProceed(); |
| 92 | 92 |
| 93 // Reload last committed entry. | 93 NSUserDefaults* user_defaults = [NSUserDefaults standardUserDefaults]; |
| 94 nav_manager->Reload(true /* check_for_repost */); | 94 if (![user_defaults boolForKey:@"PendingIndexNavigationDisabled"]) { |
| 95 // Reload last committed entry. |
| 96 nav_manager->Reload(true /* check_for_repost */); |
| 97 } |
| 95 | 98 |
| 96 delete this; | 99 delete this; |
| 97 } | 100 } |
| 98 | 101 |
| 99 void WebInterstitialImpl::Proceed() { | 102 void WebInterstitialImpl::Proceed() { |
| 100 // Proceed() and DontProceed() are not re-entrant, as they delete |this|. | 103 // Proceed() and DontProceed() are not re-entrant, as they delete |this|. |
| 101 if (action_taken_) | 104 if (action_taken_) |
| 102 return; | 105 return; |
| 103 action_taken_ = true; | 106 action_taken_ = true; |
| 104 Hide(); | 107 Hide(); |
| 105 GetDelegate()->OnProceed(); | 108 GetDelegate()->OnProceed(); |
| 106 delete this; | 109 delete this; |
| 107 } | 110 } |
| 108 | 111 |
| 109 void WebInterstitialImpl::WebStateDestroyed() { | 112 void WebInterstitialImpl::WebStateDestroyed() { |
| 110 DontProceed(); | 113 DontProceed(); |
| 111 } | 114 } |
| 112 | 115 |
| 113 WebStateImpl* WebInterstitialImpl::GetWebStateImpl() const { | 116 WebStateImpl* WebInterstitialImpl::GetWebStateImpl() const { |
| 114 return static_cast<web::WebStateImpl*>(web_state()); | 117 return static_cast<web::WebStateImpl*>(web_state()); |
| 115 } | 118 } |
| 116 | 119 |
| 117 } // namespace web | 120 } // namespace web |
| OLD | NEW |