Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1054)

Unified Diff: ios/web_view/internal/cwv_web_view.mm

Issue 2715343002: Add JavaScript prompts support to CWVUIDelegate. (Closed)
Patch Set: Respond to comments. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/web_view/internal/BUILD.gn ('k') | ios/web_view/internal/web_view_java_script_dialog_presenter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web_view/internal/cwv_web_view.mm
diff --git a/ios/web_view/internal/cwv_web_view.mm b/ios/web_view/internal/cwv_web_view.mm
index b23577bd180379f2f8ae9e66ffdd35d6412b4c0e..06a1af9c3f95db186a931df0736be356cc7394d9 100644
--- a/ios/web_view/internal/cwv_web_view.mm
+++ b/ios/web_view/internal/cwv_web_view.mm
@@ -22,6 +22,7 @@
#import "ios/web_view/internal/cwv_website_data_store_internal.h"
#import "ios/web_view/internal/translate/web_view_translate_client.h"
#include "ios/web_view/internal/web_view_browser_state.h"
+#import "ios/web_view/internal/web_view_java_script_dialog_presenter.h"
#import "ios/web_view/public/cwv_ui_delegate.h"
#import "ios/web_view/public/cwv_web_view_configuration.h"
#import "ios/web_view/public/cwv_web_view_delegate.h"
@@ -40,6 +41,9 @@
std::unique_ptr<web::WebStateDelegateBridge> _webStateDelegate;
std::unique_ptr<web::WebStateObserverBridge> _webStateObserver;
CGFloat _loadProgress;
+ // Handles presentation of JavaScript dialogs.
+ std::unique_ptr<ios_web_view::WebViewJavaScriptDialogPresenter>
+ _javaScriptDialogPresenter;
}
@end
@@ -66,6 +70,10 @@
_webStateDelegate = base::MakeUnique<web::WebStateDelegateBridge>(self);
_webState->SetDelegate(_webStateDelegate.get());
+ _javaScriptDialogPresenter =
+ base::MakeUnique<ios_web_view::WebViewJavaScriptDialogPresenter>(
+ self, _UIDelegate);
+
// Initialize Translate.
ios_web_view::WebViewTranslateClient::CreateForWebState(_webState.get());
}
@@ -155,6 +163,12 @@
translateClient->set_translate_delegate(translateDelegate);
}
+- (void)setUIDelegate:(id<CWVUIDelegate>)UIDelegate {
+ _UIDelegate = UIDelegate;
+
+ _javaScriptDialogPresenter->SetUIDelegate(_UIDelegate);
+}
+
- (void)notifyDidUpdateWithChanges:(CRIWVWebViewUpdateType)changes {
SEL selector = @selector(webView:didUpdateWithChanges:);
if ([_delegate respondsToSelector:selector]) {
@@ -210,4 +224,9 @@
return YES;
}
+- (web::JavaScriptDialogPresenter*)javaScriptDialogPresenterForWebState:
+ (web::WebState*)webState {
+ return _javaScriptDialogPresenter.get();
+}
+
@end
« no previous file with comments | « ios/web_view/internal/BUILD.gn ('k') | ios/web_view/internal/web_view_java_script_dialog_presenter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698