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