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 1f167a0f4d17356a9da6522ab8a007747ff04151..b8f99351ee321e1f20fcfab23a2d1bf35fb9bc80 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 |
@@ -30,6 +30,8 @@ NSString* const kFindBarTextFieldDidResignFirstResponderNotification = |
namespace { |
// The delay (in secs) after which the find in page string will be pumped again. |
const NSTimeInterval kRecurringPumpDelay = .01; |
+ |
+static NSString* staticSearchTerm; |
Eugene But (OOO till 7-30)
2016/08/16 16:34:44
This should have comments per Objective-C Style Gu
Eugene But (OOO till 7-30)
2016/08/16 16:34:45
Please prefix globals with |g|, not with |static|:
stkhapugin
2016/08/16 16:45:57
There are no class variables in ObjC. Renaming don
stkhapugin
2016/08/16 16:45:57
Done.
Eugene But (OOO till 7-30)
2016/08/16 16:53:10
This is a class variable, no?
@interface FindInPag
|
} |
@interface FindInPageController () <DOMAltering, CRWWebStateObserver> |
@@ -38,8 +40,11 @@ const NSTimeInterval kRecurringPumpDelay = .01; |
// The web view's scroll view. |
@property(nonatomic, readonly) CRWWebViewScrollViewProxy* webViewScrollView; |
-// Convenience method to obtain UIPasteboardNameFind from UIPasteBoard. |
-- (UIPasteboard*)findPasteboard; |
+// Sets the search term to |string|. Stored until the application quit. |
Eugene But (OOO till 7-30)
2016/08/16 16:34:45
Maybe move these comments to static variable so th
stkhapugin
2016/08/16 16:45:57
Since there are no class variables, I'll have to k
Eugene But (OOO till 7-30)
2016/08/16 16:53:11
Replied above about class variable. If you have gl
|
++ (void)setSearchTerm:(NSString*)string; |
+// The search term, stored until the application quit. |
++ (NSString*)searchTerm; |
+ |
// Find in Page text field listeners. |
- (void)findBarTextFieldWillBecomeFirstResponder:(NSNotification*)note; |
- (void)findBarTextFieldDidResignFirstResponder:(NSNotification*)note; |
@@ -87,6 +92,14 @@ const NSTimeInterval kRecurringPumpDelay = .01; |
@synthesize delegate = _delegate; |
++ (void)setSearchTerm:(NSString*)string { |
+ staticSearchTerm = [string copy]; |
+} |
+ |
++ (NSString*)searchTerm { |
+ return staticSearchTerm; |
+} |
+ |
- (id)initWithWebState:(web::WebState*)webState |
delegate:(id<FindInPageControllerDelegate>)delegate { |
self = [super init]; |
@@ -288,7 +301,7 @@ const NSTimeInterval kRecurringPumpDelay = .01; |
} |
- (void)saveSearchTerm { |
- [self findPasteboard].string = [[self findInPageModel] text]; |
+ [[FindInPageController class] setSearchTerm:[[self findInPageModel] text]]; |
Eugene But (OOO till 7-30)
2016/08/16 16:34:45
s/FindInPageController/self
stkhapugin
2016/08/16 16:45:57
Done.
|
} |
- (void)restoreSearchTerm { |
@@ -298,7 +311,7 @@ const NSTimeInterval kRecurringPumpDelay = .01; |
return; |
} |
- NSString* term = [self findPasteboard].string; |
+ NSString* term = [[FindInPageController class] searchTerm]; |
Eugene But (OOO till 7-30)
2016/08/16 16:34:44
ditto
stkhapugin
2016/08/16 16:45:57
Done.
|
[[self findInPageModel] updateQuery:(term ? term : @"") matches:0]; |
} |