diff options
author | eugenebut <eugenebut@chromium.org> | 2016-03-18 15:38:23 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-18 22:39:22 +0000 |
commit | a022aec7a67a92ad2b41dfc777d9624aacde038d (patch) | |
tree | cf9b2347b3e8f1a139979c440549a28e5b5f8de8 /ios | |
parent | 7865b1d30daf6e4b75d8fe89768828e09b44caee (diff) | |
download | chromium_src-a022aec7a67a92ad2b41dfc777d9624aacde038d.zip chromium_src-a022aec7a67a92ad2b41dfc777d9624aacde038d.tar.gz chromium_src-a022aec7a67a92ad2b41dfc777d9624aacde038d.tar.bz2 |
[ios] Improved name of dialogs suppression API.
suppressDialogs is a poor name for a property as its call may be:
[webController suppressDialogs] and will look like an action.
BUG=None
Review URL: https://codereview.chromium.org/1818533002
Cr-Commit-Position: refs/heads/master@{#382111}
Diffstat (limited to 'ios')
-rw-r--r-- | ios/web/public/web_state/ui/crw_web_delegate.h | 2 | ||||
-rw-r--r-- | ios/web/web_state/ui/crw_web_controller.h | 2 | ||||
-rw-r--r-- | ios/web/web_state/ui/crw_web_controller.mm | 30 | ||||
-rw-r--r-- | ios/web/web_state/ui/crw_wk_web_view_web_controller.mm | 10 |
4 files changed, 22 insertions, 22 deletions
diff --git a/ios/web/public/web_state/ui/crw_web_delegate.h b/ios/web/public/web_state/ui/crw_web_delegate.h index 343d367..680d853 100644 --- a/ios/web/public/web_state/ui/crw_web_delegate.h +++ b/ios/web/public/web_state/ui/crw_web_delegate.h @@ -201,7 +201,7 @@ typedef void (^SSLErrorCallback)(BOOL); // Called when CRWWebController did suppress a dialog (JavaScript, HTTP // authentication or window.open). -// NOTE: Called only if CRWWebController.suppressDialogs is set to YES. +// NOTE: Called only if CRWWebController.shouldSuppressDialogs is set to YES. - (void)webControllerDidSuppressDialog:(CRWWebController*)webController; // Called to retrieve the height of any header that is overlaying on top of the diff --git a/ios/web/web_state/ui/crw_web_controller.h b/ios/web/web_state/ui/crw_web_controller.h index d0e1660..be9e86d 100644 --- a/ios/web/web_state/ui/crw_web_controller.h +++ b/ios/web/web_state/ui/crw_web_controller.h @@ -124,7 +124,7 @@ class WebStateImpl; // YES if JavaScript dialogs, HTTP authentication dialogs and window.open // calls should be suppressed. Default is NO. When dialog is suppressed // |CRWWebDelegate webControllerDidSuppressDialog:| will be called. -@property(nonatomic, assign) BOOL suppressDialogs; +@property(nonatomic, assign) BOOL shouldSuppressDialogs; // Return an image to use as replacement of a missing snapshot. + (UIImage*)defaultSnapshotImage; diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm index 076227b..c8929bf 100644 --- a/ios/web/web_state/ui/crw_web_controller.mm +++ b/ios/web/web_state/ui/crw_web_controller.mm @@ -238,9 +238,9 @@ void CancelTouches(UIGestureRecognizer* gesture_recognizer) { GURL _defaultURL; // Show overlay view, don't reload web page. BOOL _overlayPreviewMode; - // If |YES|, call setSuppressDialogs when core.js is injected into the web - // view. - BOOL _setSuppressDialogsLater; + // If |YES|, calls |setShouldSuppressDialogs:YES| when window id is injected + // into the web view. + BOOL _shouldSuppressDialogsOnWindowIDInjection; // The URL of an expected future recreation of the |webView|. Valid // only if the web view was discarded for non-user-visible reasons, such that // if the next load request is for that URL, it should be treated as a @@ -518,7 +518,7 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5; @synthesize webUsageEnabled = _webUsageEnabled; @synthesize usePlaceholderOverlay = _usePlaceholderOverlay; @synthesize loadPhase = _loadPhase; -@synthesize suppressDialogs = _suppressDialogs; +@synthesize shouldSuppressDialogs = _shouldSuppressDialogs; // Implemented by subclasses. @dynamic keyboardDisplayRequiresUserAction; @@ -940,15 +940,15 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5; return scrollView.contentOffset.y == -scrollView.contentInset.top; } -- (void)setSuppressDialogs:(BOOL)suppressDialogs { - _suppressDialogs = suppressDialogs; +- (void)setShouldSuppressDialogs:(BOOL)shouldSuppressDialogs { + _shouldSuppressDialogs = shouldSuppressDialogs; if (self.webView) { NSString* const kSetSuppressDialogs = [NSString stringWithFormat:@"__gCrWeb.setSuppressGeolocationDialogs(%d);", - suppressDialogs]; + shouldSuppressDialogs]; [self evaluateJavaScript:kSetSuppressDialogs stringResultHandler:nil]; } else { - _setSuppressDialogsLater = suppressDialogs; + _shouldSuppressDialogsOnWindowIDInjection = shouldSuppressDialogs; } } @@ -1062,11 +1062,11 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5; if (![_windowIDJSManager hasBeenInjected]) { // If the window ID wasn't present, this is a new page. [self setPageChangeProbability:web::PAGE_CHANGE_PROBABILITY_LOW]; - // Default values for suppressDialogs and notifyAboutDialogs are NO, - // so updating them only when necessary is a good optimization. - if (_setSuppressDialogsLater) { - [self setSuppressDialogs:YES]; - _setSuppressDialogsLater = NO; + // Default value for shouldSuppressDialogs is NO, so updating them only + // when necessary is a good optimization. + if (_shouldSuppressDialogsOnWindowIDInjection) { + self.shouldSuppressDialogs = YES; + _shouldSuppressDialogsOnWindowIDInjection = NO; } [_windowIDJSManager inject]; @@ -3195,10 +3195,10 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5; - (void)setPageDialogOpenPolicy:(web::PageDialogOpenPolicy)policy { switch (policy) { case web::DIALOG_POLICY_ALLOW: - [self setSuppressDialogs:NO]; + self.shouldSuppressDialogs = NO; return; case web::DIALOG_POLICY_SUPPRESS: - [self setSuppressDialogs:YES]; + self.shouldSuppressDialogs = YES; return; } NOTREACHED(); diff --git a/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm b/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm index 8d79c34..4cb493c 100644 --- a/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm +++ b/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm @@ -1205,7 +1205,7 @@ WKWebViewErrorSource WKWebViewErrorSourceFromError(NSError* error) { [space.authenticationMethod isEqual:NSURLAuthenticationMethodNTLM] || [space.authenticationMethod isEqual:NSURLAuthenticationMethodHTTPDigest]); - if (self.suppressDialogs) { + if (self.shouldSuppressDialogs) { [self didSuppressDialog]; completionHandler(NSURLSessionAuthChallengeRejectProtectionSpace, nil); return; @@ -1977,7 +1977,7 @@ WKWebViewErrorSource WKWebViewErrorSourceFromError(NSError* error) { createWebViewWithConfiguration:(WKWebViewConfiguration*)configuration forNavigationAction:(WKNavigationAction*)navigationAction windowFeatures:(WKWindowFeatures*)windowFeatures { - if (self.suppressDialogs) { + if (self.shouldSuppressDialogs) { [self didSuppressDialog]; return nil; } @@ -2017,7 +2017,7 @@ WKWebViewErrorSource WKWebViewErrorSourceFromError(NSError* error) { runJavaScriptAlertPanelWithMessage:(NSString*)message initiatedByFrame:(WKFrameInfo*)frame completionHandler:(void(^)())completionHandler { - if (self.suppressDialogs) { + if (self.shouldSuppressDialogs) { [self didSuppressDialog]; completionHandler(); return; @@ -2042,7 +2042,7 @@ WKWebViewErrorSource WKWebViewErrorSourceFromError(NSError* error) { initiatedByFrame:(WKFrameInfo*)frame completionHandler: (void (^)(BOOL result))completionHandler { - if (self.suppressDialogs) { + if (self.shouldSuppressDialogs) { [self didSuppressDialog]; completionHandler(NO); return; @@ -2069,7 +2069,7 @@ WKWebViewErrorSource WKWebViewErrorSourceFromError(NSError* error) { initiatedByFrame:(WKFrameInfo*)frame completionHandler: (void (^)(NSString *result))completionHandler { - if (self.suppressDialogs) { + if (self.shouldSuppressDialogs) { [self didSuppressDialog]; completionHandler(nil); return; |