| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_JS_MODAL_DIALOG_H_ | 5 #ifndef CHROME_BROWSER_JS_MODAL_DIALOG_H_ |
| 6 #define CHROME_BROWSER_JS_MODAL_DIALOG_H_ | 6 #define CHROME_BROWSER_JS_MODAL_DIALOG_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 void OnAccept(const std::wstring& prompt_text, bool suppress_js_messages); | 71 void OnAccept(const std::wstring& prompt_text, bool suppress_js_messages); |
| 72 void OnClose(); | 72 void OnClose(); |
| 73 | 73 |
| 74 // Accessors | 74 // Accessors |
| 75 int dialog_flags() const { return dialog_flags_; } | 75 int dialog_flags() const { return dialog_flags_; } |
| 76 std::wstring message_text() const { return message_text_; } | 76 std::wstring message_text() const { return message_text_; } |
| 77 std::wstring default_prompt_text() const { return default_prompt_text_; } | 77 std::wstring default_prompt_text() const { return default_prompt_text_; } |
| 78 bool display_suppress_checkbox() const { return display_suppress_checkbox_; } | 78 bool display_suppress_checkbox() const { return display_suppress_checkbox_; } |
| 79 bool is_before_unload_dialog() const { return is_before_unload_dialog_; } | 79 bool is_before_unload_dialog() const { return is_before_unload_dialog_; } |
| 80 | 80 |
| 81 protected: |
| 82 // Overridden from AppModalDialog: |
| 83 virtual void Cleanup(); |
| 84 |
| 81 private: | 85 private: |
| 82 // Overridden from NotificationObserver: | 86 // Overridden from NotificationObserver: |
| 83 virtual void Observe(NotificationType type, | 87 virtual void Observe(NotificationType type, |
| 84 const NotificationSource& source, | 88 const NotificationSource& source, |
| 85 const NotificationDetails& details); | 89 const NotificationDetails& details); |
| 86 | 90 |
| 87 // Initializes for notifications to listen. | 91 // Initializes for notifications to listen. |
| 88 void InitNotifications(); | 92 void InitNotifications(); |
| 89 // Updates the delegate with the result of the dialog. | |
| 90 void UpdateDelegate(bool success, const std::wstring& prompt_text, | |
| 91 bool suppress_js_messages); | |
| 92 | 93 |
| 93 NotificationRegistrar registrar_; | 94 NotificationRegistrar registrar_; |
| 94 | 95 |
| 95 // An implementation of the client interface to provide supporting methods | 96 // An implementation of the client interface to provide supporting methods |
| 96 // and receive results. | 97 // and receive results. |
| 97 JavaScriptAppModalDialogDelegate* delegate_; | 98 JavaScriptAppModalDialogDelegate* delegate_; |
| 98 | 99 |
| 99 // The client_ as an ExtensionHost, cached for use during notifications that | 100 // The client_ as an ExtensionHost, cached for use during notifications that |
| 100 // may arrive after the client has entered its destructor (and is thus | 101 // may arrive after the client has entered its destructor (and is thus |
| 101 // treated as a base Delegate). This will be NULL if the |delegate_| is not an | 102 // treated as a base Delegate). This will be NULL if the |delegate_| is not an |
| 102 // ExtensionHost. | 103 // ExtensionHost. |
| 103 ExtensionHost* extension_host_; | 104 ExtensionHost* extension_host_; |
| 104 | 105 |
| 105 // Information about the message box is held in the following variables. | 106 // Information about the message box is held in the following variables. |
| 106 int dialog_flags_; | 107 int dialog_flags_; |
| 107 std::wstring message_text_; | 108 std::wstring message_text_; |
| 108 std::wstring default_prompt_text_; | 109 std::wstring default_prompt_text_; |
| 109 bool display_suppress_checkbox_; | 110 bool display_suppress_checkbox_; |
| 110 bool is_before_unload_dialog_; | 111 bool is_before_unload_dialog_; |
| 111 IPC::Message* reply_msg_; | 112 IPC::Message* reply_msg_; |
| 112 | 113 |
| 113 DISALLOW_COPY_AND_ASSIGN(JavaScriptAppModalDialog); | 114 DISALLOW_COPY_AND_ASSIGN(JavaScriptAppModalDialog); |
| 114 }; | 115 }; |
| 115 | 116 |
| 116 #endif // CHROME_BROWSER_JS_MODAL_DIALOG_H_ | 117 #endif // CHROME_BROWSER_JS_MODAL_DIALOG_H_ |
| OLD | NEW |