| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 bool reset_state) override; | 57 bool reset_state) override; |
| 58 | 58 |
| 59 // WebContentsObserver: | 59 // WebContentsObserver: |
| 60 void WasHidden() override; | 60 void WasHidden() override; |
| 61 | 61 |
| 62 // BrowserListObserver: | 62 // BrowserListObserver: |
| 63 void OnBrowserSetLastActive(Browser* browser) override; | 63 void OnBrowserSetLastActive(Browser* browser) override; |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 friend class content::WebContentsUserData<JavaScriptDialogTabHelper>; | 66 friend class content::WebContentsUserData<JavaScriptDialogTabHelper>; |
| 67 enum class DismissalCause; |
| 68 |
| 69 void LogDialogDismissalCause(DismissalCause cause); |
| 67 | 70 |
| 68 // Wrapper around a DialogClosedCallback so that we can intercept it before | 71 // Wrapper around a DialogClosedCallback so that we can intercept it before |
| 69 // passing it onto the original callback. | 72 // passing it onto the original callback. |
| 70 void OnDialogClosed(DialogClosedCallback callback, | 73 void OnDialogClosed(DialogClosedCallback callback, |
| 71 bool success, | 74 bool success, |
| 72 const base::string16& user_input); | 75 const base::string16& user_input); |
| 73 | 76 |
| 74 void CloseDialog(bool suppress_callback, | 77 void CloseDialog(bool suppress_callback, |
| 75 bool success, | 78 bool success, |
| 76 const base::string16& user_input); | 79 const base::string16& user_input, |
| 80 DismissalCause cause); |
| 77 | 81 |
| 78 void ClearDialogInfo(); | 82 void ClearDialogInfo(); |
| 79 | 83 |
| 80 // The dialog being displayed on the observed WebContents. | 84 // The dialog being displayed on the observed WebContents. |
| 81 base::WeakPtr<JavaScriptDialog> dialog_; | 85 base::WeakPtr<JavaScriptDialog> dialog_; |
| 82 | 86 |
| 87 // The type of dialog being displayed. Only valid when |dialog_| is non-null. |
| 88 content::JavaScriptMessageType message_type_ = |
| 89 content::JavaScriptMessageType::JAVASCRIPT_MESSAGE_TYPE_ALERT; |
| 90 |
| 83 // The callback provided for when the dialog is closed. Usually the dialog | 91 // The callback provided for when the dialog is closed. Usually the dialog |
| 84 // itself calls it, but in the cases where the dialog is closed not by the | 92 // itself calls it, but in the cases where the dialog is closed not by the |
| 85 // user's input but by a call to |CloseDialog|, this class will call it. | 93 // user's input but by a call to |CloseDialog|, this class will call it. |
| 86 content::JavaScriptDialogManager::DialogClosedCallback dialog_callback_; | 94 content::JavaScriptDialogManager::DialogClosedCallback dialog_callback_; |
| 87 | 95 |
| 88 base::Closure dialog_shown_; | 96 base::Closure dialog_shown_; |
| 89 | 97 |
| 90 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogTabHelper); | 98 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogTabHelper); |
| 91 }; | 99 }; |
| 92 | 100 |
| 93 #endif // CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_ | 101 #endif // CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_ |
| OLD | NEW |