Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: components/app_modal/javascript_app_modal_dialog.h

Issue 2684093002: Rename JavaScript "messages" to "dialogs". (Closed)
Patch Set: win fox Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 22 matching lines...) Expand all
33 // A controller + model class for JavaScript alert, confirm, prompt, and 33 // A controller + model class for JavaScript alert, confirm, prompt, and
34 // onbeforeunload dialog boxes. 34 // onbeforeunload dialog boxes.
35 class JavaScriptAppModalDialog : public AppModalDialog { 35 class JavaScriptAppModalDialog : public AppModalDialog {
36 public: 36 public:
37 typedef std::map<void*, ChromeJavaScriptDialogExtraData> ExtraDataMap; 37 typedef std::map<void*, ChromeJavaScriptDialogExtraData> ExtraDataMap;
38 38
39 JavaScriptAppModalDialog( 39 JavaScriptAppModalDialog(
40 content::WebContents* web_contents, 40 content::WebContents* web_contents,
41 ExtraDataMap* extra_data_map, 41 ExtraDataMap* extra_data_map,
42 const base::string16& title, 42 const base::string16& title,
43 content::JavaScriptMessageType javascript_message_type, 43 content::JavaScriptDialogType javascript_dialog_type,
44 const base::string16& message_text, 44 const base::string16& message_text,
45 const base::string16& default_prompt_text, 45 const base::string16& default_prompt_text,
46 bool display_suppress_checkbox, 46 bool display_suppress_checkbox,
47 bool is_before_unload_dialog, 47 bool is_before_unload_dialog,
48 bool is_reload, 48 bool is_reload,
49 const content::JavaScriptDialogManager::DialogClosedCallback& callback); 49 const content::JavaScriptDialogManager::DialogClosedCallback& callback);
50 ~JavaScriptAppModalDialog() override; 50 ~JavaScriptAppModalDialog() override;
51 51
52 // Overridden from AppModalDialog: 52 // Overridden from AppModalDialog:
53 NativeAppModalDialog* CreateNativeDialog() override; 53 NativeAppModalDialog* CreateNativeDialog() override;
54 bool IsJavaScriptModalDialog() override; 54 bool IsJavaScriptModalDialog() override;
55 void Invalidate() override; 55 void Invalidate() override;
56 56
57 // Callbacks from NativeDialog when the user accepts or cancels the dialog. 57 // Callbacks from NativeDialog when the user accepts or cancels the dialog.
58 void OnCancel(bool suppress_js_messages); 58 void OnCancel(bool suppress_js_messages);
59 void OnAccept(const base::string16& prompt_text, bool suppress_js_messages); 59 void OnAccept(const base::string16& prompt_text, bool suppress_js_messages);
60 60
61 // NOTE: This is only called under Views, and should be removed. Any critical 61 // NOTE: This is only called under Views, and should be removed. Any critical
62 // work should be done in OnCancel or OnAccept. See crbug.com/63732 for more. 62 // work should be done in OnCancel or OnAccept. See crbug.com/63732 for more.
63 void OnClose(); 63 void OnClose();
64 64
65 // Used only for testing. The dialog will use the given text when notifying 65 // Used only for testing. The dialog will use the given text when notifying
66 // its delegate instead of whatever the UI reports. 66 // its delegate instead of whatever the UI reports.
67 void SetOverridePromptText(const base::string16& prompt_text); 67 void SetOverridePromptText(const base::string16& prompt_text);
68 68
69 // Accessors 69 // Accessors
70 content::JavaScriptMessageType javascript_message_type() const { 70 content::JavaScriptDialogType javascript_dialog_type() const {
71 return javascript_message_type_; 71 return javascript_dialog_type_;
72 } 72 }
73 base::string16 message_text() const { return message_text_; } 73 base::string16 message_text() const { return message_text_; }
74 base::string16 default_prompt_text() const { return default_prompt_text_; } 74 base::string16 default_prompt_text() const { return default_prompt_text_; }
75 bool display_suppress_checkbox() const { return display_suppress_checkbox_; } 75 bool display_suppress_checkbox() const { return display_suppress_checkbox_; }
76 bool is_before_unload_dialog() const { return is_before_unload_dialog_; } 76 bool is_before_unload_dialog() const { return is_before_unload_dialog_; }
77 bool is_reload() const { return is_reload_; } 77 bool is_reload() const { return is_reload_; }
78 78
79 private: 79 private:
80 // Notifies the delegate with the result of the dialog. 80 // Notifies the delegate with the result of the dialog.
81 void NotifyDelegate(bool success, const base::string16& prompt_text, 81 void NotifyDelegate(bool success, const base::string16& prompt_text,
82 bool suppress_js_messages); 82 bool suppress_js_messages);
83 83
84 void CallDialogClosedCallback(bool success, 84 void CallDialogClosedCallback(bool success,
85 const base::string16& prompt_text); 85 const base::string16& prompt_text);
86 86
87 // A map of extra Chrome-only data associated with the delegate_. Can be 87 // A map of extra Chrome-only data associated with the delegate_. Can be
88 // inspected via |extra_data_map_[web_contents_]|. 88 // inspected via |extra_data_map_[web_contents_]|.
89 ExtraDataMap* extra_data_map_; 89 ExtraDataMap* extra_data_map_;
90 90
91 // Information about the message box is held in the following variables. 91 // Information about the message box is held in the following variables.
92 const content::JavaScriptMessageType javascript_message_type_; 92 const content::JavaScriptDialogType javascript_dialog_type_;
93 base::string16 message_text_; 93 base::string16 message_text_;
94 base::string16 default_prompt_text_; 94 base::string16 default_prompt_text_;
95 bool display_suppress_checkbox_; 95 bool display_suppress_checkbox_;
96 bool is_before_unload_dialog_; 96 bool is_before_unload_dialog_;
97 bool is_reload_; 97 bool is_reload_;
98 98
99 content::JavaScriptDialogManager::DialogClosedCallback callback_; 99 content::JavaScriptDialogManager::DialogClosedCallback callback_;
100 100
101 // Used only for testing. Specifies alternative prompt text that should be 101 // Used only for testing. Specifies alternative prompt text that should be
102 // used when notifying the delegate, if |use_override_prompt_text_| is true. 102 // used when notifying the delegate, if |use_override_prompt_text_| is true.
103 base::string16 override_prompt_text_; 103 base::string16 override_prompt_text_;
104 bool use_override_prompt_text_; 104 bool use_override_prompt_text_;
105 105
106 base::TimeTicks creation_time_; 106 base::TimeTicks creation_time_;
107 107
108 DISALLOW_COPY_AND_ASSIGN(JavaScriptAppModalDialog); 108 DISALLOW_COPY_AND_ASSIGN(JavaScriptAppModalDialog);
109 }; 109 };
110 110
111 } // namespace app_modal 111 } // namespace app_modal
112 112
113 #endif // COMPONENTS_APP_MODAL_JAVASCRIPT_APP_MODAL_DIALOG_H_ 113 #endif // COMPONENTS_APP_MODAL_JAVASCRIPT_APP_MODAL_DIALOG_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/javascript_dialogs/javascript_dialog_views.cc ('k') | components/app_modal/javascript_app_modal_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698