| 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 | |
| 85 private: | 81 private: |
| 86 // Overridden from NotificationObserver: | 82 // Overridden from NotificationObserver: |
| 87 virtual void Observe(NotificationType type, | 83 virtual void Observe(NotificationType type, |
| 88 const NotificationSource& source, | 84 const NotificationSource& source, |
| 89 const NotificationDetails& details); | 85 const NotificationDetails& details); |
| 90 | 86 |
| 91 // Initializes for notifications to listen. | 87 // Initializes for notifications to listen. |
| 92 void InitNotifications(); | 88 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); |
| 93 | 92 |
| 94 NotificationRegistrar registrar_; | 93 NotificationRegistrar registrar_; |
| 95 | 94 |
| 96 // An implementation of the client interface to provide supporting methods | 95 // An implementation of the client interface to provide supporting methods |
| 97 // and receive results. | 96 // and receive results. |
| 98 JavaScriptAppModalDialogDelegate* delegate_; | 97 JavaScriptAppModalDialogDelegate* delegate_; |
| 99 | 98 |
| 100 // The client_ as an ExtensionHost, cached for use during notifications that | 99 // The client_ as an ExtensionHost, cached for use during notifications that |
| 101 // may arrive after the client has entered its destructor (and is thus | 100 // may arrive after the client has entered its destructor (and is thus |
| 102 // treated as a base Delegate). This will be NULL if the |delegate_| is not an | 101 // treated as a base Delegate). This will be NULL if the |delegate_| is not an |
| 103 // ExtensionHost. | 102 // ExtensionHost. |
| 104 ExtensionHost* extension_host_; | 103 ExtensionHost* extension_host_; |
| 105 | 104 |
| 106 // Information about the message box is held in the following variables. | 105 // Information about the message box is held in the following variables. |
| 107 int dialog_flags_; | 106 int dialog_flags_; |
| 108 std::wstring message_text_; | 107 std::wstring message_text_; |
| 109 std::wstring default_prompt_text_; | 108 std::wstring default_prompt_text_; |
| 110 bool display_suppress_checkbox_; | 109 bool display_suppress_checkbox_; |
| 111 bool is_before_unload_dialog_; | 110 bool is_before_unload_dialog_; |
| 112 IPC::Message* reply_msg_; | 111 IPC::Message* reply_msg_; |
| 113 | 112 |
| 114 DISALLOW_COPY_AND_ASSIGN(JavaScriptAppModalDialog); | 113 DISALLOW_COPY_AND_ASSIGN(JavaScriptAppModalDialog); |
| 115 }; | 114 }; |
| 116 | 115 |
| 117 #endif // CHROME_BROWSER_JS_MODAL_DIALOG_H_ | 116 #endif // CHROME_BROWSER_JS_MODAL_DIALOG_H_ |
| OLD | NEW |