| 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_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_ |
| 6 #define CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 public content::WebContentsUserData<JavaScriptDialogTabHelper> { | 34 public content::WebContentsUserData<JavaScriptDialogTabHelper> { |
| 35 public: | 35 public: |
| 36 explicit JavaScriptDialogTabHelper(content::WebContents* web_contents); | 36 explicit JavaScriptDialogTabHelper(content::WebContents* web_contents); |
| 37 ~JavaScriptDialogTabHelper() override; | 37 ~JavaScriptDialogTabHelper() override; |
| 38 | 38 |
| 39 void SetDialogShownCallbackForTesting(base::Closure callback); | 39 void SetDialogShownCallbackForTesting(base::Closure callback); |
| 40 | 40 |
| 41 // JavaScriptDialogManager: | 41 // JavaScriptDialogManager: |
| 42 void RunJavaScriptDialog(content::WebContents* web_contents, | 42 void RunJavaScriptDialog(content::WebContents* web_contents, |
| 43 const GURL& origin_url, | 43 const GURL& origin_url, |
| 44 content::JavaScriptMessageType message_type, | 44 content::JavaScriptDialogType dialog_type, |
| 45 const base::string16& message_text, | 45 const base::string16& message_text, |
| 46 const base::string16& default_prompt_text, | 46 const base::string16& default_prompt_text, |
| 47 const DialogClosedCallback& callback, | 47 const DialogClosedCallback& callback, |
| 48 bool* did_suppress_message) override; | 48 bool* did_suppress_message) override; |
| 49 void RunBeforeUnloadDialog(content::WebContents* web_contents, | 49 void RunBeforeUnloadDialog(content::WebContents* web_contents, |
| 50 bool is_reload, | 50 bool is_reload, |
| 51 const DialogClosedCallback& callback) override; | 51 const DialogClosedCallback& callback) override; |
| 52 bool HandleJavaScriptDialog(content::WebContents* web_contents, | 52 bool HandleJavaScriptDialog(content::WebContents* web_contents, |
| 53 bool accept, | 53 bool accept, |
| 54 const base::string16* prompt_override) override; | 54 const base::string16* prompt_override) override; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 81 void CloseDialog(bool success, | 81 void CloseDialog(bool success, |
| 82 const base::string16& user_input, | 82 const base::string16& user_input, |
| 83 DismissalCause cause); | 83 DismissalCause cause); |
| 84 | 84 |
| 85 void ClearDialogInfo(); | 85 void ClearDialogInfo(); |
| 86 | 86 |
| 87 // The dialog being displayed on the observed WebContents. | 87 // The dialog being displayed on the observed WebContents. |
| 88 base::WeakPtr<JavaScriptDialog> dialog_; | 88 base::WeakPtr<JavaScriptDialog> dialog_; |
| 89 | 89 |
| 90 // The type of dialog being displayed. Only valid when |dialog_| is non-null. | 90 // The type of dialog being displayed. Only valid when |dialog_| is non-null. |
| 91 content::JavaScriptMessageType message_type_ = | 91 content::JavaScriptDialogType dialog_type_ = |
| 92 content::JavaScriptMessageType::JAVASCRIPT_MESSAGE_TYPE_ALERT; | 92 content::JavaScriptDialogType::JAVASCRIPT_DIALOG_TYPE_ALERT; |
| 93 | 93 |
| 94 // The callback provided for when the dialog is closed. Usually the dialog | 94 // The callback provided for when the dialog is closed. Usually the dialog |
| 95 // itself calls it, but in the cases where the dialog is closed not by the | 95 // itself calls it, but in the cases where the dialog is closed not by the |
| 96 // user's input but by a call to |CloseDialog|, this class will call it. | 96 // user's input but by a call to |CloseDialog|, this class will call it. |
| 97 content::JavaScriptDialogManager::DialogClosedCallback dialog_callback_; | 97 content::JavaScriptDialogManager::DialogClosedCallback dialog_callback_; |
| 98 | 98 |
| 99 base::Closure dialog_shown_; | 99 base::Closure dialog_shown_; |
| 100 | 100 |
| 101 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogTabHelper); | 101 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogTabHelper); |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 #endif // CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_ | 104 #endif // CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_ |
| OLD | NEW |