Chromium Code Reviews| Index: ios/web_view/internal/web_view_java_script_dialog_presenter.h |
| diff --git a/ios/web_view/internal/web_view_java_script_dialog_presenter.h b/ios/web_view/internal/web_view_java_script_dialog_presenter.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e9eb5883758d1aa4ae23a60b7266fb70ddf6520e |
| --- /dev/null |
| +++ b/ios/web_view/internal/web_view_java_script_dialog_presenter.h |
| @@ -0,0 +1,62 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef IOS_WEB_VIEW_INTERNAL_WEB_VIEW_JAVA_SCRIPT_DIALOG_PRESENTER_H_ |
| +#define IOS_WEB_VIEW_INTERNAL_WEB_VIEW_JAVA_SCRIPT_DIALOG_PRESENTER_H_ |
| + |
| +#import "base/ios/weak_nsobject.h" |
| +#include "ios/web/public/java_script_dialog_presenter.h" |
| + |
| +@class CWVWebView; |
| +@protocol CWVUIDelegate; |
| + |
| +namespace ios_web_view { |
| + |
| +// WebView implementation of JavaScriptDialogPresenter. Passes JavaScript alert |
| +// handling to |ui_delegate_|. |
| +class WebViewJavaScriptDialogPresenter : public web::JavaScriptDialogPresenter { |
| + public: |
| + WebViewJavaScriptDialogPresenter(CWVWebView* web_view, |
| + id<CWVUIDelegate> ui_delegate); |
| + ~WebViewJavaScriptDialogPresenter(); |
| + |
| + void SetUIDelegate(id<CWVUIDelegate> ui_delegate); |
| + |
| + // web::JavaScriptDialogPresenter overrides: |
| + void RunJavaScriptDialog(web::WebState* web_state, |
| + const GURL& origin_url, |
| + web::JavaScriptDialogType dialog_type, |
| + NSString* message_text, |
| + NSString* default_prompt_text, |
| + const web::DialogClosedCallback& callback) override; |
| + void CancelDialogs(web::WebState* web_state) override; |
| + |
| + private: |
| + // The underlying delegate handling the dialog UI. |
| + base::WeakNSProtocol<id<CWVUIDelegate>> ui_delegate_; |
| + // The web view which originated the dialogs. |
| + base::WeakNSObject<CWVWebView> web_view_; |
| + |
| + // 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.
|
| + void HandleJavaScriptAlert(const GURL& origin_url, |
| + NSString* message_text, |
| + const web::DialogClosedCallback& callback); |
| + |
| + // 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.
|
| + void HandleJavaScriptConfirmDialog(const GURL& origin_url, |
| + NSString* message_text, |
| + const web::DialogClosedCallback& callback); |
| + |
| + // 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.
|
| + void HandleJavaScriptTextPrompt(const GURL& origin_url, |
| + NSString* message_text, |
| + NSString* default_prompt_text, |
| + const web::DialogClosedCallback& callback); |
| + |
| + DISALLOW_COPY_AND_ASSIGN(WebViewJavaScriptDialogPresenter); |
| +}; |
| + |
| +} // namespace ios_web_view |
| + |
| +#endif // IOS_WEB_VIEW_INTERNAL_WEB_VIEW_JAVA_SCRIPT_DIALOG_PRESENTER_H_ |