Commit b736d2bf authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

[iOS][web] Format CRWWebController

This CL format CRWWebController, cleaning up the pragma, make sure that
the pragma for protocol are correctly named.
It also removes the UIGestureRecognizerDelegate protocol which wasn't
used and unnecessary synthesizes.

Bug: 938255
Change-Id: I7e24a1b6545bd16cad22d93841bbb8701cc670e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1503433Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#638076}
parent 4f09c145
...@@ -56,8 +56,7 @@ class WebStateImpl; ...@@ -56,8 +56,7 @@ class WebStateImpl;
// TODO(stuartmorgan): Move all of the navigation APIs out of this class. // TODO(stuartmorgan): Move all of the navigation APIs out of this class.
@interface CRWWebController : NSObject <CRWJSInjectionEvaluator, @interface CRWWebController : NSObject <CRWJSInjectionEvaluator,
CRWSessionControllerDelegate, CRWSessionControllerDelegate,
CRWTouchTrackingDelegate, CRWTouchTrackingDelegate>
UIGestureRecognizerDelegate>
// Whether or not a UIWebView is allowed to exist in this CRWWebController. // Whether or not a UIWebView is allowed to exist in this CRWWebController.
// Defaults to NO; this should be enabled before attempting to access the view. // Defaults to NO; this should be enabled before attempting to access the view.
......
...@@ -222,12 +222,6 @@ const CertVerificationErrorsCacheType::size_type kMaxCertErrorsCount = 100; ...@@ -222,12 +222,6 @@ const CertVerificationErrorsCacheType::size_type kMaxCertErrorsCount = 100;
@end @end
@implementation CRWWebControllerPendingNavigationInfo @implementation CRWWebControllerPendingNavigationInfo
@synthesize referrer = _referrer;
@synthesize MIMEType = _MIMEType;
@synthesize navigationType = _navigationType;
@synthesize HTTPMethod = _HTTPMethod;
@synthesize cancelled = _cancelled;
@synthesize hasUserGesture = _hasUserGesture;
- (instancetype)init { - (instancetype)init {
if ((self = [super init])) { if ((self = [super init])) {
...@@ -922,16 +916,6 @@ GURL URLEscapedForHistory(const GURL& url) { ...@@ -922,16 +916,6 @@ GURL URLEscapedForHistory(const GURL& url) {
@implementation CRWWebController @implementation CRWWebController
@synthesize webUsageEnabled = _webUsageEnabled;
@synthesize loadPhase = _loadPhase;
@synthesize webProcessCrashed = _webProcessCrashed;
@synthesize visible = _visible;
@synthesize nativeProvider = _nativeProvider;
@synthesize swipeRecognizerProvider = _swipeRecognizerProvider;
@synthesize webViewProxy = _webViewProxy;
@synthesize allowsBackForwardNavigationGestures =
_allowsBackForwardNavigationGestures;
- (instancetype)initWithWebState:(WebStateImpl*)webState { - (instancetype)initWithWebState:(WebStateImpl*)webState {
self = [super init]; self = [super init];
if (self) { if (self) {
...@@ -1032,11 +1016,6 @@ GURL URLEscapedForHistory(const GURL& url) { ...@@ -1032,11 +1016,6 @@ GURL URLEscapedForHistory(const GURL& url) {
}; };
} }
// NativeControllerDelegate method, called to inform that title has changed.
- (void)nativeContent:(id)content titleDidChange:(NSString*)title {
[self setNavigationItemTitle:title];
}
- (void)setNativeControllerWebUsageEnabled:(BOOL)webUsageEnabled { - (void)setNativeControllerWebUsageEnabled:(BOOL)webUsageEnabled {
if ([self.nativeController if ([self.nativeController
respondsToSelector:@selector(setWebUsageEnabled:)]) { respondsToSelector:@selector(setWebUsageEnabled:)]) {
...@@ -2449,8 +2428,7 @@ GURL URLEscapedForHistory(const GURL& url) { ...@@ -2449,8 +2428,7 @@ GURL URLEscapedForHistory(const GURL& url) {
}); });
} }
#pragma mark - #pragma mark - CRWWebControllerContainerViewDelegate
#pragma mark CRWWebControllerContainerViewDelegate
- (CRWWebViewProxyImpl*)contentViewProxyForContainerView: - (CRWWebViewProxyImpl*)contentViewProxyForContainerView:
(CRWWebControllerContainerView*)containerView { (CRWWebControllerContainerView*)containerView {
...@@ -2462,8 +2440,7 @@ GURL URLEscapedForHistory(const GURL& url) { ...@@ -2462,8 +2440,7 @@ GURL URLEscapedForHistory(const GURL& url) {
return [self.nativeProvider nativeContentInsetForWebState:self.webState]; return [self.nativeProvider nativeContentInsetForWebState:self.webState];
} }
#pragma mark - #pragma mark - CRWJSInjectionEvaluator Methods
#pragma mark CRWJSInjectionEvaluator Methods
- (void)executeJavaScript:(NSString*)script - (void)executeJavaScript:(NSString*)script
completionHandler:(web::JavaScriptResultBlock)completionHandler { completionHandler:(web::JavaScriptResultBlock)completionHandler {
...@@ -2652,8 +2629,7 @@ GURL URLEscapedForHistory(const GURL& url) { ...@@ -2652,8 +2629,7 @@ GURL URLEscapedForHistory(const GURL& url) {
senderFrame:senderFrame]; senderFrame:senderFrame];
} }
#pragma mark - #pragma mark - Web frames management
#pragma mark Web frames management
- (void)frameBecameAvailableWithMessage:(WKScriptMessage*)message { - (void)frameBecameAvailableWithMessage:(WKScriptMessage*)message {
// Validate all expected message components because any frame could falsify // Validate all expected message components because any frame could falsify
...@@ -2727,8 +2703,7 @@ GURL URLEscapedForHistory(const GURL& url) { ...@@ -2727,8 +2703,7 @@ GURL URLEscapedForHistory(const GURL& url) {
framesManager->RemoveAllWebFrames(); framesManager->RemoveAllWebFrames();
} }
#pragma mark - #pragma mark - JavaScript message handlers
#pragma mark JavaScript message handlers
- (BOOL)handleChromeSendMessage:(base::DictionaryValue*)message - (BOOL)handleChromeSendMessage:(base::DictionaryValue*)message
context:(NSDictionary*)context { context:(NSDictionary*)context {
...@@ -3373,8 +3348,7 @@ GURL URLEscapedForHistory(const GURL& url) { ...@@ -3373,8 +3348,7 @@ GURL URLEscapedForHistory(const GURL& url) {
transition); transition);
} }
#pragma mark - #pragma mark - WebUI
#pragma mark WebUI
- (void)createWebUIForURL:(const GURL&)URL { - (void)createWebUIForURL:(const GURL&)URL {
// |CreateWebUI| will do nothing if |URL| is not a WebUI URL and then // |CreateWebUI| will do nothing if |URL| is not a WebUI URL and then
...@@ -3391,8 +3365,7 @@ GURL URLEscapedForHistory(const GURL& url) { ...@@ -3391,8 +3365,7 @@ GURL URLEscapedForHistory(const GURL& url) {
_webUIManager = nil; _webUIManager = nil;
} }
#pragma mark - #pragma mark - Auth Challenge
#pragma mark Auth Challenge
- (void)processAuthChallenge:(NSURLAuthenticationChallenge*)challenge - (void)processAuthChallenge:(NSURLAuthenticationChallenge*)challenge
forCertAcceptPolicy:(web::CertAcceptPolicy)policy forCertAcceptPolicy:(web::CertAcceptPolicy)policy
...@@ -3469,8 +3442,7 @@ GURL URLEscapedForHistory(const GURL& url) { ...@@ -3469,8 +3442,7 @@ GURL URLEscapedForHistory(const GURL& url) {
persistence:NSURLCredentialPersistenceForSession]); persistence:NSURLCredentialPersistenceForSession]);
} }
#pragma mark - #pragma mark - JavaScript Dialog
#pragma mark JavaScript Dialog
- (void)runJavaScriptDialogOfType:(web::JavaScriptDialogType)type - (void)runJavaScriptDialogOfType:(web::JavaScriptDialogType)type
initiatedByFrame:(WKFrameInfo*)frame initiatedByFrame:(WKFrameInfo*)frame
...@@ -3494,8 +3466,7 @@ GURL URLEscapedForHistory(const GURL& url) { ...@@ -3494,8 +3466,7 @@ GURL URLEscapedForHistory(const GURL& url) {
})); }));
} }
#pragma mark - #pragma mark - CRWTouchTrackingDelegate
#pragma mark TouchTracking
- (void)touched:(BOOL)touched { - (void)touched:(BOOL)touched {
_clickInProgress = touched; _clickInProgress = touched;
...@@ -3547,8 +3518,7 @@ GURL URLEscapedForHistory(const GURL& url) { ...@@ -3547,8 +3518,7 @@ GURL URLEscapedForHistory(const GURL& url) {
kMaximumDelayForUserInteractionInSeconds); kMaximumDelayForUserInteractionInSeconds);
} }
#pragma mark - #pragma mark - Session Information
#pragma mark Session Information
- (CRWSessionController*)sessionController { - (CRWSessionController*)sessionController {
NavigationManagerImpl* navigationManager = self.navigationManagerImpl; NavigationManagerImpl* navigationManager = self.navigationManagerImpl;
...@@ -3591,8 +3561,7 @@ GURL URLEscapedForHistory(const GURL& url) { ...@@ -3591,8 +3561,7 @@ GURL URLEscapedForHistory(const GURL& url) {
[_navigationStates removeNavigation:navigation]; [_navigationStates removeNavigation:navigation];
} }
#pragma mark - #pragma mark - CRWWebViewScrollViewProxyObserver
#pragma mark CRWWebViewScrollViewProxyObserver
- (void)webViewScrollViewDidZoom: - (void)webViewScrollViewDidZoom:
(CRWWebViewScrollViewProxy*)webViewScrollViewProxy { (CRWWebViewScrollViewProxy*)webViewScrollViewProxy {
...@@ -3634,9 +3603,6 @@ GURL URLEscapedForHistory(const GURL& url) { ...@@ -3634,9 +3603,6 @@ GURL URLEscapedForHistory(const GURL& url) {
} }
} }
#pragma mark -
#pragma mark CRWWebViewScrollViewProxyObserver
// Under WKWebView, JavaScript can execute asynchronously. User can start // Under WKWebView, JavaScript can execute asynchronously. User can start
// scrolling and calls to window.scrollTo executed during scrolling will be // scrolling and calls to window.scrollTo executed during scrolling will be
// treated as "during user interaction" and can cause app to go fullscreen. // treated as "during user interaction" and can cause app to go fullscreen.
...@@ -3655,8 +3621,7 @@ GURL URLEscapedForHistory(const GURL& url) { ...@@ -3655,8 +3621,7 @@ GURL URLEscapedForHistory(const GURL& url) {
completionHandler:nil]; completionHandler:nil];
} }
#pragma mark - #pragma mark - Page State
#pragma mark Page State
- (void)recordStateInHistory { - (void)recordStateInHistory {
// Only record the state if: // Only record the state if:
...@@ -3873,8 +3838,7 @@ GURL URLEscapedForHistory(const GURL& url) { ...@@ -3873,8 +3838,7 @@ GURL URLEscapedForHistory(const GURL& url) {
} }
} }
#pragma mark - #pragma mark - Fullscreen
#pragma mark Fullscreen
- (void)optOutScrollsToTopForSubviews { - (void)optOutScrollsToTopForSubviews {
NSMutableArray* stack = NSMutableArray* stack =
...@@ -3888,8 +3852,7 @@ GURL URLEscapedForHistory(const GURL& url) { ...@@ -3888,8 +3852,7 @@ GURL URLEscapedForHistory(const GURL& url) {
} }
} }
#pragma mark - #pragma mark - WebDelegate Calls
#pragma mark WebDelegate Calls
- (BOOL)isMainFrameNavigationAction:(WKNavigationAction*)action { - (BOOL)isMainFrameNavigationAction:(WKNavigationAction*)action {
if (action.targetFrame) { if (action.targetFrame) {
...@@ -4334,8 +4297,7 @@ GURL URLEscapedForHistory(const GURL& url) { ...@@ -4334,8 +4297,7 @@ GURL URLEscapedForHistory(const GURL& url) {
} }
} }
#pragma mark - #pragma mark - WKUIDelegate Methods
#pragma mark WKUIDelegate Methods
- (WKWebView*)webView:(WKWebView*)webView - (WKWebView*)webView:(WKWebView*)webView
createWebViewWithConfiguration:(WKWebViewConfiguration*)configuration createWebViewWithConfiguration:(WKWebViewConfiguration*)configuration
...@@ -4474,8 +4436,7 @@ GURL URLEscapedForHistory(const GURL& url) { ...@@ -4474,8 +4436,7 @@ GURL URLEscapedForHistory(const GURL& url) {
previewingViewController); previewingViewController);
} }
#pragma mark - #pragma mark - WKNavigationDelegate Methods
#pragma mark WKNavigationDelegate Methods
- (void)webView:(WKWebView*)webView - (void)webView:(WKWebView*)webView
decidePolicyForNavigationAction:(WKNavigationAction*)action decidePolicyForNavigationAction:(WKNavigationAction*)action
...@@ -5476,8 +5437,7 @@ GURL URLEscapedForHistory(const GURL& url) { ...@@ -5476,8 +5437,7 @@ GURL URLEscapedForHistory(const GURL& url) {
[self webViewWebProcessDidCrash]; [self webViewWebProcessDidCrash];
} }
#pragma mark - #pragma mark - CRWSSLStatusUpdaterDataSource
#pragma mark CRWSSLStatusUpdater DataSource/Delegate Methods
- (void)SSLStatusUpdater:(CRWSSLStatusUpdater*)SSLStatusUpdater - (void)SSLStatusUpdater:(CRWSSLStatusUpdater*)SSLStatusUpdater
querySSLStatusForTrust:(base::ScopedCFTypeRef<SecTrustRef>)trust querySSLStatusForTrust:(base::ScopedCFTypeRef<SecTrustRef>)trust
...@@ -5488,6 +5448,8 @@ GURL URLEscapedForHistory(const GURL& url) { ...@@ -5488,6 +5448,8 @@ GURL URLEscapedForHistory(const GURL& url) {
completionHandler:completionHandler]; completionHandler:completionHandler];
} }
#pragma mark - CRWSSLStatusUpdaterDelegate
- (void)SSLStatusUpdater:(CRWSSLStatusUpdater*)SSLStatusUpdater - (void)SSLStatusUpdater:(CRWSSLStatusUpdater*)SSLStatusUpdater
didChangeSSLStatusForNavigationItem:(web::NavigationItem*)navigationItem { didChangeSSLStatusForNavigationItem:(web::NavigationItem*)navigationItem {
web::NavigationItem* visibleItem = web::NavigationItem* visibleItem =
...@@ -5496,8 +5458,7 @@ GURL URLEscapedForHistory(const GURL& url) { ...@@ -5496,8 +5458,7 @@ GURL URLEscapedForHistory(const GURL& url) {
_webStateImpl->DidChangeVisibleSecurityState(); _webStateImpl->DidChangeVisibleSecurityState();
} }
#pragma mark - #pragma mark - CRWContextMenuDelegate methods
#pragma mark CRWWebContextMenuControllerDelegate methods
- (void)webView:(WKWebView*)webView - (void)webView:(WKWebView*)webView
handleContextMenu:(const web::ContextMenuParams&)params { handleContextMenu:(const web::ContextMenuParams&)params {
...@@ -5508,8 +5469,11 @@ GURL URLEscapedForHistory(const GURL& url) { ...@@ -5508,8 +5469,11 @@ GURL URLEscapedForHistory(const GURL& url) {
self.webStateImpl->HandleContextMenu(params); self.webStateImpl->HandleContextMenu(params);
} }
#pragma mark - #pragma mark - CRWNativeContentDelegate methods
#pragma mark CRWNativeContentDelegate methods
- (void)nativeContent:(id)content titleDidChange:(NSString*)title {
[self setNavigationItemTitle:title];
}
- (void)nativeContent:(id)content - (void)nativeContent:(id)content
handleContextMenu:(const web::ContextMenuParams&)params { handleContextMenu:(const web::ContextMenuParams&)params {
...@@ -5519,8 +5483,7 @@ GURL URLEscapedForHistory(const GURL& url) { ...@@ -5519,8 +5483,7 @@ GURL URLEscapedForHistory(const GURL& url) {
self.webStateImpl->HandleContextMenu(params); self.webStateImpl->HandleContextMenu(params);
} }
#pragma mark - #pragma mark - CRWSessionControllerDelegate methods
#pragma mark CRWSessionControllerDelegate methods
- (web::NavigationItemImpl*)pendingItemForSessionController: - (web::NavigationItemImpl*)pendingItemForSessionController:
(CRWSessionController*)sessionController { (CRWSessionController*)sessionController {
...@@ -5531,8 +5494,7 @@ GURL URLEscapedForHistory(const GURL& url) { ...@@ -5531,8 +5494,7 @@ GURL URLEscapedForHistory(const GURL& url) {
return [_navigationStates contextForNavigation:navigation] -> GetItem(); return [_navigationStates contextForNavigation:navigation] -> GetItem();
} }
#pragma mark - #pragma mark - KVO Observation
#pragma mark KVO Observation
- (void)observeValueForKeyPath:(NSString*)keyPath - (void)observeValueForKeyPath:(NSString*)keyPath
ofObject:(id)object ofObject:(id)object
...@@ -6202,8 +6164,7 @@ GURL URLEscapedForHistory(const GURL& url) { ...@@ -6202,8 +6164,7 @@ GURL URLEscapedForHistory(const GURL& url) {
allowsBackForwardNavigationGestures; allowsBackForwardNavigationGestures;
} }
#pragma mark - #pragma mark - Testing-Only Methods
#pragma mark Testing-Only Methods
- (void)injectWebViewContentView:(CRWWebViewContentView*)webViewContentView { - (void)injectWebViewContentView:(CRWWebViewContentView*)webViewContentView {
_currentURLLoadWasTrigerred = NO; _currentURLLoadWasTrigerred = NO;
......
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