Index: ios/chrome/browser/find_in_page/find_in_page_controller.mm |
diff --git a/ios/chrome/browser/find_in_page/find_in_page_controller.mm b/ios/chrome/browser/find_in_page/find_in_page_controller.mm |
index ab986d3751021ff640ed8d5db7e4202c290cdac3..91d9d5fff10def49ab2af8de3812eb12661258e7 100644 |
--- a/ios/chrome/browser/find_in_page/find_in_page_controller.mm |
+++ b/ios/chrome/browser/find_in_page/find_in_page_controller.mm |
@@ -21,6 +21,10 @@ |
#import "ios/web/public/web_state/web_state.h" |
#import "ios/web/public/web_state/web_state_observer_bridge.h" |
+#if !defined(__has_feature) || !__has_feature(objc_arc) |
+#error "This file requires ARC support." |
+#endif |
+ |
NSString* const kFindBarTextFieldWillBecomeFirstResponderNotification = |
@"kFindBarTextFieldWillBecomeFirstResponderNotification"; |
NSString* const kFindBarTextFieldDidResignFirstResponderNotification = |
@@ -39,7 +43,8 @@ static NSString* gSearchTerm; |
// The find in page controller delegate. |
@property(nonatomic, readonly) id<FindInPageControllerDelegate> delegate; |
// The web view's scroll view. |
-@property(nonatomic, readonly) CRWWebViewScrollViewProxy* webViewScrollView; |
+@property(weak, nonatomic, readonly) |
+ CRWWebViewScrollViewProxy* webViewScrollView; |
// Find in Page text field listeners. |
- (void)findBarTextFieldWillBecomeFirstResponder:(NSNotification*)note; |
@@ -89,7 +94,6 @@ static NSString* gSearchTerm; |
@synthesize delegate = _delegate; |
+ (void)setSearchTerm:(NSString*)string { |
- [gSearchTerm release]; |
gSearchTerm = [string copy]; |
} |
@@ -108,7 +112,7 @@ static NSString* gSearchTerm; |
_delegate = delegate; |
_webStateObserverBridge.reset( |
new web::WebStateObserverBridge(webState, self)); |
- _webViewProxy.reset([webState->GetWebViewProxy() retain]); |
+ _webViewProxy.reset(webState->GetWebViewProxy()); |
[[NSNotificationCenter defaultCenter] |
addObserver:self |
selector:@selector(findBarTextFieldWillBecomeFirstResponder:) |
@@ -126,7 +130,6 @@ static NSString* gSearchTerm; |
- (void)dealloc { |
[[NSNotificationCenter defaultCenter] removeObserver:self]; |
- [super dealloc]; |
} |
- (FindInPageModel*)findInPageModel { |
@@ -225,7 +228,7 @@ static NSString* gSearchTerm; |
base::WeakNSObject<FindInPageController> weakSelf(self); |
[_findInPageJsManager pumpWithCompletionHandler:^(BOOL finished, |
CGPoint point) { |
- base::scoped_nsobject<FindInPageController> strongSelf([weakSelf retain]); |
+ base::scoped_nsobject<FindInPageController> strongSelf(weakSelf); |
if (finished) { |
[[strongSelf delegate] willAdjustScrollPosition]; |
point = [strongSelf limitOverscroll:[strongSelf webViewScrollView] |
@@ -241,7 +244,7 @@ static NSString* gSearchTerm; |
[self initFindInPage]; |
base::WeakNSObject<FindInPageController> weakSelf(self); |
[_findInPageJsManager nextMatchWithCompletionHandler:^(CGPoint point) { |
- base::scoped_nsobject<FindInPageController> strongSelf([weakSelf retain]); |
+ base::scoped_nsobject<FindInPageController> strongSelf(weakSelf); |
[[strongSelf delegate] willAdjustScrollPosition]; |
point = [strongSelf limitOverscroll:[strongSelf webViewScrollView] |
atPoint:point]; |
@@ -257,7 +260,7 @@ static NSString* gSearchTerm; |
[self initFindInPage]; |
base::WeakNSObject<FindInPageController> weakSelf(self); |
[_findInPageJsManager previousMatchWithCompletionHandler:^(CGPoint point) { |
- base::scoped_nsobject<FindInPageController> strongSelf([weakSelf retain]); |
+ base::scoped_nsobject<FindInPageController> strongSelf(weakSelf); |
[[strongSelf delegate] willAdjustScrollPosition]; |
point = [strongSelf limitOverscroll:[strongSelf webViewScrollView] |
atPoint:point]; |
@@ -276,7 +279,7 @@ static NSString* gSearchTerm; |
[NSObject cancelPreviousPerformRequestsWithTarget:self]; |
base::WeakNSObject<FindInPageController> weakSelf(self); |
ProceduralBlock handler = ^{ |
- base::scoped_nsobject<FindInPageController> strongSelf([weakSelf retain]); |
+ base::scoped_nsobject<FindInPageController> strongSelf(weakSelf); |
if (strongSelf) { |
[strongSelf.get().findInPageModel setEnabled:NO]; |
web::WebState* webState = [strongSelf webState]; |