summaryrefslogtreecommitdiffstats
path: root/chrome/browser/app_modal_dialog.h
diff options
context:
space:
mode:
authorpam@chromium.org <pam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-06 04:08:54 +0000
committerpam@chromium.org <pam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-06 04:08:54 +0000
commitbeb440cea06ba40683a755d14dd5dbf9d11baadf (patch)
tree79b805ed76621b38c5682033a3fbab9dc0a6f8a8 /chrome/browser/app_modal_dialog.h
parentda3b971ec3cababd149b5cd6a7a9d021bfdd96b4 (diff)
downloadchromium_src-beb440cea06ba40683a755d14dd5dbf9d11baadf.zip
chromium_src-beb440cea06ba40683a755d14dd5dbf9d11baadf.tar.gz
chromium_src-beb440cea06ba40683a755d14dd5dbf9d11baadf.tar.bz2
Implement window.alert() and its cousins for extensions.
Second try, now with fixed observer. BUG=12126 TEST=put a window.prompt() in a background page, a browser action, and a page action. Make sure it gets the result back correctly. Also make sure it still works when called from a web page. Review URL: http://codereview.chromium.org/373006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31204 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/app_modal_dialog.h')
-rw-r--r--chrome/browser/app_modal_dialog.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/chrome/browser/app_modal_dialog.h b/chrome/browser/app_modal_dialog.h
index 8d44d64..e071871 100644
--- a/chrome/browser/app_modal_dialog.h
+++ b/chrome/browser/app_modal_dialog.h
@@ -21,6 +21,7 @@ typedef GtkWidget* NativeDialog;
typedef void* NativeDialog;
#endif
+class JavaScriptMessageBoxClient;
class TabContents;
namespace IPC {
class Message;
@@ -33,7 +34,7 @@ class AppModalDialog : public NotificationObserver {
public:
// A union of data necessary to determine the type of message box to
// show. |dialog_flags| is a MessageBox flag.
- AppModalDialog(TabContents* tab_contents,
+ AppModalDialog(JavaScriptMessageBoxClient* client,
const std::wstring& title,
int dialog_flags,
const std::wstring& message_text,
@@ -63,8 +64,8 @@ class AppModalDialog : public NotificationObserver {
/////////////////////////////////////////////////////////////////////////////
// Getters so NativeDialog can get information about the message box.
- TabContents* tab_contents() {
- return tab_contents_;
+ JavaScriptMessageBoxClient* client() {
+ return client_;
}
int dialog_flags() {
return dialog_flags_;
@@ -103,8 +104,15 @@ class AppModalDialog : public NotificationObserver {
// A reference to the platform native dialog box.
NativeDialog dialog_;
+ // An implementation of the client interface to provide supporting methods
+ // and receive results.
+ JavaScriptMessageBoxClient* client_;
+
+ // True if the dialog should no longer be shown, e.g. because the underlying
+ // tab navigated away while the dialog was queued.
+ bool skip_this_dialog_;
+
// Information about the message box is held in the following variables.
- TabContents* tab_contents_;
std::wstring title_;
int dialog_flags_;
std::wstring message_text_;