Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Unified Diff: ios/chrome/browser/find_in_page/find_in_page_controller.mm

Issue 2250433003: Replaces find pasteboard with a static variable in Find in page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Release old value Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..bde5dd22757847813456b4390c2d1995c8ec5ebf 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,10 @@ NSString* const kFindBarTextFieldDidResignFirstResponderNotification =
namespace {
// The delay (in secs) after which the find in page string will be pumped again.
const NSTimeInterval kRecurringPumpDelay = .01;
+
+// Keeps find in page search term to be shared between different tabs. Never
+// reset, not stored on disk.
+static NSString* gSearchTerm;
}
@interface FindInPageController () <DOMAltering, CRWWebStateObserver>
@@ -38,8 +42,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.
++ (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 +94,15 @@ const NSTimeInterval kRecurringPumpDelay = .01;
@synthesize delegate = _delegate;
++ (void)setSearchTerm:(NSString*)string {
+ [gSearchTerm release];
+ gSearchTerm = [string copy];
+}
+
++ (NSString*)searchTerm {
+ return gSearchTerm;
+}
+
- (id)initWithWebState:(web::WebState*)webState
delegate:(id<FindInPageControllerDelegate>)delegate {
self = [super init];
@@ -288,7 +304,7 @@ const NSTimeInterval kRecurringPumpDelay = .01;
}
- (void)saveSearchTerm {
- [self findPasteboard].string = [[self findInPageModel] text];
+ [[self class] setSearchTerm:[[self findInPageModel] text]];
}
- (void)restoreSearchTerm {
@@ -298,14 +314,10 @@ const NSTimeInterval kRecurringPumpDelay = .01;
return;
}
- NSString* term = [self findPasteboard].string;
+ NSString* term = [[self class] searchTerm];
[[self findInPageModel] updateQuery:(term ? term : @"") matches:0];
}
-- (UIPasteboard*)findPasteboard {
- return [UIPasteboard pasteboardWithName:UIPasteboardNameFind create:NO];
-}
-
- (web::WebState*)webState {
return _webStateObserverBridge ? _webStateObserverBridge->web_state()
: nullptr;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698