Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Unified Diff: chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h

Issue 2421943002: Make JavaScript dialogs auto-dismiss on tab switch. (Closed)
Patch Set: fix Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..5a00f203c983ecc50ebe5fd9c266bbce20f3a0ae 100644
--- a/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h
+++ b/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h
@@ -5,13 +5,20 @@
#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;
+
class JavaScriptDialogTabHelper
Peter Kasting 2016/10/17 20:16:05 Nit: While here: Would be nice to have an overview
Avi (use Gerrit) 2016/10/18 02:46:41 Done.
: public content::WebContentsObserver,
+ public chrome::BrowserListObserver,
public content::JavaScriptDialogManager,
public content::WebContentsUserData<JavaScriptDialogTabHelper> {
public:
@@ -35,11 +42,27 @@ class JavaScriptDialogTabHelper
void CancelDialogs(content::WebContents* web_contents,
bool suppress_callbacks,
bool reset_state) override;
- void WebContentsDestroyed() override;
+
+ // WebContentsObserver:
Peter Kasting 2016/10/17 20:16:04 Nit: Keep blocks of overrides and superclass list
Avi (use Gerrit) 2016/10/18 02:46:41 Done.
+ 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 this class will do in some cases.
Peter Kasting 2016/10/17 20:16:05 Nit: "will do it" or "will do so". Would be nice
Avi (use Gerrit) 2016/10/18 02:46:41 Done.
+ content::JavaScriptDialogManager::DialogClosedCallback dialog_callback_;
+
DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogTabHelper);
};

Powered by Google App Engine
This is Rietveld 408576698