| 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 "build/build_config.h" | |
| 8 #include "chrome/browser/ui/javascript_dialogs/javascript_dialog_views.h" | 7 #include "chrome/browser/ui/javascript_dialogs/javascript_dialog_views.h" |
| 9 | 8 |
| 10 #if defined(OS_MACOSX) | |
| 11 #include "chrome/browser/ui/browser_dialogs.h" | |
| 12 #include "chrome/browser/ui/javascript_dialogs/javascript_dialog_cocoa.h" | |
| 13 #endif | |
| 14 | |
| 15 JavaScriptDialog::~JavaScriptDialog() = default; | 9 JavaScriptDialog::~JavaScriptDialog() = default; |
| 16 | 10 |
| 17 base::WeakPtr<JavaScriptDialog> JavaScriptDialog::Create( | 11 base::WeakPtr<JavaScriptDialog> JavaScriptDialog::Create( |
| 18 content::WebContents* parent_web_contents, | 12 content::WebContents* parent_web_contents, |
| 19 content::WebContents* alerting_web_contents, | 13 content::WebContents* alerting_web_contents, |
| 20 const base::string16& title, | 14 const base::string16& title, |
| 21 content::JavaScriptMessageType message_type, | 15 content::JavaScriptMessageType message_type, |
| 22 const base::string16& message_text, | 16 const base::string16& message_text, |
| 23 const base::string16& default_prompt_text, | 17 const base::string16& default_prompt_text, |
| 24 const content::JavaScriptDialogManager::DialogClosedCallback& | 18 const content::JavaScriptDialogManager::DialogClosedCallback& |
| 25 dialog_callback) { | 19 dialog_callback) { |
| 26 #if defined(OS_MACOSX) | 20 return JavaScriptDialogViews::Create( |
| 27 if (chrome::ToolkitViewsWebUIDialogsEnabled()) { | 21 parent_web_contents, alerting_web_contents, title, message_type, |
| 28 #endif | 22 message_text, default_prompt_text, dialog_callback); |
| 29 return JavaScriptDialogViews::Create( | |
| 30 parent_web_contents, alerting_web_contents, title, message_type, | |
| 31 message_text, default_prompt_text, dialog_callback); | |
| 32 #if defined(OS_MACOSX) | |
| 33 } else { | |
| 34 return JavaScriptDialogCocoa::Create( | |
| 35 parent_web_contents, alerting_web_contents, title, message_type, | |
| 36 message_text, default_prompt_text, dialog_callback); | |
| 37 } | |
| 38 #endif | |
| 39 } | 23 } |
| OLD | NEW |