1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_SHELL_BROWSER_SHELL_JAVASCRIPT_DIALOG_MANAGER_H_
6 #define CONTENT_SHELL_BROWSER_SHELL_JAVASCRIPT_DIALOG_MANAGER_H_
8 #include "base/callback_forward.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "content/public/browser/javascript_dialog_manager.h"
15 class ShellJavaScriptDialog
;
17 class ShellJavaScriptDialogManager
: public JavaScriptDialogManager
{
19 ShellJavaScriptDialogManager();
20 ~ShellJavaScriptDialogManager() override
;
22 // JavaScriptDialogManager:
23 void RunJavaScriptDialog(WebContents
* web_contents
,
24 const GURL
& origin_url
,
25 const std::string
& accept_lang
,
26 JavaScriptMessageType javascript_message_type
,
27 const base::string16
& message_text
,
28 const base::string16
& default_prompt_text
,
29 const DialogClosedCallback
& callback
,
30 bool* did_suppress_message
) override
;
32 void RunBeforeUnloadDialog(WebContents
* web_contents
,
33 const base::string16
& message_text
,
35 const DialogClosedCallback
& callback
) override
;
37 void CancelActiveAndPendingDialogs(WebContents
* web_contents
) override
;
39 void ResetDialogState(WebContents
* web_contents
) override
;
41 // Called by the ShellJavaScriptDialog when it closes.
42 void DialogClosed(ShellJavaScriptDialog
* dialog
);
44 // Used for content_browsertests.
45 void set_dialog_request_callback(const base::Closure
& callback
) {
46 dialog_request_callback_
= callback
;
50 #if defined(OS_MACOSX) || defined(OS_WIN)
51 // The dialog being shown. No queueing.
52 scoped_ptr
<ShellJavaScriptDialog
> dialog_
;
54 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if
57 base::Closure dialog_request_callback_
;
59 DISALLOW_COPY_AND_ASSIGN(ShellJavaScriptDialogManager
);
62 } // namespace content
64 #endif // CONTENT_SHELL_BROWSER_SHELL_JAVASCRIPT_DIALOG_MANAGER_H_