OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_COCOA_H_ |
| 6 #define CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_COCOA_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "chrome/browser/ui/javascript_dialogs/javascript_dialog.h" |
| 12 #include "content/public/browser/javascript_dialog_manager.h" |
| 13 |
| 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 |
| 16 // are browser tabs. |
| 17 class JavaScriptDialogCocoa : public JavaScriptDialog { |
| 18 public: |
| 19 class JavaScriptDialogCocoaImpl; |
| 20 |
| 21 ~JavaScriptDialogCocoa() override; |
| 22 |
| 23 static base::WeakPtr<JavaScriptDialogCocoa> Create( |
| 24 content::WebContents* parent_web_contents, |
| 25 content::WebContents* alerting_web_contents, |
| 26 const base::string16& title, |
| 27 content::JavaScriptMessageType message_type, |
| 28 const base::string16& message_text, |
| 29 const base::string16& default_prompt_text, |
| 30 const content::JavaScriptDialogManager::DialogClosedCallback& |
| 31 dialog_callback); |
| 32 |
| 33 // JavaScriptDialog: |
| 34 void CloseDialogWithoutCallback() override; |
| 35 |
| 36 private: |
| 37 JavaScriptDialogCocoa( |
| 38 content::WebContents* parent_web_contents, |
| 39 content::WebContents* alerting_web_contents, |
| 40 const base::string16& title, |
| 41 content::JavaScriptMessageType message_type, |
| 42 const base::string16& message_text, |
| 43 const base::string16& default_prompt_text, |
| 44 const content::JavaScriptDialogManager::DialogClosedCallback& |
| 45 dialog_callback); |
| 46 |
| 47 std::unique_ptr<JavaScriptDialogCocoaImpl> impl_; |
| 48 |
| 49 base::WeakPtrFactory<JavaScriptDialogCocoa> weak_factory_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogCocoa); |
| 52 }; |
| 53 |
| 54 #endif // CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_COCOA_H_ |
OLD | NEW |