Index: chrome/browser/ui/app_modal_dialogs/javascript_app_modal_dialog.h |
diff --git a/chrome/browser/ui/app_modal_dialogs/javascript_app_modal_dialog.h b/chrome/browser/ui/app_modal_dialogs/javascript_app_modal_dialog.h |
index 38153fc9e5785f1c7ff69f7ad6c79f7ffb46f8df..f7038d993be4efa452dd2705c7d37879544f2517 100644 |
--- a/chrome/browser/ui/app_modal_dialogs/javascript_app_modal_dialog.h |
+++ b/chrome/browser/ui/app_modal_dialogs/javascript_app_modal_dialog.h |
@@ -12,6 +12,7 @@ |
#include "base/time/time.h" |
#include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" |
#include "content/public/browser/javascript_dialog_manager.h" |
+#include "content/public/browser/web_contents_observer.h" |
// Extra data for JavaScript dialogs to add Chrome-only features. |
class ChromeJavaScriptDialogExtraData { |
@@ -27,7 +28,9 @@ class ChromeJavaScriptDialogExtraData { |
// A controller + model class for JavaScript alert, confirm, prompt, and |
// onbeforeunload dialog boxes. |
-class JavaScriptAppModalDialog : public AppModalDialog { |
+class JavaScriptAppModalDialog |
+ : public AppModalDialog, |
+ public content::WebContentsObserver { |
public: |
typedef std::map<void*, ChromeJavaScriptDialogExtraData> ExtraDataMap; |
@@ -49,6 +52,10 @@ class JavaScriptAppModalDialog : public AppModalDialog { |
virtual bool IsJavaScriptModalDialog() OVERRIDE; |
virtual void Invalidate() OVERRIDE; |
+ // Overridden from content::WebContentsObserver: |
+ virtual void RenderViewDeleted( |
+ content::RenderViewHost* render_view_host) OVERRIDE; |
+ |
// Callbacks from NativeDialog when the user accepts or cancels the dialog. |
void OnCancel(bool suppress_js_messages); |
void OnAccept(const string16& prompt_text, bool suppress_js_messages); |
@@ -76,6 +83,9 @@ class JavaScriptAppModalDialog : public AppModalDialog { |
void NotifyDelegate(bool success, const string16& prompt_text, |
bool suppress_js_messages); |
+ // Which RenderViewHost requested the dialog and will run |callback_|. |
+ content::RenderViewHost* render_view_host_; |
+ |
// A map of extra Chrome-only data associated with the delegate_. |
// Can be inspected via extra_data_map_[web_contents_]. |
ExtraDataMap* extra_data_map_; |