| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_BROWSER_JSMESSAGE_BOX_HANDLER_WIN_H_ | 5 #ifndef CHROME_BROWSER_JSMESSAGE_BOX_HANDLER_WIN_H_ |
| 6 #define CHROME_BROWSER_JSMESSAGE_BOX_HANDLER_WIN_H_ | 6 #define CHROME_BROWSER_JSMESSAGE_BOX_HANDLER_WIN_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/app_modal_dialog_delegate.h" |
| 8 #include "chrome/browser/jsmessage_box_handler.h" | 9 #include "chrome/browser/jsmessage_box_handler.h" |
| 9 #include "chrome/common/ipc_message.h" | 10 #include "chrome/common/ipc_message.h" |
| 10 #include "chrome/common/notification_observer.h" | 11 #include "chrome/common/notification_observer.h" |
| 11 #include "chrome/common/notification_registrar.h" | 12 #include "chrome/common/notification_registrar.h" |
| 12 #include "chrome/views/app_modal_dialog_delegate.h" | 13 #include "chrome/views/dialog_delegate.h" |
| 13 | 14 |
| 14 class MessageBoxView; | 15 class MessageBoxView; |
| 15 class WebContents; | 16 class WebContents; |
| 16 namespace views { | 17 namespace views { |
| 17 class Window; | 18 class Window; |
| 18 } | 19 } |
| 19 | 20 |
| 20 class JavascriptMessageBoxHandler | 21 class JavascriptMessageBoxHandler |
| 21 : public views::AppModalDialogDelegate, | 22 : public AppModalDialogDelegate, |
| 22 public NotificationObserver { | 23 public AppModalDialogDelegateTesting, |
| 24 public NotificationObserver, |
| 25 public views::DialogDelegate { |
| 23 public: | 26 public: |
| 24 // Cross-platform code should use RunJavaScriptMessageBox. | 27 // Cross-platform code should use RunJavaScriptMessageBox. |
| 25 JavascriptMessageBoxHandler(WebContents* web_contents, | 28 JavascriptMessageBoxHandler(WebContents* web_contents, |
| 26 int dialog_flags, | 29 int dialog_flags, |
| 27 const std::wstring& message_text, | 30 const std::wstring& message_text, |
| 28 const std::wstring& default_prompt_text, | 31 const std::wstring& default_prompt_text, |
| 29 bool display_suppress_checkbox, | 32 bool display_suppress_checkbox, |
| 30 IPC::Message* reply_msg); | 33 IPC::Message* reply_msg); |
| 31 virtual ~JavascriptMessageBoxHandler(); | 34 virtual ~JavascriptMessageBoxHandler(); |
| 32 | 35 |
| 36 // AppModalDialogDelegate Methods: |
| 37 virtual void ShowModalDialog(); |
| 38 virtual void ActivateModalDialog(); |
| 39 virtual AppModalDialogDelegateTesting* GetTestingInterface(); |
| 40 |
| 41 // AppModalDialogDelegateTesting Methods: |
| 42 virtual views::DialogDelegate* GetDialogDelegate(); |
| 43 |
| 33 // views::DialogDelegate Methods: | 44 // views::DialogDelegate Methods: |
| 34 virtual int GetDialogButtons() const; | 45 virtual int GetDialogButtons() const; |
| 35 virtual std::wstring GetWindowTitle() const; | 46 virtual std::wstring GetWindowTitle() const; |
| 36 virtual void WindowClosing(); | 47 virtual void WindowClosing(); |
| 37 virtual bool Cancel(); | 48 virtual bool Cancel(); |
| 38 virtual bool Accept(); | 49 virtual bool Accept(); |
| 39 | 50 |
| 40 // views::AppModalDialogDelegate | |
| 41 virtual void ShowModalDialog(); | |
| 42 virtual void ActivateModalDialog(); | |
| 43 | |
| 44 // views::WindowDelegate Methods: | 51 // views::WindowDelegate Methods: |
| 45 virtual bool IsModal() const { return true; } | 52 virtual bool IsModal() const { return true; } |
| 46 virtual views::View* GetContentsView(); | 53 virtual views::View* GetContentsView(); |
| 47 virtual views::View* GetInitiallyFocusedView(); | 54 virtual views::View* GetInitiallyFocusedView(); |
| 48 | 55 |
| 49 private: | 56 private: |
| 50 // NotificationObserver implementation. | 57 // NotificationObserver implementation. |
| 51 virtual void Observe(NotificationType type, | 58 virtual void Observe(NotificationType type, |
| 52 const NotificationSource& source, | 59 const NotificationSource& source, |
| 53 const NotificationDetails& details); | 60 const NotificationDetails& details); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 67 // Stores flags defined in message_box_view.h which describe the dialog box. | 74 // Stores flags defined in message_box_view.h which describe the dialog box. |
| 68 int dialog_flags_; | 75 int dialog_flags_; |
| 69 | 76 |
| 70 // The dialog if it is currently visible. | 77 // The dialog if it is currently visible. |
| 71 views::Window* dialog_; | 78 views::Window* dialog_; |
| 72 | 79 |
| 73 DISALLOW_COPY_AND_ASSIGN(JavascriptMessageBoxHandler); | 80 DISALLOW_COPY_AND_ASSIGN(JavascriptMessageBoxHandler); |
| 74 }; | 81 }; |
| 75 | 82 |
| 76 #endif // CHROME_BROWSER_JSMESSAGE_BOX_HANDLER_WIN_H_ | 83 #endif // CHROME_BROWSER_JSMESSAGE_BOX_HANDLER_WIN_H_ |
| OLD | NEW |