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_H_ | 5 #ifndef CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_H_ |
6 #define CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_H_ | 6 #define CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
9 #include "content/public/browser/javascript_dialog_manager.h" | 11 #include "content/public/browser/javascript_dialog_manager.h" |
10 | 12 |
| 13 class AppModalDialogHelper; |
| 14 |
11 class JavaScriptDialog { | 15 class JavaScriptDialog { |
12 public: | 16 public: |
13 virtual ~JavaScriptDialog(); | 17 virtual ~JavaScriptDialog(); |
14 | 18 |
15 static base::WeakPtr<JavaScriptDialog> Create( | 19 static base::WeakPtr<JavaScriptDialog> Create( |
16 content::WebContents* parent_web_contents, | 20 content::WebContents* parent_web_contents, |
17 content::WebContents* alerting_web_contents, | 21 content::WebContents* alerting_web_contents, |
18 const base::string16& title, | 22 const base::string16& title, |
19 content::JavaScriptMessageType message_type, | 23 content::JavaScriptMessageType message_type, |
20 const base::string16& message_text, | 24 const base::string16& message_text, |
21 const base::string16& default_prompt_text, | 25 const base::string16& default_prompt_text, |
22 const content::JavaScriptDialogManager::DialogClosedCallback& | 26 const content::JavaScriptDialogManager::DialogClosedCallback& |
23 dialog_callback); | 27 dialog_callback); |
24 | 28 |
25 // Closes the dialog without sending a callback. This is useful when the | 29 // Closes the dialog without sending a callback. This is useful when the |
26 // JavaScriptDialogTabHelper needs to make this dialog go away so that it can | 30 // JavaScriptDialogTabHelper needs to make this dialog go away so that it can |
27 // respond to a call that requires it to make no callback or make a customized | 31 // respond to a call that requires it to make no callback or make a customized |
28 // one. | 32 // one. |
29 virtual void CloseDialogWithoutCallback() = 0; | 33 virtual void CloseDialogWithoutCallback() = 0; |
| 34 |
| 35 protected: |
| 36 explicit JavaScriptDialog(content::WebContents* parent_web_contents); |
| 37 |
| 38 private: |
| 39 std::unique_ptr<AppModalDialogHelper> dialog_helper_; |
30 }; | 40 }; |
31 | 41 |
32 #endif // CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_H_ | 42 #endif // CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_H_ |
OLD | NEW |