Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / extensions / browser / guest_view / web_view / javascript_dialog_helper.h
blobd9ceee90eb1d81168f6730c2e4b8b7f759f9ae47
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 {
12 class WebViewGuest;
14 class JavaScriptDialogHelper : public content::JavaScriptDialogManager {
15 public:
16 explicit JavaScriptDialogHelper(WebViewGuest* guest);
17 virtual ~JavaScriptDialogHelper();
19 // JavaScriptDialogManager implementation.
20 virtual 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 virtual void RunBeforeUnloadDialog(
30 content::WebContents* web_contents,
31 const base::string16& message_text,
32 bool is_reload,
33 const DialogClosedCallback& callback) OVERRIDE;
34 virtual bool HandleJavaScriptDialog(
35 content::WebContents* web_contents,
36 bool accept,
37 const base::string16* prompt_override) OVERRIDE;
38 virtual void CancelActiveAndPendingDialogs(
39 content::WebContents* web_contents) OVERRIDE;
40 virtual void WebContentsDestroyed(
41 content::WebContents* web_contents) OVERRIDE;
43 private:
44 void OnPermissionResponse(
45 const DialogClosedCallback& callback,
46 bool allow,
47 const std::string& user_input);
49 // Pointer to the webview that is being helped.
50 WebViewGuest* const web_view_guest_;
52 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogHelper);
55 } // namespace extensions
57 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_JAVASCRIPT_DIALOG_HELPER_H_