Chromium Code Reviews| Index: chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h |
| diff --git a/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h b/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h |
| index 4a75f5bf94b4255cfe471d4263f7c1ec2d95d3ba..c652682a04205fe1e68ccb275a482a45ff27489e 100644 |
| --- a/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h |
| +++ b/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h |
| @@ -5,14 +5,23 @@ |
| #ifndef CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_ |
| #define CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_ |
| +#include <memory> |
| + |
| #include "base/macros.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "chrome/browser/ui/browser_list_observer.h" |
| #include "content/public/browser/javascript_dialog_manager.h" |
| #include "content/public/browser/web_contents_observer.h" |
| #include "content/public/browser/web_contents_user_data.h" |
| +class JavaScriptDialogViews; |
| + |
| +// A class, attached to WebContentses in browser windows, that is the |
| +// JavaScriptDialogManager for them and handles displaying their dialogs. |
|
Peter Kasting
2016/10/18 04:31:03
Nit: Might be nice to expand this some to talk abo
Avi (use Gerrit)
2016/10/18 16:31:49
Done.
|
| class JavaScriptDialogTabHelper |
| - : public content::WebContentsObserver, |
| - public content::JavaScriptDialogManager, |
| + : public content::JavaScriptDialogManager, |
| + public content::WebContentsObserver, |
| + public chrome::BrowserListObserver, |
| public content::WebContentsUserData<JavaScriptDialogTabHelper> { |
| public: |
| explicit JavaScriptDialogTabHelper(content::WebContents* web_contents); |
| @@ -35,11 +44,28 @@ class JavaScriptDialogTabHelper |
| void CancelDialogs(content::WebContents* web_contents, |
| bool suppress_callbacks, |
| bool reset_state) override; |
| - void WebContentsDestroyed() override; |
| + |
| + // WebContentsObserver: |
| + void WasHidden() override; |
| + |
| + // BrowserListObserver: |
| + void OnBrowserSetLastActive(Browser* browser) override; |
| private: |
| friend class content::WebContentsUserData<JavaScriptDialogTabHelper>; |
| + void CloseDialog(bool suppress_callback, |
| + bool success, |
| + const base::string16& user_input); |
| + |
| + // The dialog being displayed on the observed WebContents. |
| + base::WeakPtr<JavaScriptDialogViews> dialog_; |
| + |
| + // The callback provided for when the dialog is closed. Usually the dialog |
| + // itself calls it, but in the cases where the dialog is closed not by the |
| + // user's input but by a call to |CloseDialog()|, this class will call it. |
|
Peter Kasting
2016/10/18 04:31:03
Nit: No || on function names (the () is the marker
Avi (use Gerrit)
2016/10/18 16:31:49
Done.
Peter Kasting
2016/10/18 16:59:55
Oh, I was suggesting removing the || rather than r
|
| + content::JavaScriptDialogManager::DialogClosedCallback dialog_callback_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogTabHelper); |
| }; |