| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h" | 5 #include "chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/feature_list.h" | 9 #include "base/feature_list.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 return true; | 235 return true; |
| 236 } | 236 } |
| 237 | 237 |
| 238 // Handle any app-modal dialogs being run by the app-modal dialog system. | 238 // Handle any app-modal dialogs being run by the app-modal dialog system. |
| 239 return AppModalDialogManager()->HandleJavaScriptDialog(web_contents, accept, | 239 return AppModalDialogManager()->HandleJavaScriptDialog(web_contents, accept, |
| 240 prompt_override); | 240 prompt_override); |
| 241 } | 241 } |
| 242 | 242 |
| 243 void JavaScriptDialogTabHelper::CancelDialogs( | 243 void JavaScriptDialogTabHelper::CancelDialogs( |
| 244 content::WebContents* web_contents, | 244 content::WebContents* web_contents, |
| 245 bool suppress_callbacks, | |
| 246 bool reset_state) { | 245 bool reset_state) { |
| 247 if (dialog_) { | 246 if (dialog_) { |
| 248 CloseDialog(false, base::string16(), DismissalCause::CANCEL_DIALOGS_CALLED); | 247 CloseDialog(false, base::string16(), DismissalCause::CANCEL_DIALOGS_CALLED); |
| 249 } | 248 } |
| 250 | 249 |
| 251 // Cancel any app-modal dialogs being run by the app-modal dialog system. | 250 // Cancel any app-modal dialogs being run by the app-modal dialog system. |
| 252 return AppModalDialogManager()->CancelDialogs( | 251 return AppModalDialogManager()->CancelDialogs(web_contents, reset_state); |
| 253 web_contents, suppress_callbacks, reset_state); | |
| 254 } | 252 } |
| 255 | 253 |
| 256 void JavaScriptDialogTabHelper::WasHidden() { | 254 void JavaScriptDialogTabHelper::WasHidden() { |
| 257 if (dialog_) | 255 if (dialog_) |
| 258 CloseDialog(false, base::string16(), DismissalCause::TAB_HIDDEN); | 256 CloseDialog(false, base::string16(), DismissalCause::TAB_HIDDEN); |
| 259 } | 257 } |
| 260 | 258 |
| 261 // This function handles the case where browser-side navigation (PlzNavigate) is | 259 // This function handles the case where browser-side navigation (PlzNavigate) is |
| 262 // enabled. DidStartNavigationToPendingEntry, below, handles the case where | 260 // enabled. DidStartNavigationToPendingEntry, below, handles the case where |
| 263 // PlzNavigate is not enabled. TODO(avi): When the non-PlzNavigate code is | 261 // PlzNavigate is not enabled. TODO(avi): When the non-PlzNavigate code is |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 dialog_callback_.Run(success, user_input); | 328 dialog_callback_.Run(success, user_input); |
| 331 | 329 |
| 332 ClearDialogInfo(); | 330 ClearDialogInfo(); |
| 333 } | 331 } |
| 334 | 332 |
| 335 void JavaScriptDialogTabHelper::ClearDialogInfo() { | 333 void JavaScriptDialogTabHelper::ClearDialogInfo() { |
| 336 dialog_.reset(); | 334 dialog_.reset(); |
| 337 dialog_callback_.Reset(); | 335 dialog_callback_.Reset(); |
| 338 BrowserList::RemoveObserver(this); | 336 BrowserList::RemoveObserver(this); |
| 339 } | 337 } |
| OLD | NEW |