| 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.h" | 5 #include "chrome/browser/ui/javascript_dialogs/javascript_dialog.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/blocked_content/app_modal_dialog_helper.h" | 7 #include "chrome/browser/ui/blocked_content/app_modal_dialog_helper.h" |
| 8 #include "chrome/browser/ui/javascript_dialogs/javascript_dialog_views.h" | 8 #include "chrome/browser/ui/javascript_dialogs/javascript_dialog_views.h" |
| 9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 10 #include "content/public/browser/web_contents_delegate.h" | 10 #include "content/public/browser/web_contents_delegate.h" |
| 11 | 11 |
| 12 JavaScriptDialog::JavaScriptDialog(content::WebContents* parent_web_contents) { | 12 JavaScriptDialog::JavaScriptDialog(content::WebContents* parent_web_contents) { |
| 13 dialog_helper_.reset(new AppModalDialogHelper(parent_web_contents)); | 13 dialog_helper_.reset(new AppModalDialogHelper(parent_web_contents)); |
| 14 parent_web_contents->GetDelegate()->ActivateContents(parent_web_contents); | 14 parent_web_contents->GetDelegate()->ActivateContents(parent_web_contents); |
| 15 } | 15 } |
| 16 | 16 |
| 17 JavaScriptDialog::~JavaScriptDialog() = default; | 17 JavaScriptDialog::~JavaScriptDialog() = default; |
| 18 | 18 |
| 19 base::WeakPtr<JavaScriptDialog> JavaScriptDialog::Create( | 19 base::WeakPtr<JavaScriptDialog> JavaScriptDialog::Create( |
| 20 content::WebContents* parent_web_contents, | 20 content::WebContents* parent_web_contents, |
| 21 content::WebContents* alerting_web_contents, | 21 content::WebContents* alerting_web_contents, |
| 22 const base::string16& title, | 22 const base::string16& title, |
| 23 content::JavaScriptMessageType message_type, | 23 content::JavaScriptDialogType dialog_type, |
| 24 const base::string16& message_text, | 24 const base::string16& message_text, |
| 25 const base::string16& default_prompt_text, | 25 const base::string16& default_prompt_text, |
| 26 const content::JavaScriptDialogManager::DialogClosedCallback& | 26 const content::JavaScriptDialogManager::DialogClosedCallback& |
| 27 dialog_callback) { | 27 dialog_callback) { |
| 28 return JavaScriptDialogViews::Create( | 28 return JavaScriptDialogViews::Create( |
| 29 parent_web_contents, alerting_web_contents, title, message_type, | 29 parent_web_contents, alerting_web_contents, title, dialog_type, |
| 30 message_text, default_prompt_text, dialog_callback); | 30 message_text, default_prompt_text, dialog_callback); |
| 31 } | 31 } |
| OLD | NEW |