1 // Copyright 2014 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 EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_JAVASCRIPT_DIALOG_HELPER_H_
6 #define EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_JAVASCRIPT_DIALOG_HELPER_H_
8 #include "content/public/browser/javascript_dialog_manager.h"
10 namespace extensions
{
14 class JavaScriptDialogHelper
: public content::JavaScriptDialogManager
{
16 explicit JavaScriptDialogHelper(WebViewGuest
* guest
);
17 ~JavaScriptDialogHelper() override
;
19 // JavaScriptDialogManager implementation.
20 void RunJavaScriptDialog(
21 content::WebContents
* web_contents
,
22 const GURL
& origin_url
,
23 const std::string
& accept_lang
,
24 content::JavaScriptMessageType javascript_message_type
,
25 const base::string16
& message_text
,
26 const base::string16
& default_prompt_text
,
27 const DialogClosedCallback
& callback
,
28 bool* did_suppress_message
) override
;
29 void RunBeforeUnloadDialog(content::WebContents
* web_contents
,
30 const base::string16
& message_text
,
32 const DialogClosedCallback
& callback
) override
;
33 bool HandleJavaScriptDialog(content::WebContents
* web_contents
,
35 const base::string16
* prompt_override
) override
;
36 void CancelActiveAndPendingDialogs(
37 content::WebContents
* web_contents
) override
;
38 void ResetDialogState(content::WebContents
* web_contents
) override
;
41 void OnPermissionResponse(
42 const DialogClosedCallback
& callback
,
44 const std::string
& user_input
);
46 // Pointer to the webview that is being helped.
47 WebViewGuest
* const web_view_guest_
;
49 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogHelper
);
52 } // namespace extensions
54 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_JAVASCRIPT_DIALOG_HELPER_H_