diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-28 15:40:20 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-28 15:40:20 +0000 |
commit | 160ad3d101988b9d842fef8b18cc49c54c9a1de5 (patch) | |
tree | 567875d2f363d0b110ad25da9a9aa07cffcaa201 /chrome/browser/js_modal_dialog.h | |
parent | 341078d4b72bd3de280b960be6cd4ac5e5ab0265 (diff) | |
download | chromium_src-160ad3d101988b9d842fef8b18cc49c54c9a1de5.zip chromium_src-160ad3d101988b9d842fef8b18cc49c54c9a1de5.tar.gz chromium_src-160ad3d101988b9d842fef8b18cc49c54c9a1de5.tar.bz2 |
Refactor AppModalDialog to more clearly isolate platform specific UI pieces and eliminate the dependency on individual frontends from cross platform code.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3398015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60785 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/js_modal_dialog.h')
-rw-r--r-- | chrome/browser/js_modal_dialog.h | 45 |
1 files changed, 11 insertions, 34 deletions
diff --git a/chrome/browser/js_modal_dialog.h b/chrome/browser/js_modal_dialog.h index 7cfe34f..b2cccff 100644 --- a/chrome/browser/js_modal_dialog.h +++ b/chrome/browser/js_modal_dialog.h @@ -13,16 +13,9 @@ #include "chrome/common/notification_observer.h" #include "chrome/common/notification_registrar.h" -#if defined(OS_MACOSX) -#if __OBJC__ -@class NSAlert; -#else -class NSAlert; -#endif -#endif - class ExtensionHost; class JavaScriptMessageBoxClient; +class NativeAppModalDialog; namespace IPC { class Message; @@ -46,41 +39,27 @@ class JavaScriptAppModalDialog : public AppModalDialog, virtual ~JavaScriptAppModalDialog(); // AppModalDialog overrides. -#if defined(OS_POSIX) - virtual void CreateAndShowDialog(); -#endif -#if defined(TOOLKIT_USES_GTK) - virtual void HandleDialogResponse(GtkDialog* dialog, gint response_id); -#endif - virtual int GetDialogButtons(); - virtual void AcceptWindow(); - virtual void CancelWindow(); + virtual NativeAppModalDialog* CreateNativeDialog(); ///////////////////////////////////////////////////////////////////////////// // Getters so NativeDialog can get information about the message box. - JavaScriptMessageBoxClient* client() { - return client_; - } - int dialog_flags() { - return dialog_flags_; - } - bool is_before_unload_dialog() { - return is_before_unload_dialog_; - } - -#if defined(OS_MACOSX) - virtual void CloseModalDialog(); -#endif + JavaScriptMessageBoxClient* client() const { return client_; } // Callbacks from NativeDialog when the user accepts or cancels the dialog. void OnCancel(); void OnAccept(const std::wstring& prompt_text, bool suppress_js_messages); void OnClose(); + // Accessors + int dialog_flags() const { return dialog_flags_; } + std::wstring message_text() const { return message_text_; } + std::wstring default_prompt_text() const { return default_prompt_text_; } + bool display_suppress_checkbox() const { return display_suppress_checkbox_; } + bool is_before_unload_dialog() const { return is_before_unload_dialog_; } + protected: // AppModalDialog overrides. virtual void Cleanup(); - virtual NativeDialog CreateNativeDialog(); private: // NotificationObserver implementation. @@ -91,9 +70,7 @@ class JavaScriptAppModalDialog : public AppModalDialog, // Initializes for notifications to listen. void InitNotifications(); -#if defined(OS_MACOSX) - NSAlert* dialog_; -#endif + NativeAppModalDialog* native_dialog_; NotificationRegistrar registrar_; |