OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 COMPONENTS_APP_MODAL_JAVASCRIPT_APP_MODAL_DIALOG_H_ | 5 #ifndef COMPONENTS_APP_MODAL_JAVASCRIPT_APP_MODAL_DIALOG_H_ |
6 #define COMPONENTS_APP_MODAL_JAVASCRIPT_APP_MODAL_DIALOG_H_ | 6 #define COMPONENTS_APP_MODAL_JAVASCRIPT_APP_MODAL_DIALOG_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/time/time.h" |
13 #include "components/app_modal/app_modal_dialog.h" | 14 #include "components/app_modal/app_modal_dialog.h" |
14 #include "content/public/browser/javascript_dialog_manager.h" | 15 #include "content/public/browser/javascript_dialog_manager.h" |
15 | 16 |
16 namespace app_modal { | 17 namespace app_modal { |
17 | 18 |
18 // Extra data for JavaScript dialogs to add Chrome-only features. | 19 // Extra data for JavaScript dialogs to add Chrome-only features. |
19 class ChromeJavaScriptDialogExtraData { | 20 class ChromeJavaScriptDialogExtraData { |
20 public: | 21 public: |
21 ChromeJavaScriptDialogExtraData(); | 22 ChromeJavaScriptDialogExtraData(); |
22 | 23 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 base::string16 default_prompt_text() const { return default_prompt_text_; } | 77 base::string16 default_prompt_text() const { return default_prompt_text_; } |
77 bool display_suppress_checkbox() const { return display_suppress_checkbox_; } | 78 bool display_suppress_checkbox() const { return display_suppress_checkbox_; } |
78 bool is_before_unload_dialog() const { return is_before_unload_dialog_; } | 79 bool is_before_unload_dialog() const { return is_before_unload_dialog_; } |
79 bool is_reload() const { return is_reload_; } | 80 bool is_reload() const { return is_reload_; } |
80 | 81 |
81 private: | 82 private: |
82 // Notifies the delegate with the result of the dialog. | 83 // Notifies the delegate with the result of the dialog. |
83 void NotifyDelegate(bool success, const base::string16& prompt_text, | 84 void NotifyDelegate(bool success, const base::string16& prompt_text, |
84 bool suppress_js_messages); | 85 bool suppress_js_messages); |
85 | 86 |
| 87 void CallDialogClosedCallback(bool success, |
| 88 const base::string16& prompt_text); |
| 89 |
86 // A map of extra Chrome-only data associated with the delegate_. The keys | 90 // A map of extra Chrome-only data associated with the delegate_. The keys |
87 // come from |GetSerializedOriginForWebContents|. | 91 // come from |GetSerializedOriginForWebContents|. |
88 ExtraDataMap* extra_data_map_; | 92 ExtraDataMap* extra_data_map_; |
89 | 93 |
90 // Information about the message box is held in the following variables. | 94 // Information about the message box is held in the following variables. |
91 const content::JavaScriptMessageType javascript_message_type_; | 95 const content::JavaScriptMessageType javascript_message_type_; |
92 base::string16 message_text_; | 96 base::string16 message_text_; |
93 base::string16 default_prompt_text_; | 97 base::string16 default_prompt_text_; |
94 bool display_suppress_checkbox_; | 98 bool display_suppress_checkbox_; |
95 bool is_before_unload_dialog_; | 99 bool is_before_unload_dialog_; |
96 bool is_reload_; | 100 bool is_reload_; |
97 | 101 |
98 content::JavaScriptDialogManager::DialogClosedCallback callback_; | 102 content::JavaScriptDialogManager::DialogClosedCallback callback_; |
99 | 103 |
100 // Used only for testing. Specifies alternative prompt text that should be | 104 // Used only for testing. Specifies alternative prompt text that should be |
101 // used when notifying the delegate, if |use_override_prompt_text_| is true. | 105 // used when notifying the delegate, if |use_override_prompt_text_| is true. |
102 base::string16 override_prompt_text_; | 106 base::string16 override_prompt_text_; |
103 bool use_override_prompt_text_; | 107 bool use_override_prompt_text_; |
104 | 108 |
| 109 base::TimeTicks creation_time_; |
| 110 |
105 DISALLOW_COPY_AND_ASSIGN(JavaScriptAppModalDialog); | 111 DISALLOW_COPY_AND_ASSIGN(JavaScriptAppModalDialog); |
106 }; | 112 }; |
107 | 113 |
108 } // namespace app_modal | 114 } // namespace app_modal |
109 | 115 |
110 #endif // COMPONENTS_APP_MODAL_JAVASCRIPT_APP_MODAL_DIALOG_H_ | 116 #endif // COMPONENTS_APP_MODAL_JAVASCRIPT_APP_MODAL_DIALOG_H_ |
OLD | NEW |