| 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 return AppModalDialogManager()->RunBeforeUnloadDialog( | 239 return AppModalDialogManager()->RunBeforeUnloadDialog( |
| 240 web_contents, is_reload, | 240 web_contents, is_reload, |
| 241 base::Bind(&SaveUnloadUmaStats, engagement_score, callback)); | 241 base::Bind(&SaveUnloadUmaStats, engagement_score, callback)); |
| 242 } | 242 } |
| 243 | 243 |
| 244 bool JavaScriptDialogTabHelper::HandleJavaScriptDialog( | 244 bool JavaScriptDialogTabHelper::HandleJavaScriptDialog( |
| 245 content::WebContents* web_contents, | 245 content::WebContents* web_contents, |
| 246 bool accept, | 246 bool accept, |
| 247 const base::string16* prompt_override) { | 247 const base::string16* prompt_override) { |
| 248 if (dialog_) { | 248 if (dialog_) { |
| 249 CloseDialog(accept, prompt_override ? *prompt_override : base::string16(), | 249 CloseDialog(accept, |
| 250 prompt_override ? *prompt_override : dialog_->GetUserInput(), |
| 250 DismissalCause::HANDLE_DIALOG_CALLED); | 251 DismissalCause::HANDLE_DIALOG_CALLED); |
| 251 return true; | 252 return true; |
| 252 } | 253 } |
| 253 | 254 |
| 254 // Handle any app-modal dialogs being run by the app-modal dialog system. | 255 // Handle any app-modal dialogs being run by the app-modal dialog system. |
| 255 return AppModalDialogManager()->HandleJavaScriptDialog(web_contents, accept, | 256 return AppModalDialogManager()->HandleJavaScriptDialog(web_contents, accept, |
| 256 prompt_override); | 257 prompt_override); |
| 257 } | 258 } |
| 258 | 259 |
| 259 void JavaScriptDialogTabHelper::CancelDialogs( | 260 void JavaScriptDialogTabHelper::CancelDialogs( |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 dialog_callback_.Run(success, user_input); | 345 dialog_callback_.Run(success, user_input); |
| 345 | 346 |
| 346 ClearDialogInfo(); | 347 ClearDialogInfo(); |
| 347 } | 348 } |
| 348 | 349 |
| 349 void JavaScriptDialogTabHelper::ClearDialogInfo() { | 350 void JavaScriptDialogTabHelper::ClearDialogInfo() { |
| 350 dialog_.reset(); | 351 dialog_.reset(); |
| 351 dialog_callback_.Reset(); | 352 dialog_callback_.Reset(); |
| 352 BrowserList::RemoveObserver(this); | 353 BrowserList::RemoveObserver(this); |
| 353 } | 354 } |
| OLD | NEW |