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

Side by Side Diff: content/public/browser/javascript_dialog_manager.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
« no previous file with comments | « content/common/frame_messages.h ('k') | content/public/common/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 CONTENT_PUBLIC_BROWSER_JAVASCRIPT_DIALOG_MANAGER_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_JAVASCRIPT_DIALOG_MANAGER_H_
6 #define CONTENT_PUBLIC_BROWSER_JAVASCRIPT_DIALOG_MANAGER_H_ 6 #define CONTENT_PUBLIC_BROWSER_JAVASCRIPT_DIALOG_MANAGER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
12 #include "content/common/content_export.h" 12 #include "content/common/content_export.h"
13 #include "content/public/common/javascript_message_type.h" 13 #include "content/public/common/javascript_dialog_type.h"
14 #include "ui/gfx/native_widget_types.h" 14 #include "ui/gfx/native_widget_types.h"
15 #include "url/gurl.h" 15 #include "url/gurl.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 class WebContents; 19 class WebContents;
20 20
21 // An interface consisting of methods that can be called to produce and manage 21 // An interface consisting of methods that can be called to produce and manage
22 // JavaScript dialogs. 22 // JavaScript dialogs.
23 class CONTENT_EXPORT JavaScriptDialogManager { 23 class CONTENT_EXPORT JavaScriptDialogManager {
24 public: 24 public:
25 typedef base::Callback<void(bool /* success */, 25 typedef base::Callback<void(bool /* success */,
26 const base::string16& /* user_input */)> 26 const base::string16& /* user_input */)>
27 DialogClosedCallback; 27 DialogClosedCallback;
28 28
29 // Displays a JavaScript dialog. |did_suppress_message| will not be nil; if 29 // Displays a JavaScript dialog. |did_suppress_message| will not be nil; if
30 // |true| is returned in it, the caller will handle faking the reply. 30 // |true| is returned in it, the caller will handle faking the reply.
31 virtual void RunJavaScriptDialog( 31 virtual void RunJavaScriptDialog(WebContents* web_contents,
32 WebContents* web_contents, 32 const GURL& origin_url,
33 const GURL& origin_url, 33 JavaScriptDialogType dialog_type,
34 JavaScriptMessageType javascript_message_type, 34 const base::string16& message_text,
35 const base::string16& message_text, 35 const base::string16& default_prompt_text,
36 const base::string16& default_prompt_text, 36 const DialogClosedCallback& callback,
37 const DialogClosedCallback& callback, 37 bool* did_suppress_message) = 0;
38 bool* did_suppress_message) = 0;
39 38
40 // Displays a dialog asking the user if they want to leave a page. 39 // Displays a dialog asking the user if they want to leave a page.
41 virtual void RunBeforeUnloadDialog(WebContents* web_contents, 40 virtual void RunBeforeUnloadDialog(WebContents* web_contents,
42 bool is_reload, 41 bool is_reload,
43 const DialogClosedCallback& callback) = 0; 42 const DialogClosedCallback& callback) = 0;
44 43
45 // Accepts or dismisses the active JavaScript dialog, which must be owned 44 // Accepts or dismisses the active JavaScript dialog, which must be owned
46 // by the given |web_contents|. If |prompt_override| is not null, the prompt 45 // by the given |web_contents|. If |prompt_override| is not null, the prompt
47 // text of the dialog should be set before accepting. Returns true if the 46 // text of the dialog should be set before accepting. Returns true if the
48 // dialog was handled. 47 // dialog was handled.
49 virtual bool HandleJavaScriptDialog(WebContents* web_contents, 48 virtual bool HandleJavaScriptDialog(WebContents* web_contents,
50 bool accept, 49 bool accept,
51 const base::string16* prompt_override); 50 const base::string16* prompt_override);
52 51
53 // Cancels all active and pending dialogs for the given WebContents. If 52 // Cancels all active and pending dialogs for the given WebContents. If
54 // |reset_state| is true, resets any saved state tied to |web_contents|. 53 // |reset_state| is true, resets any saved state tied to |web_contents|.
55 virtual void CancelDialogs(WebContents* web_contents, 54 virtual void CancelDialogs(WebContents* web_contents,
56 bool reset_state) = 0; 55 bool reset_state) = 0;
57 56
58 virtual ~JavaScriptDialogManager() {} 57 virtual ~JavaScriptDialogManager() {}
59 }; 58 };
60 59
61 } // namespace content 60 } // namespace content
62 61
63 #endif // CONTENT_PUBLIC_BROWSER_JAVASCRIPT_DIALOG_MANAGER_H_ 62 #endif // CONTENT_PUBLIC_BROWSER_JAVASCRIPT_DIALOG_MANAGER_H_
OLDNEW
« no previous file with comments | « content/common/frame_messages.h ('k') | content/public/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698