Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 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. | |
| 4 | |
| 5 #ifndef IOS_WEB_VIEW_INTERNAL_WEB_VIEW_JAVA_SCRIPT_DIALOG_PRESENTER_H_ | |
| 6 #define IOS_WEB_VIEW_INTERNAL_WEB_VIEW_JAVA_SCRIPT_DIALOG_PRESENTER_H_ | |
| 7 | |
| 8 #import "base/ios/weak_nsobject.h" | |
| 9 #include "ios/web/public/java_script_dialog_presenter.h" | |
| 10 | |
| 11 @class CWVWebView; | |
| 12 @protocol CWVUIDelegate; | |
| 13 | |
| 14 namespace ios_web_view { | |
| 15 | |
| 16 // WebView implementation of JavaScriptDialogPresenter. Passes JavaScript alert | |
| 17 // handling to |ui_delegate_|. | |
| 18 class WebViewJavaScriptDialogPresenter : public web::JavaScriptDialogPresenter { | |
| 19 public: | |
| 20 WebViewJavaScriptDialogPresenter(CWVWebView* web_view, | |
| 21 id<CWVUIDelegate> ui_delegate); | |
| 22 ~WebViewJavaScriptDialogPresenter(); | |
| 23 | |
| 24 void SetUIDelegate(id<CWVUIDelegate> ui_delegate); | |
| 25 | |
| 26 // web::JavaScriptDialogPresenter overrides: | |
| 27 void RunJavaScriptDialog(web::WebState* web_state, | |
| 28 const GURL& origin_url, | |
| 29 web::JavaScriptDialogType dialog_type, | |
| 30 NSString* message_text, | |
| 31 NSString* default_prompt_text, | |
| 32 const web::DialogClosedCallback& callback) override; | |
| 33 void CancelDialogs(web::WebState* web_state) override; | |
| 34 | |
| 35 private: | |
| 36 // The underlying delegate handling the dialog UI. | |
| 37 base::WeakNSProtocol<id<CWVUIDelegate>> ui_delegate_; | |
| 38 // The web view which originated the dialogs. | |
| 39 base::WeakNSObject<CWVWebView> web_view_; | |
| 40 | |
| 41 // Display JavaScript alert. | |
|
Eugene But (OOO till 7-30)
2017/02/27 22:01:05
s/Display/Displays
Eugene But (OOO till 7-30)
2017/02/27 22:01:05
nit: Please place methods before ivars.
michaeldo
2017/02/27 23:39:15
Done.
| |
| 42 void HandleJavaScriptAlert(const GURL& origin_url, | |
| 43 NSString* message_text, | |
| 44 const web::DialogClosedCallback& callback); | |
| 45 | |
| 46 // Display JavaScript confirm dialog. | |
|
Eugene But (OOO till 7-30)
2017/02/27 22:01:05
s/Display/Displays
michaeldo
2017/02/27 23:39:15
Done.
| |
| 47 void HandleJavaScriptConfirmDialog(const GURL& origin_url, | |
| 48 NSString* message_text, | |
| 49 const web::DialogClosedCallback& callback); | |
| 50 | |
| 51 // Display JavaScript text prompt. | |
|
Eugene But (OOO till 7-30)
2017/02/27 22:01:05
s/Display/Displays
michaeldo
2017/02/27 23:39:15
Done.
| |
| 52 void HandleJavaScriptTextPrompt(const GURL& origin_url, | |
| 53 NSString* message_text, | |
| 54 NSString* default_prompt_text, | |
| 55 const web::DialogClosedCallback& callback); | |
| 56 | |
| 57 DISALLOW_COPY_AND_ASSIGN(WebViewJavaScriptDialogPresenter); | |
| 58 }; | |
| 59 | |
| 60 } // namespace ios_web_view | |
| 61 | |
| 62 #endif // IOS_WEB_VIEW_INTERNAL_WEB_VIEW_JAVA_SCRIPT_DIALOG_PRESENTER_H_ | |
| OLD | NEW |