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

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

Issue 2179923002: Add a JavaScript dialog tab helper. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 4 years, 3 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
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
new file mode 100644
index 0000000000000000000000000000000000000000..24a5e10140344864ef30899db4585b8985c6d7d3
--- /dev/null
+++ b/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h
@@ -0,0 +1,46 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_
+#define CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_
+
+#include "base/macros.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 JavaScriptDialogTabHelper
+ : public content::WebContentsObserver,
+ public content::JavaScriptDialogManager,
+ public content::WebContentsUserData<JavaScriptDialogTabHelper> {
+ public:
+ explicit JavaScriptDialogTabHelper(content::WebContents* web_contents);
+ ~JavaScriptDialogTabHelper() override;
+
+ // JavaScriptDialogManager:
+ void RunJavaScriptDialog(content::WebContents* web_contents,
+ const GURL& origin_url,
+ content::JavaScriptMessageType message_type,
+ const base::string16& message_text,
+ const base::string16& default_prompt_text,
+ const DialogClosedCallback& callback,
+ bool* did_suppress_message) override;
+ void RunBeforeUnloadDialog(content::WebContents* web_contents,
+ bool is_reload,
+ const DialogClosedCallback& callback) override;
+ bool HandleJavaScriptDialog(content::WebContents* web_contents,
+ bool accept,
+ const base::string16* prompt_override) override;
+ void CancelActiveAndPendingDialogs(
+ content::WebContents* web_contents) override;
+ void ResetDialogState(content::WebContents* web_contents) override;
+ void WebContentsDestroyed() override;
+
+ private:
+ friend class content::WebContentsUserData<JavaScriptDialogTabHelper>;
+
+ DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogTabHelper);
+};
+
+#endif // CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698