Chromium Code Reviews| 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 ccd31a039220858dec9b95c4540a465aae73177c..80741cb00e0b45c9c6de2656039d5e8cf318cfd8 100644 |
| --- a/ios/web/web_state/ui/crw_web_controller.mm |
| +++ b/ios/web/web_state/ui/crw_web_controller.mm |
| @@ -19,15 +19,12 @@ |
| #import "base/ios/block_types.h" |
| #include "base/ios/ios_util.h" |
| #import "base/ios/ns_error_util.h" |
| -#import "base/ios/weak_nsobject.h" |
| #include "base/json/string_escape.h" |
| #include "base/logging.h" |
| #import "base/mac/bind_objc_block.h" |
| #include "base/mac/bundle_locations.h" |
| #include "base/mac/foundation_util.h" |
| -#import "base/mac/objc_property_releaser.h" |
| #include "base/mac/scoped_cftyperef.h" |
| -#import "base/mac/scoped_nsobject.h" |
| #include "base/memory/ptr_util.h" |
| #include "base/metrics/histogram_macros.h" |
| #include "base/metrics/user_metrics.h" |
| @@ -107,6 +104,10 @@ |
| #include "url/gurl.h" |
| #include "url/url_constants.h" |
| +#if !defined(__has_feature) || !__has_feature(objc_arc) |
| +#error "This file requires ARC support." |
| +#endif |
| + |
| using base::UserMetricsAction; |
| using web::NavigationManager; |
| using web::NavigationManagerImpl; |
| @@ -205,8 +206,7 @@ WKWebViewErrorSource WKWebViewErrorSourceFromError(NSError* error) { |
| // received by WKWebViews. |
| NSError* WKWebViewErrorWithSource(NSError* error, WKWebViewErrorSource source) { |
| DCHECK(error); |
| - base::scoped_nsobject<NSMutableDictionary> userInfo( |
| - [error.userInfo mutableCopy]); |
| + NSMutableDictionary* userInfo = [error.userInfo mutableCopy]; |
| [userInfo setObject:@(source) forKey:kWKWebViewErrorSourceKey]; |
| return |
| [NSError errorWithDomain:error.domain code:error.code userInfo:userInfo]; |
| @@ -219,8 +219,6 @@ NSError* WKWebViewErrorWithSource(NSError* error, WKWebViewErrorSource source) { |
| // during pre-commit delegate callbacks, and thus must be held until the |
| // navigation commits and the informatino can be used. |
| @interface CRWWebControllerPendingNavigationInfo : NSObject { |
| - base::mac::ObjCPropertyReleaser |
| - _propertyReleaser_CRWWebControllerPendingNavigationInfo; |
| } |
| // The referrer for the page. |
| @property(nonatomic, copy) NSString* referrer; |
| @@ -246,8 +244,6 @@ NSError* WKWebViewErrorWithSource(NSError* error, WKWebViewErrorSource source) { |
| - (instancetype)init { |
| if ((self = [super init])) { |
| - _propertyReleaser_CRWWebControllerPendingNavigationInfo.Init( |
| - self, [CRWWebControllerPendingNavigationInfo class]); |
| _navigationType = WKNavigationTypeOther; |
| } |
| return self; |
| @@ -262,27 +258,27 @@ NSError* WKWebViewErrorWithSource(NSError* error, WKWebViewErrorSource source) { |
| CRWWebViewScrollViewProxyObserver, |
| WKNavigationDelegate, |
| WKUIDelegate> { |
| - base::WeakNSProtocol<id<CRWWebDelegate>> _delegate; |
| - base::WeakNSProtocol<id<CRWNativeContentProvider>> _nativeProvider; |
| - base::WeakNSProtocol<id<CRWSwipeRecognizerProvider>> _swipeRecognizerProvider; |
| + __weak id<CRWWebDelegate> _delegate; |
| + __weak id<CRWNativeContentProvider> _nativeProvider; |
| + __weak id<CRWSwipeRecognizerProvider> _swipeRecognizerProvider; |
| // The WKWebView managed by this instance. |
| - base::scoped_nsobject<WKWebView> _webView; |
| + WKWebView* _webView; |
| // The CRWWebViewProxy is the wrapper to give components access to the |
| // web view in a controlled and limited way. |
| - base::scoped_nsobject<CRWWebViewProxyImpl> _webViewProxy; |
| + CRWWebViewProxyImpl* _webViewProxy; |
| // The view used to display content. Must outlive |_webViewProxy|. The |
| // container view should be accessed through this property rather than |
| // |self.view| from within this class, as |self.view| triggers creation while |
| // |self.containerView| will return nil if the view hasn't been instantiated. |
| - base::scoped_nsobject<CRWWebControllerContainerView> _containerView; |
| + CRWWebControllerContainerView* _containerView; |
| // If |_contentView| contains a native view rather than a web view, this |
| // is its controller. If it's a web view, this is nil. |
| - base::scoped_nsprotocol<id<CRWNativeContent>> _nativeController; |
| + id<CRWNativeContent> _nativeController; |
| BOOL _isHalted; // YES if halted. Halting happens prior to destruction. |
| BOOL _isBeingDestroyed; // YES if in the process of closing. |
| // All CRWWebControllerObservers attached to the CRWWebController. A |
| // specially-constructed set is used that does not retain its elements. |
| - base::scoped_nsobject<NSMutableSet> _observers; |
| + NSMutableSet* _observers; |
| // Each observer in |_observers| is associated with a |
| // WebControllerObserverBridge in order to listen from WebState callbacks. |
| // TODO(droger): Remove |_observerBridges| when all CRWWebControllerObservers |
| @@ -315,11 +311,11 @@ NSError* WKWebViewErrorWithSource(NSError* error, WKWebViewErrorSource source) { |
| // Whether a PageDisplayState is currently being applied. |
| BOOL _applyingPageState; |
| // Actions to execute once the page load is complete. |
| - base::scoped_nsobject<NSMutableArray> _pendingLoadCompleteActions; |
| + NSMutableArray* _pendingLoadCompleteActions; |
| // UIGestureRecognizers to add to the web view. |
| - base::scoped_nsobject<NSMutableArray> _gestureRecognizers; |
| + NSMutableArray* _gestureRecognizers; |
| // Toolbars to add to the web view. |
| - base::scoped_nsobject<NSMutableArray> _webViewToolbars; |
| + NSMutableArray* _webViewToolbars; |
| // Flag to say if browsing is enabled. |
| BOOL _webUsageEnabled; |
| // Content view was reset due to low memory. Use the placeholder overlay on |
| @@ -329,12 +325,12 @@ NSError* WKWebViewErrorWithSource(NSError* error, WKWebViewErrorSource source) { |
| // overlay until it's loaded). |
| BOOL _requireReloadOnDisplay; |
| // Overlay view used instead of webView. |
| - base::scoped_nsobject<UIImageView> _placeholderOverlayView; |
| + UIImageView* _placeholderOverlayView; |
| // The touch tracking recognizer allowing us to decide if a navigation is |
| // started by the user. |
| - base::scoped_nsobject<CRWTouchTrackingRecognizer> _touchTrackingRecognizer; |
| + CRWTouchTrackingRecognizer* _touchTrackingRecognizer; |
| // The controller that tracks long press and check context menu trigger. |
| - base::scoped_nsobject<CRWContextMenuController> _contextMenuController; |
| + CRWContextMenuController* _contextMenuController; |
| // Whether a click is in progress. |
| BOOL _clickInProgress; |
| // Data on the recorded last user interaction. |
| @@ -365,7 +361,7 @@ NSError* WKWebViewErrorWithSource(NSError* error, WKWebViewErrorSource source) { |
| BOOL _webProcessIsDead; |
| // Object for loading POST requests with body. |
| - base::scoped_nsobject<CRWJSPOSTRequestLoader> _POSTRequestLoader; |
| + CRWJSPOSTRequestLoader* _POSTRequestLoader; |
| // WebStateImpl instance associated with this CRWWebController, web controller |
| // does not own this pointer. |
| @@ -373,7 +369,7 @@ NSError* WKWebViewErrorWithSource(NSError* error, WKWebViewErrorSource source) { |
| // A set of URLs opened in external applications; stored so that errors |
| // from the web view can be identified as resulting from these events. |
| - base::scoped_nsobject<NSMutableSet> _openedApplicationURL; |
| + NSMutableSet* _openedApplicationURL; |
| // A set of script managers whose scripts have been injected into the current |
| // page. |
| @@ -383,50 +379,48 @@ NSError* WKWebViewErrorWithSource(NSError* error, WKWebViewErrorSource source) { |
| // things happen automatically based on page lifecycle, and if they don't want |
| // to use one of those fixed points, they should make their scripts internally |
| // idempotent. |
| - base::scoped_nsobject<NSMutableSet> _injectedScriptManagers; |
| + NSMutableSet* _injectedScriptManagers; |
| // Script manager for setting the windowID. |
| - base::scoped_nsobject<CRWJSWindowIDManager> _windowIDJSManager; |
| + CRWJSWindowIDManager* _windowIDJSManager; |
| // The receiver of JavaScripts. |
| - base::scoped_nsobject<CRWJSInjectionReceiver> _jsInjectionReceiver; |
| + CRWJSInjectionReceiver* _jsInjectionReceiver; |
| // Handles downloading PassKit data for WKWebView. Lazy initialized. |
| - base::scoped_nsobject<CRWPassKitDownloader> _passKitDownloader; |
| + CRWPassKitDownloader* _passKitDownloader; |
| // Backs up property with the same name. |
| std::unique_ptr<web::MojoFacade> _mojoFacade; |
| // Referrer for the current page; does not include the fragment. |
| - base::scoped_nsobject<NSString> _currentReferrerString; |
| + NSString* _currentReferrerString; |
| // Pending information for an in-progress page navigation. The lifetime of |
| // this object starts at |decidePolicyForNavigationAction| where the info is |
| // extracted from the request, and ends at either |didCommitNavigation| or |
| // |didFailProvisionalNavigation|. |
| - base::scoped_nsobject<CRWWebControllerPendingNavigationInfo> |
| - _pendingNavigationInfo; |
| + CRWWebControllerPendingNavigationInfo* _pendingNavigationInfo; |
| // Holds all WKNavigation objects and their states which are currently in |
| // flight. |
| - base::scoped_nsobject<CRWWKNavigationStates> _navigationStates; |
| + CRWWKNavigationStates* _navigationStates; |
| // The WKNavigation captured when |stopLoading| was called. Used for reporting |
| // WebController.EmptyNavigationManagerCausedByStopLoading UMA metric which |
| // helps with diagnosing a navigation related crash (crbug.com/565457). |
| - base::WeakNSObject<WKNavigation> _stoppedWKNavigation; |
| + __weak WKNavigation* _stoppedWKNavigation; |
| // CRWWebUIManager object for loading WebUI pages. |
| - base::scoped_nsobject<CRWWebUIManager> _webUIManager; |
| + CRWWebUIManager* _webUIManager; |
| // Updates SSLStatus for current navigation item. |
| - base::scoped_nsobject<CRWSSLStatusUpdater> _SSLStatusUpdater; |
| + CRWSSLStatusUpdater* _SSLStatusUpdater; |
| // Controller used for certs verification to help with blocking requests with |
| // bad SSL cert, presenting SSL interstitials and determining SSL status for |
| // Navigation Items. |
| - base::scoped_nsobject<CRWCertVerificationController> |
| - _certVerificationController; |
| + CRWCertVerificationController* _certVerificationController; |
| // CertVerification errors which happened inside |
| // |webView:didReceiveAuthenticationChallenge:completionHandler:|. |
| @@ -438,16 +432,16 @@ NSError* WKWebViewErrorWithSource(NSError* error, WKWebViewErrorSource source) { |
| // If |contentView_| contains a web view, this is the web view it contains. |
| // If not, it's nil. |
| -@property(nonatomic, readonly) WKWebView* webView; |
| +@property(weak, nonatomic, readonly) WKWebView* webView; |
| // The scroll view of |webView|. |
| -@property(nonatomic, readonly) UIScrollView* webScrollView; |
| +@property(weak, nonatomic, readonly) UIScrollView* webScrollView; |
| // The current page state of the web view. Writing to this property |
| // asynchronously applies the passed value to the current web view. |
| @property(nonatomic, readwrite) web::PageDisplayState pageDisplayState; |
| // The currently displayed native controller, if any. |
| -@property(nonatomic, readwrite) id<CRWNativeContent> nativeController; |
| +@property(weak, nonatomic, readwrite) id<CRWNativeContent> nativeController; |
| // Returns NavigationManager's session controller. |
| -@property(nonatomic, readonly) CRWSessionController* sessionController; |
| +@property(weak, nonatomic, readonly) CRWSessionController* sessionController; |
| // The associated NavigationManagerImpl. |
| @property(nonatomic, readonly) NavigationManagerImpl* navigationManagerImpl; |
| // Whether the associated WebState has an opener. |
| @@ -457,9 +451,9 @@ NSError* WKWebViewErrorWithSource(NSError* error, WKWebViewErrorSource source) { |
| // changed. e.g. @{ @"URL" : @"webViewURLDidChange" } means that |
| // -[self webViewURLDidChange] must be called every time when WKWebView.URL is |
| // changed. |
| -@property(nonatomic, readonly) NSDictionary* WKWebViewObservers; |
| +@property(weak, nonatomic, readonly) NSDictionary* WKWebViewObservers; |
| // Downloader for PassKit files. Lazy initialized. |
| -@property(nonatomic, readonly) CRWPassKitDownloader* passKitDownloader; |
| +@property(weak, nonatomic, readonly) CRWPassKitDownloader* passKitDownloader; |
| // The web view's view of the current URL. During page transitions |
| // this may not be the same as the session history's view of the current URL. |
| @@ -492,7 +486,7 @@ NSError* WKWebViewErrorWithSource(NSError* error, WKWebViewErrorSource source) { |
| @property(nonatomic, readonly) web::Referrer currentNavItemReferrer; |
| // The HTTP headers associated with the current navigation item. These are nil |
| // unless the request was a POST. |
| -@property(nonatomic, readonly) NSDictionary* currentHTTPHeaders; |
| +@property(weak, nonatomic, readonly) NSDictionary* currentHTTPHeaders; |
| // YES if a user interaction has been registered at any time since the page has |
| // loaded. |
| @@ -957,20 +951,19 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5; |
| _loadPhase = web::PAGE_LOADED; |
| // Content area is lazily instantiated. |
| _defaultURL = GURL(url::kAboutBlankURL); |
| - _jsInjectionReceiver.reset( |
| - [[CRWJSInjectionReceiver alloc] initWithEvaluator:self]); |
| - _webViewProxy.reset( |
| - [[CRWWebViewProxyImpl alloc] initWithWebController:self]); |
| + _jsInjectionReceiver = |
| + [[CRWJSInjectionReceiver alloc] initWithEvaluator:self]; |
| + _webViewProxy = [[CRWWebViewProxyImpl alloc] initWithWebController:self]; |
| [[_webViewProxy scrollViewProxy] addObserver:self]; |
| - _gestureRecognizers.reset([[NSMutableArray alloc] init]); |
| - _webViewToolbars.reset([[NSMutableArray alloc] init]); |
| - _pendingLoadCompleteActions.reset([[NSMutableArray alloc] init]); |
| + _gestureRecognizers = [[NSMutableArray alloc] init]; |
| + _webViewToolbars = [[NSMutableArray alloc] init]; |
| + _pendingLoadCompleteActions = [[NSMutableArray alloc] init]; |
| web::BrowserState* browserState = _webStateImpl->GetBrowserState(); |
| - _certVerificationController.reset([[CRWCertVerificationController alloc] |
| - initWithBrowserState:browserState]); |
| + _certVerificationController = [[CRWCertVerificationController alloc] |
| + initWithBrowserState:browserState]; |
| _certVerificationErrors.reset( |
| new CertVerificationErrorsCacheType(kMaxCertErrorsCount)); |
| - _navigationStates.reset([[CRWWKNavigationStates alloc] init]); |
| + _navigationStates = [[CRWWKNavigationStates alloc] init]; |
| [[NSNotificationCenter defaultCenter] |
| addObserver:self |
| selector:@selector(orientationDidChange) |
| @@ -981,20 +974,20 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5; |
| } |
| - (id<CRWNativeContentProvider>)nativeProvider { |
| - return _nativeProvider.get(); |
| + return _nativeProvider; |
| } |
| - (void)setNativeProvider:(id<CRWNativeContentProvider>)nativeProvider { |
| - _nativeProvider.reset(nativeProvider); |
| + _nativeProvider = nativeProvider; |
| } |
| - (id<CRWSwipeRecognizerProvider>)swipeRecognizerProvider { |
| - return _swipeRecognizerProvider.get(); |
| + return _swipeRecognizerProvider; |
| } |
| - (void)setSwipeRecognizerProvider: |
| (id<CRWSwipeRecognizerProvider>)swipeRecognizerProvider { |
| - _swipeRecognizerProvider.reset(swipeRecognizerProvider); |
| + _swipeRecognizerProvider = swipeRecognizerProvider; |
| } |
| - (WebState*)webState { |
| @@ -1028,11 +1021,11 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5; |
| } |
| - (id<CRWWebDelegate>)delegate { |
| - return _delegate.get(); |
| + return _delegate; |
| } |
| - (void)setDelegate:(id<CRWWebDelegate>)delegate { |
| - _delegate.reset(delegate); |
| + _delegate = delegate; |
| if ([self.nativeController respondsToSelector:@selector(setDelegate:)]) |
| [self.nativeController setDelegate:self]; |
| } |
| @@ -1041,7 +1034,6 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5; |
| DCHECK([NSThread isMainThread]); |
| DCHECK(_isBeingDestroyed); // 'close' must have been called already. |
| DCHECK(!_webView); |
| - [super dealloc]; |
| } |
| - (void)dismissKeyboard { |
| @@ -1113,8 +1105,8 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5; |
| } else { |
| [self clearTransientContentView]; |
| [self removeWebViewAllowingCachedReconstruction:YES]; |
| - _touchTrackingRecognizer.get().touchTrackingDelegate = nil; |
| - _touchTrackingRecognizer.reset(); |
| + _touchTrackingRecognizer.touchTrackingDelegate = nil; |
| + _touchTrackingRecognizer = nil; |
| [self resetContainerView]; |
| } |
| } |
| @@ -1130,13 +1122,13 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5; |
| - (void)resetContainerView { |
| [_containerView removeFromSuperview]; |
| - _containerView.reset(); |
| + _containerView = nil; |
| } |
| - (void)handleLowMemory { |
| [self removeWebViewAllowingCachedReconstruction:YES]; |
| - _touchTrackingRecognizer.get().touchTrackingDelegate = nil; |
| - _touchTrackingRecognizer.reset(); |
| + _touchTrackingRecognizer.touchTrackingDelegate = nil; |
| + _touchTrackingRecognizer = nil; |
| [self resetContainerView]; |
| _usePlaceholderOverlay = YES; |
| } |
| @@ -1149,8 +1141,8 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5; |
| } else { |
| // Clear the space for the web view to lazy load when needed. |
| _usePlaceholderOverlay = YES; |
| - _touchTrackingRecognizer.get().touchTrackingDelegate = nil; |
| - _touchTrackingRecognizer.reset(); |
| + _touchTrackingRecognizer.touchTrackingDelegate = nil; |
| + _touchTrackingRecognizer = nil; |
| [self resetContainerView]; |
| } |
| } |
| @@ -1189,15 +1181,15 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5; |
| - (void)close { |
| _webStateImpl->CancelDialogs(); |
| - _SSLStatusUpdater.reset(); |
| + _SSLStatusUpdater = nil; |
| self.nativeProvider = nil; |
| self.swipeRecognizerProvider = nil; |
| if ([self.nativeController respondsToSelector:@selector(close)]) |
| [self.nativeController close]; |
| - base::scoped_nsobject<NSSet> observers([_observers copy]); |
| - for (id it in observers.get()) { |
| + NSSet* observers = [_observers copy]; |
| + for (id it in observers) { |
| if ([it respondsToSelector:@selector(webControllerWillClose:)]) |
| [it webControllerWillClose:self]; |
| } |
| @@ -1223,7 +1215,7 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5; |
| if ([self.nativeController respondsToSelector:@selector(setDelegate:)]) { |
| [self.nativeController setDelegate:nil]; |
| } |
| - _touchTrackingRecognizer.get().touchTrackingDelegate = nil; |
| + _touchTrackingRecognizer.touchTrackingDelegate = nil; |
| [[_webViewProxy scrollViewProxy] removeObserver:self]; |
| [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| } |
| @@ -1243,8 +1235,7 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5; |
| UIImage* result = UIGraphicsGetImageFromCurrentImageContext(); |
| UIGraphicsEndImageContext(); |
| - defaultImage = |
| - [[result stretchableImageWithLeftCapWidth:1 topCapHeight:1] retain]; |
| + defaultImage = [result stretchableImageWithLeftCapWidth:1 topCapHeight:1]; |
| } |
| return defaultImage; |
| } |
| @@ -1289,7 +1280,7 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5; |
| } |
| - (WKWebView*)webView { |
| - return _webView.get(); |
| + return _webView; |
| } |
| - (UIScrollView*)webScrollView { |
| @@ -1440,7 +1431,7 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5; |
| } |
| - (id<CRWWebViewProxy>)webViewProxy { |
| - return _webViewProxy.get(); |
| + return _webViewProxy; |
| } |
| - (UIView*)viewForPrinting { |
| @@ -1630,21 +1621,21 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| [script appendString:[self javaScriptToDispatchHashChangeWithOldURL:oldURL |
| newURL:URL]]; |
| } |
| - base::WeakNSObject<CRWWebController> weakSelf(self); |
| + __weak CRWWebController* weakSelf = self; |
| [self executeJavaScript:script |
| completionHandler:^(id, NSError*) { |
| - if (!weakSelf || weakSelf.get()->_isBeingDestroyed) |
| + CRWWebController* strongSelf = weakSelf; |
| + if (!strongSelf || strongSelf->_isBeingDestroyed) |
| return; |
| - base::scoped_nsobject<CRWWebController> strongSelf([weakSelf retain]); |
| - strongSelf.get()->_URLOnStartLoading = URL; |
| - strongSelf.get()->_lastRegisteredRequestURL = URL; |
| + strongSelf->_URLOnStartLoading = URL; |
| + strongSelf->_lastRegisteredRequestURL = URL; |
| }]; |
| } |
| // Load the current URL in a web view, first ensuring the web view is visible. |
| - (void)loadCurrentURLInWebView { |
| // Clear the set of URLs opened in external applications. |
| - _openedApplicationURL.reset([[NSMutableSet alloc] init]); |
| + _openedApplicationURL = [[NSMutableSet alloc] init]; |
| web::NavigationItem* item = self.currentNavItem; |
| GURL targetURL = item ? item->GetVirtualURL() : GURL::EmptyGURL(); |
| @@ -1674,8 +1665,8 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| - (void)updatePendingNavigationInfoFromNavigationAction: |
| (WKNavigationAction*)action { |
| if (action.targetFrame.mainFrame) { |
| - _pendingNavigationInfo.reset( |
| - [[CRWWebControllerPendingNavigationInfo alloc] init]); |
| + _pendingNavigationInfo = |
| + [[CRWWebControllerPendingNavigationInfo alloc] init]; |
| [_pendingNavigationInfo |
| setReferrer:[self referrerFromNavigationAction:action]]; |
| [_pendingNavigationInfo setNavigationType:action.navigationType]; |
| @@ -1687,8 +1678,8 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| (WKNavigationResponse*)response { |
| if (response.isForMainFrame) { |
| if (!_pendingNavigationInfo) { |
| - _pendingNavigationInfo.reset( |
| - [[CRWWebControllerPendingNavigationInfo alloc] init]); |
| + _pendingNavigationInfo = |
| + [[CRWWebControllerPendingNavigationInfo alloc] init]; |
| } |
| [_pendingNavigationInfo setMIMEType:response.response.MIMEType]; |
| } |
| @@ -1696,7 +1687,7 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| - (void)commitPendingNavigationInfo { |
| if ([_pendingNavigationInfo referrer]) { |
| - _currentReferrerString.reset([[_pendingNavigationInfo referrer] copy]); |
| + _currentReferrerString = [[_pendingNavigationInfo referrer] copy]; |
| } |
| if ([_pendingNavigationInfo MIMEType]) { |
| self.webStateImpl->SetContentsMimeType( |
| @@ -1704,7 +1695,7 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| } |
| [self updateCurrentBackForwardListItemHolder]; |
| - _pendingNavigationInfo.reset(); |
| + _pendingNavigationInfo = nil; |
| } |
| - (NSMutableURLRequest*)requestForCurrentNavigationItem { |
| @@ -1960,8 +1951,8 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| // native or web). Note, this needs to be created with a non-zero size |
| // to allow for (native) subviews with autosize constraints to be correctly |
| // processed. |
| - _containerView.reset( |
| - [[CRWWebControllerContainerView alloc] initWithDelegate:self]); |
| + _containerView = |
| + [[CRWWebControllerContainerView alloc] initWithDelegate:self]; |
| // This will be resized later, but matching the final frame will minimize |
| // re-rendering. Use the screen size because the application's key window |
| @@ -1972,8 +1963,8 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| CGRect containerViewFrame = [UIScreen mainScreen].bounds; |
| containerViewFrame.origin.y += statusBarHeight; |
| containerViewFrame.size.height -= statusBarHeight; |
| - _containerView.get().frame = containerViewFrame; |
| - DCHECK(!CGRectIsEmpty(_containerView.get().frame)); |
| + _containerView.frame = containerViewFrame; |
| + DCHECK(!CGRectIsEmpty(_containerView.frame)); |
| // TODO(crbug.com/691116): Remove this workaround once tests are no longer |
| // dependent upon this accessibility ID. |
| @@ -2026,7 +2017,7 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| // TODO(crbug.com/546337): Move to after the load commits, in the subclass |
| // implementation. This will be inaccurate if the reload fails or is |
| // cancelled. |
| - _lastUserInteraction.reset(); |
| + _lastUserInteraction = nil; |
| base::RecordAction(UserMetricsAction("Reload")); |
| GURL url = self.currentNavItem->GetURL(); |
| if ([self shouldLoadURLInNativeView:url]) { |
| @@ -2150,7 +2141,7 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| [self didFinishWithURL:currentURL loadSuccess:loadSuccess]; |
| // Execute the pending LoadCompleteActions. |
| - for (ProceduralBlock action in _pendingLoadCompleteActions.get()) { |
| + for (ProceduralBlock action in _pendingLoadCompleteActions) { |
| action(); |
| } |
| [_pendingLoadCompleteActions removeAllObjects]; |
| @@ -2263,11 +2254,11 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| - (CRWPassKitDownloader*)passKitDownloader { |
| if (_passKitDownloader) { |
| - return _passKitDownloader.get(); |
| + return _passKitDownloader; |
| } |
| - base::WeakNSObject<CRWWebController> weakSelf(self); |
| + __weak CRWWebController* weakSelf = self; |
| web::PassKitCompletionHandler passKitCompletion = ^(NSData* data) { |
| - base::scoped_nsobject<CRWWebController> strongSelf([weakSelf retain]); |
| + CRWWebController* strongSelf = weakSelf; |
| if (!strongSelf) { |
| return; |
| } |
| @@ -2282,10 +2273,10 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| } |
| }; |
| web::BrowserState* browserState = self.webStateImpl->GetBrowserState(); |
| - _passKitDownloader.reset([[CRWPassKitDownloader alloc] |
| + _passKitDownloader = [[CRWPassKitDownloader alloc] |
| initWithContextGetter:browserState->GetRequestContext() |
| - completionHandler:passKitCompletion]); |
| - return _passKitDownloader.get(); |
| + completionHandler:passKitCompletion]; |
| + return _passKitDownloader; |
| } |
| - (void)updateWebViewUserAgentFromUserAgentType: |
| @@ -2303,7 +2294,7 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| - (CRWWebViewProxyImpl*)contentViewProxyForContainerView: |
| (CRWWebControllerContainerView*)containerView { |
| - return _webViewProxy.get(); |
| + return _webViewProxy; |
| } |
| - (CGFloat)headerHeightForContainerView: |
| @@ -2345,10 +2336,10 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| if (web::GetWebClient()->IsAppSpecificURL(lastCommittedURL)) { |
| if (completion) { |
| dispatch_async(dispatch_get_main_queue(), ^{ |
| - base::scoped_nsobject<NSError> error([[NSError alloc] |
| + NSError* error = [[NSError alloc] |
| initWithDomain:web::kJSEvaluationErrorDomain |
| code:web::JS_EVALUATION_ERROR_CODE_NO_WEB_VIEW |
| - userInfo:nil]); |
| + userInfo:nil]; |
| completion(nil, error); |
| }); |
| } |
| @@ -2612,7 +2603,7 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| } |
| std::string formName; |
| message->GetString("formName", &formName); |
| - base::scoped_nsobject<NSSet> observers([_observers copy]); |
| + |
| // We decide the form is user-submitted if the user has interacted with |
| // the main page (using logic from the popup blocker), or if the keyboard |
| // is visible. |
| @@ -2758,14 +2749,15 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| NSString* replaceWebViewJS = |
| [self javaScriptToReplaceWebViewURL:pushURL stateObjectJSON:stateObject]; |
| - base::WeakNSObject<CRWWebController> weakSelf(self); |
| - [self executeJavaScript:replaceWebViewJS completionHandler:^(id, NSError*) { |
| - if (!weakSelf || weakSelf.get()->_isBeingDestroyed) |
| - return; |
| - base::scoped_nsobject<CRWWebController> strongSelf([weakSelf retain]); |
| - [strongSelf optOutScrollsToTopForSubviews]; |
| - [strongSelf didFinishNavigation:nil]; |
| - }]; |
| + __weak CRWWebController* weakSelf = self; |
| + [self executeJavaScript:replaceWebViewJS |
| + completionHandler:^(id, NSError*) { |
| + CRWWebController* strongSelf = weakSelf; |
| + if (!strongSelf || strongSelf->_isBeingDestroyed) |
| + return; |
| + [strongSelf optOutScrollsToTopForSubviews]; |
| + [strongSelf didFinishNavigation:nil]; |
| + }]; |
| return YES; |
| } |
| @@ -2814,13 +2806,14 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| [self replaceStateWithPageURL:replaceURL stateObject:stateObject]; |
| NSString* replaceStateJS = [self javaScriptToReplaceWebViewURL:replaceURL |
| stateObjectJSON:stateObject]; |
| - base::WeakNSObject<CRWWebController> weakSelf(self); |
| - [self executeJavaScript:replaceStateJS completionHandler:^(id, NSError*) { |
| - if (!weakSelf || weakSelf.get()->_isBeingDestroyed) |
| - return; |
| - base::scoped_nsobject<CRWWebController> strongSelf([weakSelf retain]); |
| - [strongSelf didFinishNavigation:nil]; |
| - }]; |
| + __weak CRWWebController* weakSelf = self; |
| + [self executeJavaScript:replaceStateJS |
| + completionHandler:^(id, NSError*) { |
| + CRWWebController* strongSelf = weakSelf; |
| + if (!strongSelf || strongSelf->_isBeingDestroyed) |
| + return; |
| + [strongSelf didFinishNavigation:nil]; |
| + }]; |
| return YES; |
| } |
| @@ -2866,7 +2859,7 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| } |
| - (void)resetDocumentSpecificState { |
| - _lastUserInteraction.reset(); |
| + _lastUserInteraction = nil; |
| _clickInProgress = NO; |
| } |
| @@ -3201,14 +3194,13 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| _webStateImpl->CreateWebUI(URL); |
| bool isWebUIURL = _webStateImpl->HasWebUI(); |
| if (isWebUIURL) { |
| - _webUIManager.reset( |
| - [[CRWWebUIManager alloc] initWithWebState:_webStateImpl]); |
| + _webUIManager = [[CRWWebUIManager alloc] initWithWebState:_webStateImpl]; |
| } |
| } |
| - (void)clearWebUI { |
| _webStateImpl->ClearWebUI(); |
| - _webUIManager.reset(); |
| + _webUIManager = nil; |
| } |
| #pragma mark - |
| @@ -3264,7 +3256,7 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| _webStateImpl->OnAuthRequired( |
| space, challenge.proposedCredential, |
| - base::BindBlock(^(NSString* user, NSString* password) { |
| + base::BindBlockArc(^(NSString* user, NSString* password) { |
| [CRWWebController processHTTPAuthForUser:user |
| password:password |
| completionHandler:completionHandler]; |
| @@ -3306,7 +3298,7 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| self.webStateImpl->RunJavaScriptDialog( |
| net::GURLWithNSURL(frame.request.URL), type, message, defaultText, |
| - base::BindBlock(^(bool success, NSString* input) { |
| + base::BindBlockArc(^(bool success, NSString* input) { |
| completionHandler(success, input); |
| })); |
| } |
| @@ -3327,16 +3319,17 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| navigationManager.GetItemCount() |
| ? navigationManager.GetLastCommittedItem()->GetURL() |
| : [self currentURL]; |
| - _lastUserInteraction.reset(new UserInteractionEvent(mainDocumentURL)); |
| + _lastUserInteraction = |
| + base::MakeUnique<UserInteractionEvent>(mainDocumentURL); |
| } |
| } |
| - (CRWTouchTrackingRecognizer*)touchTrackingRecognizer { |
| if (!_touchTrackingRecognizer) { |
| - _touchTrackingRecognizer.reset( |
| - [[CRWTouchTrackingRecognizer alloc] initWithDelegate:self]); |
| + _touchTrackingRecognizer = |
| + [[CRWTouchTrackingRecognizer alloc] initWithDelegate:self]; |
| } |
| - return _touchTrackingRecognizer.get(); |
| + return _touchTrackingRecognizer; |
| } |
| - (BOOL)userIsInteracting { |
| @@ -3376,7 +3369,7 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| } |
| // Add overlay image. |
| - _placeholderOverlayView.reset([[UIImageView alloc] init]); |
| + _placeholderOverlayView = [[UIImageView alloc] init]; |
| CGRect frame = [self visibleFrame]; |
| [_placeholderOverlayView setFrame:frame]; |
| [_placeholderOverlayView |
| @@ -3390,8 +3383,8 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| }; |
| [_delegate webController:self retrievePlaceholderOverlayImage:callback]; |
| - if (!_placeholderOverlayView.get().image) { |
| - _placeholderOverlayView.get().image = [[self class] defaultSnapshotImage]; |
| + if (!_placeholderOverlayView.image) { |
| + _placeholderOverlayView.image = [[self class] defaultSnapshotImage]; |
| } |
| } |
| @@ -3411,7 +3404,7 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| } |
| completion:^(BOOL finished) { |
| [_placeholderOverlayView removeFromSuperview]; |
| - _placeholderOverlayView.reset(); |
| + _placeholderOverlayView = nil; |
| }]; |
| } |
| @@ -3425,7 +3418,7 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| // -removePlaceholderOverlay, which removes |_placeholderOverlayView| in an |
| // animation. |
| [_placeholderOverlayView removeFromSuperview]; |
| - _placeholderOverlayView.reset(); |
| + _placeholderOverlayView = nil; |
| // There are cases when resetting the contentView, above, may happen after |
| // the web view has been created. Re-add it here, rather than |
| // relying on a subsequent call to loadCurrentURLInWebView. |
| @@ -3485,12 +3478,12 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| (CRWWebViewScrollViewProxy*)webViewScrollViewProxy { |
| _pageHasZoomed = YES; |
| - base::WeakNSObject<UIScrollView> weakScrollView(self.webScrollView); |
| + __weak UIScrollView* weakScrollView = self.webScrollView; |
| [self extractViewportTagWithCompletion:^( |
| const web::PageViewportState* viewportState) { |
| if (!weakScrollView) |
| return; |
| - base::scoped_nsobject<UIScrollView> scrollView([weakScrollView retain]); |
| + UIScrollView* scrollView = weakScrollView; |
| if (viewportState && !viewportState->viewport_tag_present() && |
| [scrollView minimumZoomScale] == [scrollView maximumZoomScale] && |
| [scrollView zoomScale] > 1.0) { |
| @@ -3605,7 +3598,7 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| NSString* const kViewportContentQuery = |
| @"var viewport = document.querySelector('meta[name=\"viewport\"]');" |
| "viewport ? viewport.content : '';"; |
| - base::WeakNSObject<CRWWebController> weakSelf(self); |
| + __weak CRWWebController* weakSelf = self; |
| int itemID = currentItem->GetUniqueID(); |
| [self executeJavaScript:kViewportContentQuery |
| completionHandler:^(id viewportContent, NSError*) { |
| @@ -3654,7 +3647,7 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| - (void)applyPageDisplayState:(const web::PageDisplayState&)displayState { |
| if (!displayState.IsValid()) |
| return; |
| - base::WeakNSObject<CRWWebController> weakSelf(self); |
| + __weak CRWWebController* weakSelf = self; |
| web::PageDisplayState displayStateCopy = displayState; |
| [self extractViewportTagWithCompletion:^( |
| const web::PageViewportState* viewportState) { |
| @@ -3743,10 +3736,10 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| } else { |
| // If the page isn't loaded, store the action to update the scroll |
| // when the page finishes loading. |
| - base::WeakNSObject<UIScrollView> weakScrollView(self.webScrollView); |
| - base::scoped_nsprotocol<ProceduralBlock> action([^{ |
| + __weak UIScrollView* weakScrollView = self.webScrollView; |
| + ProceduralBlock action = ^{ |
| [weakScrollView setContentOffset:scrollOffset]; |
| - } copy]); |
| + }; |
| [_pendingLoadCompleteActions addObject:action]; |
| } |
| } |
| @@ -3863,9 +3856,9 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| } |
| if (!_SSLStatusUpdater) { |
| - _SSLStatusUpdater.reset([[CRWSSLStatusUpdater alloc] |
| - initWithDataSource:self |
| - navigationManager:navManager]); |
| + _SSLStatusUpdater = |
| + [[CRWSSLStatusUpdater alloc] initWithDataSource:self |
| + navigationManager:navManager]; |
| [_SSLStatusUpdater setDelegate:self]; |
| } |
| NSString* host = base::SysUTF8ToNSString(_documentURL.host()); |
| @@ -3947,7 +3940,7 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| web::GetWebClient()->AllowCertificateError( |
| _webStateImpl, net::MapCertStatusToNetError(info.cert_status), info, |
| net::GURLWithNSURL(requestURL), recoverable, |
| - base::BindBlock(^(bool proceed) { |
| + base::BindBlockArc(^(bool proceed) { |
| if (proceed) { |
| DCHECK(recoverable); |
| [_certVerificationController allowCert:leafCert |
| @@ -4009,13 +4002,13 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| requireGestureRecognizerToFail:swipeRecognizer]; |
| } |
| - _contextMenuController.reset([[CRWContextMenuController alloc] |
| - initWithWebView:_webView |
| - injectionEvaluator:self |
| - delegate:self]); |
| + _contextMenuController = |
| + [[CRWContextMenuController alloc] initWithWebView:_webView |
| + injectionEvaluator:self |
| + delegate:self]; |
| // Add all additional gesture recognizers to the web view. |
| - for (UIGestureRecognizer* recognizer in _gestureRecognizers.get()) { |
| + for (UIGestureRecognizer* recognizer in _gestureRecognizers) { |
| [_webView addGestureRecognizer:recognizer]; |
| } |
| @@ -4046,7 +4039,7 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| } |
| - (void)setWebView:(WKWebView*)webView { |
| - DCHECK_NE(_webView.get(), webView); |
| + DCHECK_NE(_webView, webView); |
| // Unwind the old web view. |
| // TODO(eugenebut): Remove CRWWKScriptMessageRouter once crbug.com/543374 is |
| @@ -4062,27 +4055,26 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| [_webView removeObserver:self forKeyPath:keyPath]; |
| } |
| - _webView.reset([webView retain]); |
| + _webView = webView; |
| // Set up the new web view. |
| if (webView) { |
| - base::WeakNSObject<CRWWebController> weakSelf(self); |
| + __weak CRWWebController* weakSelf = self; |
| [messageRouter setScriptMessageHandler:^(WKScriptMessage* message) { |
| [weakSelf didReceiveScriptMessage:message]; |
| } |
| name:kScriptMessageName |
| webView:webView]; |
| - _windowIDJSManager.reset( |
| - [[CRWJSWindowIDManager alloc] initWithWebView:webView]); |
| + _windowIDJSManager = [[CRWJSWindowIDManager alloc] initWithWebView:webView]; |
| } else { |
| - _windowIDJSManager.reset(); |
| + _windowIDJSManager = nil; |
| } |
| [_webView setNavigationDelegate:self]; |
| [_webView setUIDelegate:self]; |
| for (NSString* keyPath in self.WKWebViewObservers) { |
| [_webView addObserver:self forKeyPath:keyPath options:0 context:nullptr]; |
| } |
| - _injectedScriptManagers.reset([[NSMutableSet alloc] init]); |
| + _injectedScriptManagers = [[NSMutableSet alloc] init]; |
| [self setDocumentURL:_defaultURL]; |
| } |
| @@ -4093,9 +4085,9 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| // Add the web toolbars. |
| [_containerView addToolbars:_webViewToolbars]; |
| - base::scoped_nsobject<CRWWebViewContentView> webViewContentView( |
| + CRWWebViewContentView* webViewContentView = |
| [[CRWWebViewContentView alloc] initWithWebView:_webView |
| - scrollView:self.webScrollView]); |
| + scrollView:self.webScrollView]; |
| [_containerView displayWebViewContentView:webViewContentView]; |
| } |
| @@ -4138,7 +4130,7 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| - (WKNavigation*)loadPOSTRequest:(NSMutableURLRequest*)request { |
| if (!_POSTRequestLoader) { |
| - _POSTRequestLoader.reset([[CRWJSPOSTRequestLoader alloc] init]); |
| + _POSTRequestLoader = [[CRWJSPOSTRequestLoader alloc] init]; |
| } |
| CRWWKScriptMessageRouter* messageRouter = |
| @@ -4199,7 +4191,7 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| } |
| - (void)stopLoading { |
| - _stoppedWKNavigation.reset([_navigationStates lastAddedNavigation]); |
| + _stoppedWKNavigation = [_navigationStates lastAddedNavigation]; |
| base::RecordAction(UserMetricsAction("Stop")); |
| // Discard the pending and transient entried before notifying the tab model |
| @@ -4542,7 +4534,7 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| // This must be reset at the end, since code above may need information about |
| // the pending load. |
| - _pendingNavigationInfo.reset(); |
| + _pendingNavigationInfo = nil; |
| _certVerificationErrors->Clear(); |
| [_navigationStates removeNavigation:navigation]; |
| } |
| @@ -4600,7 +4592,7 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| // This point should closely approximate the document object change, so reset |
| // the list of injected scripts to those that are automatically injected. |
| - _injectedScriptManagers.reset([[NSMutableSet alloc] init]); |
| + _injectedScriptManagers = [[NSMutableSet alloc] init]; |
| if ([self contentIsHTML] || self.webState->GetContentsMimeType().empty()) { |
| // In unit tests MIME type will be empty, because loadHTML:forURL: does not |
| // notify web view delegate about received response, so web controller does |
| @@ -4694,14 +4686,13 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| SecTrustRef trust = challenge.protectionSpace.serverTrust; |
| base::ScopedCFTypeRef<SecTrustRef> scopedTrust(trust, |
| base::scoped_policy::RETAIN); |
| - base::WeakNSObject<CRWWebController> weakSelf(self); |
| + __weak CRWWebController* weakSelf = self; |
| [_certVerificationController |
| decideLoadPolicyForTrust:scopedTrust |
| host:challenge.protectionSpace.host |
| completionHandler:^(web::CertAcceptPolicy policy, |
| net::CertStatus status) { |
| - base::scoped_nsobject<CRWWebController> strongSelf( |
| - [weakSelf retain]); |
| + CRWWebController* strongSelf = weakSelf; |
| if (!strongSelf) { |
| completionHandler( |
| NSURLSessionAuthChallengeRejectProtectionSpace, nil); |
| @@ -4772,8 +4763,22 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| context:(void*)context { |
| NSString* dispatcherSelectorName = self.WKWebViewObservers[keyPath]; |
| DCHECK(dispatcherSelectorName); |
| - if (dispatcherSelectorName) |
| - [self performSelector:NSSelectorFromString(dispatcherSelectorName)]; |
| + if (dispatcherSelectorName) { |
| + // With ARC memory management, it is not known what a method called |
| + // via a selector will return. If a method returns a retained value |
| + // (e.g. NS_RETURNS_RETAINED) that returned object will leak as ARC is |
| + // unable to property insert the correct release calls for it. |
| + // We know that all selectors used here return void and take no parameters |
| + // so we will manually call a function mapping to the method implementation. |
| + |
| + SEL selector = NSSelectorFromString(dispatcherSelectorName); |
| + IMP methodImplementation = [self methodForSelector:selector]; |
| + if (methodImplementation) { |
| + void (*methodCallFunction)(id, SEL) = |
| + (void (*)(id, SEL))methodImplementation; |
| + methodCallFunction(self, selector); |
|
PL
2017/06/01 01:56:21
This is one manual piece of conversion work that m
|
| + } |
| + } |
| } |
| - (void)webViewEstimatedProgressDidChange { |
| @@ -5017,7 +5022,7 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| - (web::NavigationContextImpl*)contextForPendingNavigationWithURL: |
| (const GURL&)URL { |
| - for (id navigation in [_navigationStates pendingNavigations]) { |
| + for (__strong id navigation in [_navigationStates pendingNavigations]) { |
| if (navigation == [NSNull null]) { |
| // null is a valid navigation object passed to WKNavigationDelegate |
| // callbacks and represents window opening action. |
| @@ -5147,7 +5152,7 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| // user before proceeding. |
| DCHECK(repostedForm); |
| _webStateImpl->ShowRepostFormWarningDialog( |
| - base::BindBlock(^(bool shouldContinue) { |
| + base::BindBlockArc(^(bool shouldContinue) { |
| if (shouldContinue) |
| webViewNavigationBlock(); |
| else |
| @@ -5203,8 +5208,8 @@ registerLoadRequestForURL:(const GURL&)requestURL |
| // not perform retain or release on the contained objects (weak references). |
| CFSetCallBacks callbacks = |
| {0, NULL, NULL, CFCopyDescription, CFEqual, CFHash}; |
| - _observers.reset(base::mac::CFToNSCast( |
| - CFSetCreateMutable(kCFAllocatorDefault, 1, &callbacks))); |
| + _observers = base::mac::CFToNSCast( |
| + CFSetCreateMutable(kCFAllocatorDefault, 1, &callbacks)); |
| } |
| DCHECK(![_observers containsObject:observer]); |
| [_observers addObject:observer]; |