| 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 virtual ~JavaScriptDialogHelper(); |
| 18 | 18 |
| 19 // JavaScriptDialogManager implementation. | 19 // JavaScriptDialogManager implementation. |
| 20 virtual void RunJavaScriptDialog( | 20 virtual 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 virtual void RunBeforeUnloadDialog( |
| 30 content::WebContents* web_contents, | 30 content::WebContents* web_contents, |
| 31 const base::string16& message_text, | 31 const base::string16& message_text, |
| 32 bool is_reload, | 32 bool is_reload, |
| 33 const DialogClosedCallback& callback) OVERRIDE; | 33 const DialogClosedCallback& callback) override; |
| 34 virtual bool HandleJavaScriptDialog( | 34 virtual bool HandleJavaScriptDialog( |
| 35 content::WebContents* web_contents, | 35 content::WebContents* web_contents, |
| 36 bool accept, | 36 bool accept, |
| 37 const base::string16* prompt_override) OVERRIDE; | 37 const base::string16* prompt_override) override; |
| 38 virtual void CancelActiveAndPendingDialogs( | 38 virtual void CancelActiveAndPendingDialogs( |
| 39 content::WebContents* web_contents) OVERRIDE; | 39 content::WebContents* web_contents) override; |
| 40 virtual void WebContentsDestroyed( | 40 virtual void WebContentsDestroyed( |
| 41 content::WebContents* web_contents) OVERRIDE; | 41 content::WebContents* web_contents) override; |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 void OnPermissionResponse( | 44 void OnPermissionResponse( |
| 45 const DialogClosedCallback& callback, | 45 const DialogClosedCallback& callback, |
| 46 bool allow, | 46 bool allow, |
| 47 const std::string& user_input); | 47 const std::string& user_input); |
| 48 | 48 |
| 49 // Pointer to the webview that is being helped. | 49 // Pointer to the webview that is being helped. |
| 50 WebViewGuest* const web_view_guest_; | 50 WebViewGuest* const web_view_guest_; |
| 51 | 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogHelper); | 52 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogHelper); |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 } // namespace extensions | 55 } // namespace extensions |
| 56 | 56 |
| 57 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_JAVASCRIPT_DIALOG_HELPER_H_ | 57 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_JAVASCRIPT_DIALOG_HELPER_H_ |
| OLD | NEW |