| 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 #ifndef CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_COCOA_H_ | 5 #ifndef CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_COCOA_H_ |
| 6 #define CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_COCOA_H_ | 6 #define CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_COCOA_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "chrome/browser/ui/javascript_dialogs/javascript_dialog.h" | 11 #include "chrome/browser/ui/javascript_dialogs/javascript_dialog.h" |
| 12 #include "content/public/browser/javascript_dialog_manager.h" | 12 #include "content/public/browser/javascript_dialog_manager.h" |
| 13 | 13 |
| 14 // A Cocoa version of a JavaScript dialog that automatically dismisses itself | 14 // A Cocoa version of a JavaScript dialog that automatically dismisses itself |
| 15 // when the user switches away to a different tab, used for WebContentses that | 15 // when the user switches away to a different tab, used for WebContentses that |
| 16 // are browser tabs. | 16 // are browser tabs. |
| 17 class JavaScriptDialogCocoa : public JavaScriptDialog { | 17 class JavaScriptDialogCocoa : public JavaScriptDialog { |
| 18 public: | 18 public: |
| 19 class JavaScriptDialogCocoaImpl; | 19 class JavaScriptDialogCocoaImpl; |
| 20 | 20 |
| 21 ~JavaScriptDialogCocoa() override; | 21 ~JavaScriptDialogCocoa() override; |
| 22 | 22 |
| 23 static base::WeakPtr<JavaScriptDialogCocoa> Create( | 23 static base::WeakPtr<JavaScriptDialogCocoa> Create( |
| 24 content::WebContents* parent_web_contents, | 24 content::WebContents* parent_web_contents, |
| 25 content::WebContents* alerting_web_contents, | 25 content::WebContents* alerting_web_contents, |
| 26 const base::string16& title, | 26 const base::string16& title, |
| 27 content::JavaScriptMessageType message_type, | 27 content::JavaScriptDialogType dialog_type, |
| 28 const base::string16& message_text, | 28 const base::string16& message_text, |
| 29 const base::string16& default_prompt_text, | 29 const base::string16& default_prompt_text, |
| 30 const content::JavaScriptDialogManager::DialogClosedCallback& | 30 const content::JavaScriptDialogManager::DialogClosedCallback& |
| 31 dialog_callback); | 31 dialog_callback); |
| 32 | 32 |
| 33 // JavaScriptDialog: | 33 // JavaScriptDialog: |
| 34 void CloseDialogWithoutCallback() override; | 34 void CloseDialogWithoutCallback() override; |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 JavaScriptDialogCocoa( | 37 JavaScriptDialogCocoa( |
| 38 content::WebContents* parent_web_contents, | 38 content::WebContents* parent_web_contents, |
| 39 content::WebContents* alerting_web_contents, | 39 content::WebContents* alerting_web_contents, |
| 40 const base::string16& title, | 40 const base::string16& title, |
| 41 content::JavaScriptMessageType message_type, | 41 content::JavaScriptDialogType dialog_type, |
| 42 const base::string16& message_text, | 42 const base::string16& message_text, |
| 43 const base::string16& default_prompt_text, | 43 const base::string16& default_prompt_text, |
| 44 const content::JavaScriptDialogManager::DialogClosedCallback& | 44 const content::JavaScriptDialogManager::DialogClosedCallback& |
| 45 dialog_callback); | 45 dialog_callback); |
| 46 | 46 |
| 47 std::unique_ptr<JavaScriptDialogCocoaImpl> impl_; | 47 std::unique_ptr<JavaScriptDialogCocoaImpl> impl_; |
| 48 | 48 |
| 49 base::WeakPtrFactory<JavaScriptDialogCocoa> weak_factory_; | 49 base::WeakPtrFactory<JavaScriptDialogCocoa> weak_factory_; |
| 50 | 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogCocoa); | 51 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogCocoa); |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 #endif // CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_COCOA_H_ | 54 #endif // CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_COCOA_H_ |
| OLD | NEW |