OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_JAVASCRIPT_DIALOG_HELPER_H_ | 5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_JAVASCRIPT_DIALOG_HELPER_H_ |
6 #define EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_JAVASCRIPT_DIALOG_HELPER_H_ | 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_JAVASCRIPT_DIALOG_HELPER_H_ |
7 | 7 |
8 #include "content/public/browser/javascript_dialog_manager.h" | 8 #include "content/public/browser/javascript_dialog_manager.h" |
9 | 9 |
10 namespace extensions { | 10 namespace extensions { |
11 | 11 |
12 class WebViewGuest; | 12 class WebViewGuest; |
13 | 13 |
14 class JavaScriptDialogHelper : public content::JavaScriptDialogManager { | 14 class JavaScriptDialogHelper : public content::JavaScriptDialogManager { |
15 public: | 15 public: |
16 explicit JavaScriptDialogHelper(WebViewGuest* guest); | 16 explicit JavaScriptDialogHelper(WebViewGuest* guest); |
17 virtual ~JavaScriptDialogHelper(); | 17 ~JavaScriptDialogHelper() override; |
18 | 18 |
19 // JavaScriptDialogManager implementation. | 19 // JavaScriptDialogManager implementation. |
20 virtual void RunJavaScriptDialog( | 20 void RunJavaScriptDialog( |
21 content::WebContents* web_contents, | 21 content::WebContents* web_contents, |
22 const GURL& origin_url, | 22 const GURL& origin_url, |
23 const std::string& accept_lang, | 23 const std::string& accept_lang, |
24 content::JavaScriptMessageType javascript_message_type, | 24 content::JavaScriptMessageType javascript_message_type, |
25 const base::string16& message_text, | 25 const base::string16& message_text, |
26 const base::string16& default_prompt_text, | 26 const base::string16& default_prompt_text, |
27 const DialogClosedCallback& callback, | 27 const DialogClosedCallback& callback, |
28 bool* did_suppress_message) override; | 28 bool* did_suppress_message) override; |
29 virtual void RunBeforeUnloadDialog( | 29 void RunBeforeUnloadDialog(content::WebContents* web_contents, |
30 content::WebContents* web_contents, | 30 const base::string16& message_text, |
31 const base::string16& message_text, | 31 bool is_reload, |
32 bool is_reload, | 32 const DialogClosedCallback& callback) override; |
33 const DialogClosedCallback& callback) override; | 33 bool HandleJavaScriptDialog(content::WebContents* web_contents, |
34 virtual bool HandleJavaScriptDialog( | 34 bool accept, |
35 content::WebContents* web_contents, | 35 const base::string16* prompt_override) override; |
36 bool accept, | 36 void CancelActiveAndPendingDialogs( |
37 const base::string16* prompt_override) override; | |
38 virtual void CancelActiveAndPendingDialogs( | |
39 content::WebContents* web_contents) override; | 37 content::WebContents* web_contents) override; |
40 virtual void WebContentsDestroyed( | 38 void WebContentsDestroyed(content::WebContents* web_contents) override; |
41 content::WebContents* web_contents) override; | |
42 | 39 |
43 private: | 40 private: |
44 void OnPermissionResponse( | 41 void OnPermissionResponse( |
45 const DialogClosedCallback& callback, | 42 const DialogClosedCallback& callback, |
46 bool allow, | 43 bool allow, |
47 const std::string& user_input); | 44 const std::string& user_input); |
48 | 45 |
49 // Pointer to the webview that is being helped. | 46 // Pointer to the webview that is being helped. |
50 WebViewGuest* const web_view_guest_; | 47 WebViewGuest* const web_view_guest_; |
51 | 48 |
52 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogHelper); | 49 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogHelper); |
53 }; | 50 }; |
54 | 51 |
55 } // namespace extensions | 52 } // namespace extensions |
56 | 53 |
57 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_JAVASCRIPT_DIALOG_HELPER_H_ | 54 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_JAVASCRIPT_DIALOG_HELPER_H_ |
OLD | NEW |