diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/gtk/js_modal_dialog_gtk.cc | 27 | ||||
-rw-r--r-- | chrome/browser/gtk/js_modal_dialog_gtk.h | 11 |
2 files changed, 13 insertions, 25 deletions
diff --git a/chrome/browser/gtk/js_modal_dialog_gtk.cc b/chrome/browser/gtk/js_modal_dialog_gtk.cc index cae6b63..27888d4 100644 --- a/chrome/browser/gtk/js_modal_dialog_gtk.cc +++ b/chrome/browser/gtk/js_modal_dialog_gtk.cc @@ -135,8 +135,7 @@ JSModalDialogGtk::JSModalDialogGtk(JavaScriptAppModalDialog* dialog, gtk_dialog_set_default_response(GTK_DIALOG(gtk_dialog_), GTK_RESPONSE_OK); g_signal_connect(gtk_dialog_, "response", - G_CALLBACK(JSModalDialogGtk::OnDialogResponse), - reinterpret_cast<JSModalDialogGtk*>(this)); + G_CALLBACK(OnDialogResponseThunk), this); } JSModalDialogGtk::~JSModalDialogGtk() { @@ -174,32 +173,33 @@ void JSModalDialogGtk::ActivateAppModalDialog() { void JSModalDialogGtk::CloseAppModalDialog() { DCHECK(gtk_dialog_); - HandleDialogResponse(GTK_DIALOG(gtk_dialog_), GTK_RESPONSE_DELETE_EVENT); + OnDialogResponse(gtk_dialog_, GTK_RESPONSE_DELETE_EVENT); } void JSModalDialogGtk::AcceptAppModalDialog() { - HandleDialogResponse(GTK_DIALOG(gtk_dialog_), GTK_RESPONSE_OK); + OnDialogResponse(gtk_dialog_, GTK_RESPONSE_OK); } void JSModalDialogGtk::CancelAppModalDialog() { - HandleDialogResponse(GTK_DIALOG(gtk_dialog_), GTK_RESPONSE_CANCEL); + OnDialogResponse(gtk_dialog_, GTK_RESPONSE_CANCEL); } //////////////////////////////////////////////////////////////////////////////// // JSModalDialogGtk, private: -void JSModalDialogGtk::HandleDialogResponse(GtkDialog* dialog, - gint response_id) { +void JSModalDialogGtk::OnDialogResponse(GtkWidget* dialog, + int response_id) { switch (response_id) { case GTK_RESPONSE_OK: // The first arg is the prompt text and the second is true if we want to // suppress additional popups from the page. - dialog_->OnAccept(GetPromptText(dialog), ShouldSuppressJSDialogs(dialog)); + dialog_->OnAccept(GetPromptText(GTK_DIALOG(dialog)), + ShouldSuppressJSDialogs(GTK_DIALOG(dialog))); break; case GTK_RESPONSE_CANCEL: case GTK_RESPONSE_DELETE_EVENT: // User hit the X on the dialog. - dialog_->OnCancel(ShouldSuppressJSDialogs(dialog)); + dialog_->OnCancel(ShouldSuppressJSDialogs(GTK_DIALOG(dialog))); break; default: @@ -213,13 +213,6 @@ void JSModalDialogGtk::HandleDialogResponse(GtkDialog* dialog, delete this; } -// static -void JSModalDialogGtk::OnDialogResponse(GtkDialog* gtk_dialog, - gint response_id, - JSModalDialogGtk* dialog) { - dialog->HandleDialogResponse(gtk_dialog, response_id); -} - //////////////////////////////////////////////////////////////////////////////// // NativeAppModalDialog, public: @@ -229,5 +222,3 @@ NativeAppModalDialog* NativeAppModalDialog::CreateNativeJavaScriptPrompt( gfx::NativeWindow parent_window) { return new JSModalDialogGtk(dialog, parent_window); } - - diff --git a/chrome/browser/gtk/js_modal_dialog_gtk.h b/chrome/browser/gtk/js_modal_dialog_gtk.h index 47ca0ca..a6a132b9 100644 --- a/chrome/browser/gtk/js_modal_dialog_gtk.h +++ b/chrome/browser/gtk/js_modal_dialog_gtk.h @@ -6,14 +6,14 @@ #define CHROME_BROWSER_GTK_JS_MODAL_DIALOG_GTK_H_ #pragma once -#include <gtk/gtk.h> - #include "app/gtk_signal.h" -#include "base/logging.h" +#include "base/basictypes.h" #include "base/scoped_ptr.h" #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" #include "gfx/native_widget_types.h" +typedef struct _GtkWidget GtkWidget; + class JavaScriptAppModalDialog; class JSModalDialogGtk : public NativeAppModalDialog { @@ -31,9 +31,7 @@ class JSModalDialogGtk : public NativeAppModalDialog { virtual void CancelAppModalDialog(); private: - void HandleDialogResponse(GtkDialog* dialog, gint response_id); - static void OnDialogResponse(GtkDialog* gtk_dialog, gint response_id, - JSModalDialogGtk* dialog); + CHROMEGTK_CALLBACK_1(JSModalDialogGtk, void, OnDialogResponse, int); scoped_ptr<JavaScriptAppModalDialog> dialog_; GtkWidget* gtk_dialog_; @@ -42,4 +40,3 @@ class JSModalDialogGtk : public NativeAppModalDialog { }; #endif // CHROME_BROWSER_GTK_JS_MODAL_DIALOG_GTK_H_ - |