| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_SHELL_SHELL_JAVASCRIPT_DIALOG_H_ | 5 #ifndef CONTENT_SHELL_SHELL_JAVASCRIPT_DIALOG_H_ |
| 6 #define CONTENT_SHELL_SHELL_JAVASCRIPT_DIALOG_H_ | 6 #define CONTENT_SHELL_SHELL_JAVASCRIPT_DIALOG_H_ |
| 7 | 7 |
| 8 #include "content/public/browser/javascript_dialogs.h" | 8 #include "content/public/browser/javascript_dialogs.h" |
| 9 | 9 |
| 10 #if defined(TOOLKIT_GTK) |
| 11 #include "ui/base/gtk/gtk_signal.h" |
| 12 #endif |
| 13 |
| 10 #if defined(OS_MACOSX) | 14 #if defined(OS_MACOSX) |
| 11 #if __OBJC__ | 15 #if __OBJC__ |
| 12 @class ShellJavaScriptDialogHelper; | 16 @class ShellJavaScriptDialogHelper; |
| 13 #else | 17 #else |
| 14 class ShellJavaScriptDialogHelper; | 18 class ShellJavaScriptDialogHelper; |
| 15 #endif // __OBJC__ | 19 #endif // __OBJC__ |
| 16 #endif // defined(OS_MACOSX) | 20 #endif // defined(OS_MACOSX) |
| 17 | 21 |
| 18 namespace content { | 22 namespace content { |
| 19 | 23 |
| 20 class ShellJavaScriptDialogCreator; | 24 class ShellJavaScriptDialogCreator; |
| 21 | 25 |
| 22 class ShellJavaScriptDialog { | 26 class ShellJavaScriptDialog { |
| 23 public: | 27 public: |
| 24 ShellJavaScriptDialog( | 28 ShellJavaScriptDialog( |
| 25 ShellJavaScriptDialogCreator* creator, | 29 ShellJavaScriptDialogCreator* creator, |
| 30 gfx::NativeWindow parent_window, |
| 26 JavaScriptMessageType message_type, | 31 JavaScriptMessageType message_type, |
| 27 const string16& message_text, | 32 const string16& message_text, |
| 28 const string16& default_prompt_text, | 33 const string16& default_prompt_text, |
| 29 const JavaScriptDialogCreator::DialogClosedCallback& callback); | 34 const JavaScriptDialogCreator::DialogClosedCallback& callback); |
| 30 ~ShellJavaScriptDialog(); | 35 ~ShellJavaScriptDialog(); |
| 31 | 36 |
| 32 // Called to cancel a dialog mid-flight. | 37 // Called to cancel a dialog mid-flight. |
| 33 void Cancel(); | 38 void Cancel(); |
| 34 | 39 |
| 35 private: | 40 private: |
| 36 ShellJavaScriptDialogCreator* creator_; | 41 ShellJavaScriptDialogCreator* creator_; |
| 37 JavaScriptDialogCreator::DialogClosedCallback callback_; | 42 JavaScriptDialogCreator::DialogClosedCallback callback_; |
| 38 | 43 |
| 39 #if defined(OS_MACOSX) | 44 #if defined(OS_MACOSX) |
| 40 ShellJavaScriptDialogHelper* helper_; // owned | 45 ShellJavaScriptDialogHelper* helper_; // owned |
| 41 #elif defined(OS_WIN) | 46 #elif defined(OS_WIN) |
| 42 JavaScriptMessageType message_type_; | 47 JavaScriptMessageType message_type_; |
| 43 HWND dialog_win_; | 48 HWND dialog_win_; |
| 44 string16 message_text_; | 49 string16 message_text_; |
| 45 string16 default_prompt_text_; | 50 string16 default_prompt_text_; |
| 46 static INT_PTR CALLBACK DialogProc(HWND dialog, UINT message, WPARAM wparam, | 51 static INT_PTR CALLBACK DialogProc(HWND dialog, UINT message, WPARAM wparam, |
| 47 LPARAM lparam); | 52 LPARAM lparam); |
| 53 #elif defined(TOOLKIT_GTK) |
| 54 GtkWidget* gtk_dialog_; |
| 55 gfx::NativeWindow parent_window_; |
| 56 CHROMEGTK_CALLBACK_1(ShellJavaScriptDialog, void, OnResponse, int); |
| 48 #endif | 57 #endif |
| 49 | 58 |
| 50 DISALLOW_COPY_AND_ASSIGN(ShellJavaScriptDialog); | 59 DISALLOW_COPY_AND_ASSIGN(ShellJavaScriptDialog); |
| 51 }; | 60 }; |
| 52 | 61 |
| 53 } // namespace content | 62 } // namespace content |
| 54 | 63 |
| 55 #endif // CONTENT_SHELL_SHELL_JAVASCRIPT_DIALOG_H_ | 64 #endif // CONTENT_SHELL_SHELL_JAVASCRIPT_DIALOG_H_ |
| OLD | NEW |