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

Unified Diff: ios/web/web_state/ui/crw_web_controller.mm

Issue 2616843004: [ios] Removed deprecated methods from CRWWebUserInterfaceDelegate. (Closed)
Patch Set: Created 3 years, 11 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/public/web_state/crw_web_user_interface_delegate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/web_state/ui/crw_web_controller.mm
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm
index 7aabe25b46fa8d25f587af1601e3c41b2fee629c..4a5c7e84d0fb635f9504cfe5098f3112861f3f41 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -3872,6 +3872,13 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
message:(NSString*)message
defaultText:(NSString*)defaultText
completion:(void (^)(BOOL, NSString*))completionHandler {
+ DCHECK(completionHandler);
+ if (self.shouldSuppressDialogs) {
+ [self didSuppressDialog];
+ completionHandler(NO, nil);
+ return;
+ }
+
self.webStateImpl->RunJavaScriptDialog(
net::GURLWithNSURL(frame.request.URL), type, message, defaultText,
base::BindBlock(^(bool success, NSString* input) {
@@ -4947,30 +4954,13 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
runJavaScriptAlertPanelWithMessage:(NSString*)message
initiatedByFrame:(WKFrameInfo*)frame
completionHandler:(void (^)())completionHandler {
- if (self.shouldSuppressDialogs) {
- [self didSuppressDialog];
- completionHandler();
- return;
- }
-
- SEL alertSelector = @selector(webController:
- runJavaScriptAlertPanelWithMessage:
- requestURL:
- completionHandler:);
- if ([self.UIDelegate respondsToSelector:alertSelector]) {
- [self.UIDelegate webController:self
- runJavaScriptAlertPanelWithMessage:message
- requestURL:net::GURLWithNSURL(frame.request.URL)
- completionHandler:completionHandler];
- } else {
- [self runJavaScriptDialogOfType:web::JAVASCRIPT_DIALOG_TYPE_ALERT
- initiatedByFrame:frame
- message:message
- defaultText:nil
- completion:^(BOOL, NSString*) {
- completionHandler();
- }];
- }
+ [self runJavaScriptDialogOfType:web::JAVASCRIPT_DIALOG_TYPE_ALERT
+ initiatedByFrame:frame
+ message:message
+ defaultText:nil
+ completion:^(BOOL, NSString*) {
+ completionHandler();
+ }];
}
- (void)webView:(WKWebView*)webView
@@ -4978,33 +4968,15 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
initiatedByFrame:(WKFrameInfo*)frame
completionHandler:
(void (^)(BOOL result))completionHandler {
- if (self.shouldSuppressDialogs) {
- [self didSuppressDialog];
- completionHandler(NO);
- return;
- }
-
- SEL confirmationSelector = @selector(webController:
- runJavaScriptConfirmPanelWithMessage:
- requestURL:
- completionHandler:);
- if ([self.UIDelegate respondsToSelector:confirmationSelector]) {
- [self.UIDelegate webController:self
- runJavaScriptConfirmPanelWithMessage:message
- requestURL:net::GURLWithNSURL(
- frame.request.URL)
- completionHandler:completionHandler];
- } else {
- [self runJavaScriptDialogOfType:web::JAVASCRIPT_DIALOG_TYPE_CONFIRM
- initiatedByFrame:frame
- message:message
- defaultText:nil
- completion:^(BOOL success, NSString*) {
- if (completionHandler) {
- completionHandler(success);
- }
- }];
- }
+ [self runJavaScriptDialogOfType:web::JAVASCRIPT_DIALOG_TYPE_CONFIRM
+ initiatedByFrame:frame
+ message:message
+ defaultText:nil
+ completion:^(BOOL success, NSString*) {
+ if (completionHandler) {
+ completionHandler(success);
+ }
+ }];
}
- (void)webView:(WKWebView*)webView
@@ -5021,35 +4993,15 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
return;
}
- if (self.shouldSuppressDialogs) {
- [self didSuppressDialog];
- completionHandler(nil);
- return;
- }
-
- SEL textInputSelector = @selector(webController:
- runJavaScriptTextInputPanelWithPrompt:
- defaultText:
- requestURL:
- completionHandler:);
- if ([self.UIDelegate respondsToSelector:textInputSelector]) {
- GURL requestURL = net::GURLWithNSURL(frame.request.URL);
- [self.UIDelegate webController:self
- runJavaScriptTextInputPanelWithPrompt:prompt
- defaultText:defaultText
- requestURL:requestURL
- completionHandler:completionHandler];
- } else {
- [self runJavaScriptDialogOfType:web::JAVASCRIPT_DIALOG_TYPE_PROMPT
- initiatedByFrame:frame
- message:prompt
- defaultText:defaultText
- completion:^(BOOL, NSString* input) {
- if (completionHandler) {
- completionHandler(input);
- }
- }];
- }
+ [self runJavaScriptDialogOfType:web::JAVASCRIPT_DIALOG_TYPE_PROMPT
+ initiatedByFrame:frame
+ message:prompt
+ defaultText:defaultText
+ completion:^(BOOL, NSString* input) {
+ if (completionHandler) {
+ completionHandler(input);
+ }
+ }];
}
#pragma mark -
« no previous file with comments | « ios/web/public/web_state/crw_web_user_interface_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698