Commit 62430eb9 authored by eugenebut's avatar eugenebut Committed by Commit bot

[ios] Removed deprecated methods from CRWWebUserInterfaceDelegate.

These methods are not implemented by Tab anymore.

BUG=661445

Review-Url: https://codereview.chromium.org/2616843004
Cr-Commit-Position: refs/heads/master@{#442013}
parent 1c3ab739
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
@class CRWWebController; @class CRWWebController;
class GURL;
// DEPRECATED, do not conform to this protocol and do not add any methods to it. // DEPRECATED, do not conform to this protocol and do not add any methods to it.
// Use web::WebStateDelegate instead. // Use web::WebStateDelegate instead.
...@@ -16,47 +15,6 @@ class GURL; ...@@ -16,47 +15,6 @@ class GURL;
@protocol CRWWebUserInterfaceDelegate<NSObject> @protocol CRWWebUserInterfaceDelegate<NSObject>
@optional @optional
// The JavaScript panel selectors below are only called by the web controller
// for builds with WKWebView enabled.
// Displays a JavaScript alert with an OK button, showing the provided message.
// |completionHandler| is called after the OK button on the alert is tapped.
// If this selector isn't implemented, the completion handler provided by the
// web view will be called without any UI displayed. If this method is
// implemented, but |completionHandler| is not called then
// NSInternalInconsistencyException will be thrown.
- (void)webController:(CRWWebController*)webController
runJavaScriptAlertPanelWithMessage:(NSString*)message
requestURL:(const GURL&)requestURL
completionHandler:(void (^)(void))completionHandler;
// Displays a JavaScript confirm alert with an OK and Cancel button, showing the
// provided message. |completionHandler| is called after a button is pressed,
// with |isConfirmed| indicating whether OK was pressed. If this selector isn't
// implemented, the completion handler provided by the web view will be called
// with |isConfirmed| = NO. If this method is implemented, but
// |completionHandler| is not called then NSInternalInconsistencyException will
// be thrown.
- (void)webController:(CRWWebController*)webController
runJavaScriptConfirmPanelWithMessage:(NSString*)message
requestURL:(const GURL&)requestURL
completionHandler:
(void (^)(BOOL isConfirmed))completionHandler;
// Displays a JavaScript input alert with an OK and Cancel button, showing the
// provided message and default text. |completionHandler| is called after a
// button is pressed. If the OK button is pressed, |input| contains the user
// text. If the cancel but is pressed, |input| will be nil. If this selector
// isn't implemented, the completion handler provided by the web view will be
// called with |input| = nil. If this method is implemented, but
// |completionHandler| is not called then NSInternalInconsistencyException will
// be thrown.
- (void)webController:(CRWWebController*)webController
runJavaScriptTextInputPanelWithPrompt:(NSString*)message
defaultText:(NSString*)defaultText
requestURL:(const GURL&)requestURL
completionHandler:
(void (^)(NSString* input))completionHandler;
// Displays an HTTP authentication dialog. |completionHandler| should be called // Displays an HTTP authentication dialog. |completionHandler| should be called
// with non-nil |username| and |password| if embedder wants to proceed with // with non-nil |username| and |password| if embedder wants to proceed with
......
...@@ -3872,6 +3872,13 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5; ...@@ -3872,6 +3872,13 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
message:(NSString*)message message:(NSString*)message
defaultText:(NSString*)defaultText defaultText:(NSString*)defaultText
completion:(void (^)(BOOL, NSString*))completionHandler { completion:(void (^)(BOOL, NSString*))completionHandler {
DCHECK(completionHandler);
if (self.shouldSuppressDialogs) {
[self didSuppressDialog];
completionHandler(NO, nil);
return;
}
self.webStateImpl->RunJavaScriptDialog( self.webStateImpl->RunJavaScriptDialog(
net::GURLWithNSURL(frame.request.URL), type, message, defaultText, net::GURLWithNSURL(frame.request.URL), type, message, defaultText,
base::BindBlock(^(bool success, NSString* input) { base::BindBlock(^(bool success, NSString* input) {
...@@ -4947,30 +4954,13 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5; ...@@ -4947,30 +4954,13 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
runJavaScriptAlertPanelWithMessage:(NSString*)message runJavaScriptAlertPanelWithMessage:(NSString*)message
initiatedByFrame:(WKFrameInfo*)frame initiatedByFrame:(WKFrameInfo*)frame
completionHandler:(void (^)())completionHandler { completionHandler:(void (^)())completionHandler {
if (self.shouldSuppressDialogs) { [self runJavaScriptDialogOfType:web::JAVASCRIPT_DIALOG_TYPE_ALERT
[self didSuppressDialog]; initiatedByFrame:frame
completionHandler(); message:message
return; defaultText:nil
} completion:^(BOOL, NSString*) {
completionHandler();
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();
}];
}
} }
- (void)webView:(WKWebView*)webView - (void)webView:(WKWebView*)webView
...@@ -4978,33 +4968,15 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5; ...@@ -4978,33 +4968,15 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
initiatedByFrame:(WKFrameInfo*)frame initiatedByFrame:(WKFrameInfo*)frame
completionHandler: completionHandler:
(void (^)(BOOL result))completionHandler { (void (^)(BOOL result))completionHandler {
if (self.shouldSuppressDialogs) { [self runJavaScriptDialogOfType:web::JAVASCRIPT_DIALOG_TYPE_CONFIRM
[self didSuppressDialog]; initiatedByFrame:frame
completionHandler(NO); message:message
return; defaultText:nil
} completion:^(BOOL success, NSString*) {
if (completionHandler) {
SEL confirmationSelector = @selector(webController: completionHandler(success);
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);
}
}];
}
} }
- (void)webView:(WKWebView*)webView - (void)webView:(WKWebView*)webView
...@@ -5021,35 +4993,15 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5; ...@@ -5021,35 +4993,15 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
return; return;
} }
if (self.shouldSuppressDialogs) { [self runJavaScriptDialogOfType:web::JAVASCRIPT_DIALOG_TYPE_PROMPT
[self didSuppressDialog]; initiatedByFrame:frame
completionHandler(nil); message:prompt
return; defaultText:defaultText
} completion:^(BOOL, NSString* input) {
if (completionHandler) {
SEL textInputSelector = @selector(webController: completionHandler(input);
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);
}
}];
}
} }
#pragma mark - #pragma mark -
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment