| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BROWSER_SHELL_JAVASCRIPT_DIALOG_H_ | 5 #ifndef CONTENT_SHELL_BROWSER_SHELL_JAVASCRIPT_DIALOG_H_ |
| 6 #define CONTENT_SHELL_BROWSER_SHELL_JAVASCRIPT_DIALOG_H_ | 6 #define CONTENT_SHELL_BROWSER_SHELL_JAVASCRIPT_DIALOG_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "content/public/browser/javascript_dialog_manager.h" | 10 #include "content/public/browser/javascript_dialog_manager.h" |
| 11 | 11 |
| 12 #if defined(OS_MACOSX) | 12 #if defined(OS_MACOSX) |
| 13 #if __OBJC__ | 13 #if __OBJC__ |
| 14 @class ShellJavaScriptDialogHelper; | 14 @class ShellJavaScriptDialogHelper; |
| 15 #else | 15 #else |
| 16 class ShellJavaScriptDialogHelper; | 16 class ShellJavaScriptDialogHelper; |
| 17 #endif // __OBJC__ | 17 #endif // __OBJC__ |
| 18 #endif // defined(OS_MACOSX) | 18 #endif // defined(OS_MACOSX) |
| 19 | 19 |
| 20 namespace content { | 20 namespace content { |
| 21 | 21 |
| 22 class ShellJavaScriptDialogManager; | 22 class ShellJavaScriptDialogManager; |
| 23 | 23 |
| 24 class ShellJavaScriptDialog { | 24 class ShellJavaScriptDialog { |
| 25 public: | 25 public: |
| 26 ShellJavaScriptDialog( | 26 ShellJavaScriptDialog( |
| 27 ShellJavaScriptDialogManager* manager, | 27 ShellJavaScriptDialogManager* manager, |
| 28 gfx::NativeWindow parent_window, | 28 gfx::NativeWindow parent_window, |
| 29 JavaScriptMessageType message_type, | 29 JavaScriptDialogType dialog_type, |
| 30 const base::string16& message_text, | 30 const base::string16& message_text, |
| 31 const base::string16& default_prompt_text, | 31 const base::string16& default_prompt_text, |
| 32 const JavaScriptDialogManager::DialogClosedCallback& callback); | 32 const JavaScriptDialogManager::DialogClosedCallback& callback); |
| 33 ~ShellJavaScriptDialog(); | 33 ~ShellJavaScriptDialog(); |
| 34 | 34 |
| 35 // Called to cancel a dialog mid-flight. | 35 // Called to cancel a dialog mid-flight. |
| 36 void Cancel(); | 36 void Cancel(); |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 JavaScriptDialogManager::DialogClosedCallback callback_; | 39 JavaScriptDialogManager::DialogClosedCallback callback_; |
| 40 | 40 |
| 41 #if defined(OS_MACOSX) | 41 #if defined(OS_MACOSX) |
| 42 ShellJavaScriptDialogHelper* helper_; // owned | 42 ShellJavaScriptDialogHelper* helper_; // owned |
| 43 #elif defined(OS_WIN) | 43 #elif defined(OS_WIN) |
| 44 ShellJavaScriptDialogManager* manager_; | 44 ShellJavaScriptDialogManager* manager_; |
| 45 JavaScriptMessageType message_type_; | 45 JavaScriptDialogType dialog_type_; |
| 46 HWND dialog_win_; | 46 HWND dialog_win_; |
| 47 base::string16 message_text_; | 47 base::string16 message_text_; |
| 48 base::string16 default_prompt_text_; | 48 base::string16 default_prompt_text_; |
| 49 static INT_PTR CALLBACK DialogProc(HWND dialog, UINT message, WPARAM wparam, | 49 static INT_PTR CALLBACK DialogProc(HWND dialog, UINT message, WPARAM wparam, |
| 50 LPARAM lparam); | 50 LPARAM lparam); |
| 51 #endif | 51 #endif |
| 52 | 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(ShellJavaScriptDialog); | 53 DISALLOW_COPY_AND_ASSIGN(ShellJavaScriptDialog); |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 } // namespace content | 56 } // namespace content |
| 57 | 57 |
| 58 #endif // CONTENT_SHELL_BROWSER_SHELL_JAVASCRIPT_DIALOG_H_ | 58 #endif // CONTENT_SHELL_BROWSER_SHELL_JAVASCRIPT_DIALOG_H_ |
| OLD | NEW |