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

Side by Side Diff: chrome/browser/app_modal_dialog.h

Issue 435010: Fix crash when an extension popup shows a JS alert. Showing the alert takes... (Closed)
Patch Set: Created 11 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/app_modal_dialog.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_APP_MODAL_DIALOG_H_ 5 #ifndef CHROME_BROWSER_APP_MODAL_DIALOG_H_
6 #define CHROME_BROWSER_APP_MODAL_DIALOG_H_ 6 #define CHROME_BROWSER_APP_MODAL_DIALOG_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "chrome/common/notification_observer.h" 11 #include "chrome/common/notification_observer.h"
12 #include "chrome/common/notification_registrar.h" 12 #include "chrome/common/notification_registrar.h"
13 13
14 #if defined(OS_WIN) 14 #if defined(OS_WIN)
15 class JavascriptMessageBoxDialog; 15 class JavascriptMessageBoxDialog;
16 typedef JavascriptMessageBoxDialog* NativeDialog; 16 typedef JavascriptMessageBoxDialog* NativeDialog;
17 #elif defined(OS_LINUX) 17 #elif defined(OS_LINUX)
18 typedef struct _GtkWidget GtkWidget; 18 typedef struct _GtkWidget GtkWidget;
19 typedef GtkWidget* NativeDialog; 19 typedef GtkWidget* NativeDialog;
20 #elif defined(OS_MACOSX) 20 #elif defined(OS_MACOSX)
21 typedef void* NativeDialog; 21 typedef void* NativeDialog;
22 #endif 22 #endif
23 23
24 class ExtensionHost;
24 class JavaScriptMessageBoxClient; 25 class JavaScriptMessageBoxClient;
25 class TabContents; 26 class TabContents;
26 namespace IPC { 27 namespace IPC {
27 class Message; 28 class Message;
28 } 29 }
29 30
30 // A controller+model class for javascript alert, confirm, prompt, and 31 // A controller+model class for javascript alert, confirm, prompt, and
31 // onbeforeunload dialog boxes. |NativeDialog| is a platform specific 32 // onbeforeunload dialog boxes. |NativeDialog| is a platform specific
32 // view. 33 // view.
33 class AppModalDialog : public NotificationObserver { 34 class AppModalDialog : public NotificationObserver {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 void CancelWindow(); 90 void CancelWindow();
90 91
91 private: 92 private:
92 void InitNotifications(); 93 void InitNotifications();
93 94
94 // NotificationObserver implementation. 95 // NotificationObserver implementation.
95 virtual void Observe(NotificationType type, 96 virtual void Observe(NotificationType type,
96 const NotificationSource& source, 97 const NotificationSource& source,
97 const NotificationDetails& details); 98 const NotificationDetails& details);
98 99
99 // Sends APP_MODAL_DIALOG_CLOSED notification. 100 // Cleans up after the dialog closes for any reason: sends close
100 void SendCloseNotification(); 101 // notification and re-enables input events.
102 void Cleanup();
101 103
102 NotificationRegistrar registrar_; 104 NotificationRegistrar registrar_;
103 105
104 // A reference to the platform native dialog box. 106 // A reference to the platform native dialog box.
105 NativeDialog dialog_; 107 NativeDialog dialog_;
106 108
107 // An implementation of the client interface to provide supporting methods 109 // An implementation of the client interface to provide supporting methods
108 // and receive results. 110 // and receive results.
109 JavaScriptMessageBoxClient* client_; 111 JavaScriptMessageBoxClient* client_;
110 112
113 // The client_ as an ExtensionHost, cached for use during notifications that
114 // may arrive after the client has entered its destructor (and is thus
115 // treated as a base JavaScriptMessageBoxClient). This will be NULL if the
116 // client is not an ExtensionHost.
117 TabContents* tab_contents_;
118 ExtensionHost* extension_host_;
119
111 // True if the dialog should no longer be shown, e.g. because the underlying 120 // True if the dialog should no longer be shown, e.g. because the underlying
112 // tab navigated away while the dialog was queued. 121 // tab navigated away while the dialog was queued.
113 bool skip_this_dialog_; 122 bool skip_this_dialog_;
114 123
115 // Information about the message box is held in the following variables. 124 // Information about the message box is held in the following variables.
116 std::wstring title_; 125 std::wstring title_;
117 int dialog_flags_; 126 int dialog_flags_;
118 std::wstring message_text_; 127 std::wstring message_text_;
119 std::wstring default_prompt_text_; 128 std::wstring default_prompt_text_;
120 bool display_suppress_checkbox_; 129 bool display_suppress_checkbox_;
121 bool is_before_unload_dialog_; 130 bool is_before_unload_dialog_;
122 IPC::Message* reply_msg_; 131 IPC::Message* reply_msg_;
123 }; 132 };
124 133
125 #endif // CHROME_BROWSER_APP_MODAL_DIALOG_H_ 134 #endif // CHROME_BROWSER_APP_MODAL_DIALOG_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/app_modal_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698