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