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_UI_APP_MODAL_DIALOGS_JS_MODAL_DIALOG_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_MODAL_DIALOGS_JS_MODAL_DIALOG_H_ |
6 #define CHROME_BROWSER_UI_APP_MODAL_DIALOGS_JS_MODAL_DIALOG_H_ | 6 #define CHROME_BROWSER_UI_APP_MODAL_DIALOGS_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(); |
93 | 89 |
90 // Updates the delegate with the result of the dialog. | |
91 void UpdateDelegate(bool success, const std::wstring& prompt_text, | |
Matt Perry
2010/12/03 00:58:53
one more nit: maybe NotifyDelegate would be more a
| |
92 bool suppress_js_messages); | |
93 | |
94 NotificationRegistrar registrar_; | 94 NotificationRegistrar registrar_; |
95 | 95 |
96 // An implementation of the client interface to provide supporting methods | 96 // An implementation of the client interface to provide supporting methods |
97 // and receive results. | 97 // and receive results. |
98 JavaScriptAppModalDialogDelegate* delegate_; | 98 JavaScriptAppModalDialogDelegate* delegate_; |
99 | 99 |
100 // The client_ as an ExtensionHost, cached for use during notifications that | 100 // The client_ as an ExtensionHost, cached for use during notifications that |
101 // 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 |
102 // 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 |
103 // ExtensionHost. | 103 // ExtensionHost. |
104 ExtensionHost* extension_host_; | 104 ExtensionHost* extension_host_; |
105 | 105 |
106 // Information about the message box is held in the following variables. | 106 // Information about the message box is held in the following variables. |
107 int dialog_flags_; | 107 int dialog_flags_; |
108 std::wstring message_text_; | 108 std::wstring message_text_; |
109 std::wstring default_prompt_text_; | 109 std::wstring default_prompt_text_; |
110 bool display_suppress_checkbox_; | 110 bool display_suppress_checkbox_; |
111 bool is_before_unload_dialog_; | 111 bool is_before_unload_dialog_; |
112 IPC::Message* reply_msg_; | 112 IPC::Message* reply_msg_; |
113 | 113 |
114 DISALLOW_COPY_AND_ASSIGN(JavaScriptAppModalDialog); | 114 DISALLOW_COPY_AND_ASSIGN(JavaScriptAppModalDialog); |
115 }; | 115 }; |
116 | 116 |
117 #endif // CHROME_BROWSER_UI_APP_MODAL_DIALOGS_JS_MODAL_DIALOG_H_ | 117 #endif // CHROME_BROWSER_UI_APP_MODAL_DIALOGS_JS_MODAL_DIALOG_H_ |
OLD | NEW |