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

Side by Side Diff: ios/chrome/browser/find_in_page/find_in_page_controller.mm

Issue 2654433007: [ios] Moves find-in-page code out of Tab and into FindTabHelper. (Closed)
Patch Set: Review. Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ios/chrome/browser/find_in_page/find_in_page_controller.h" 5 #import "ios/chrome/browser/find_in_page/find_in_page_controller.h"
6 6
7 #import <UIKit/UIKit.h> 7 #import <UIKit/UIKit.h>
8 8
9 #import <cmath> 9 #import <cmath>
10 #include <memory> 10 #include <memory>
(...skipping 21 matching lines...) Expand all
32 namespace { 32 namespace {
33 // The delay (in secs) after which the find in page string will be pumped again. 33 // The delay (in secs) after which the find in page string will be pumped again.
34 const NSTimeInterval kRecurringPumpDelay = .01; 34 const NSTimeInterval kRecurringPumpDelay = .01;
35 35
36 // Keeps find in page search term to be shared between different tabs. Never 36 // Keeps find in page search term to be shared between different tabs. Never
37 // reset, not stored on disk. 37 // reset, not stored on disk.
38 static NSString* gSearchTerm; 38 static NSString* gSearchTerm;
39 } 39 }
40 40
41 @interface FindInPageController () <DOMAltering, CRWWebStateObserver> 41 @interface FindInPageController () <DOMAltering, CRWWebStateObserver>
42 // The find in page controller delegate. 42 // The find in page controller delegate. Can be nil.
43 @property(nonatomic, readonly) id<FindInPageControllerDelegate> delegate; 43 @property(nonatomic, readonly) id<FindInPageControllerDelegate> delegate;
44 44
45 // The web view's scroll view. 45 // The web view's scroll view.
46 - (CRWWebViewScrollViewProxy*)webViewScrollView; 46 - (CRWWebViewScrollViewProxy*)webViewScrollView;
47 // Find in Page text field listeners. 47 // Find in Page text field listeners.
48 - (void)findBarTextFieldWillBecomeFirstResponder:(NSNotification*)note; 48 - (void)findBarTextFieldWillBecomeFirstResponder:(NSNotification*)note;
49 - (void)findBarTextFieldDidResignFirstResponder:(NSNotification*)note; 49 - (void)findBarTextFieldDidResignFirstResponder:(NSNotification*)note;
50 // Keyboard listeners. 50 // Keyboard listeners.
51 - (void)keyboardDidShow:(NSNotification*)note; 51 - (void)keyboardDidShow:(NSNotification*)note;
52 - (void)keyboardWillHide:(NSNotification*)note; 52 - (void)keyboardWillHide:(NSNotification*)note;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } 96 }
97 97
98 + (NSString*)searchTerm { 98 + (NSString*)searchTerm {
99 return gSearchTerm; 99 return gSearchTerm;
100 } 100 }
101 101
102 - (id)initWithWebState:(web::WebState*)webState 102 - (id)initWithWebState:(web::WebState*)webState
103 delegate:(id<FindInPageControllerDelegate>)delegate { 103 delegate:(id<FindInPageControllerDelegate>)delegate {
104 self = [super init]; 104 self = [super init];
105 if (self) { 105 if (self) {
106 DCHECK(delegate);
107 _findInPageJsManager = base::mac::ObjCCastStrict<JsFindinpageManager>( 106 _findInPageJsManager = base::mac::ObjCCastStrict<JsFindinpageManager>(
108 [webState->GetJSInjectionReceiver() 107 [webState->GetJSInjectionReceiver()
109 instanceOfClass:[JsFindinpageManager class]]); 108 instanceOfClass:[JsFindinpageManager class]]);
110 _delegate = delegate; 109 _delegate = delegate;
111 _webStateObserverBridge.reset( 110 _webStateObserverBridge.reset(
112 new web::WebStateObserverBridge(webState, self)); 111 new web::WebStateObserverBridge(webState, self));
113 _webViewProxy = webState->GetWebViewProxy(); 112 _webViewProxy = webState->GetWebViewProxy();
114 [[NSNotificationCenter defaultCenter] 113 [[NSNotificationCenter defaultCenter]
115 addObserver:self 114 addObserver:self
116 selector:@selector(findBarTextFieldWillBecomeFirstResponder:) 115 selector:@selector(findBarTextFieldWillBecomeFirstResponder:)
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 374
376 - (BOOL)canReleaseDOMLock { 375 - (BOOL)canReleaseDOMLock {
377 return NO; 376 return NO;
378 } 377 }
379 378
380 - (void)releaseDOMLockWithCompletionHandler:(ProceduralBlock)completionHandler { 379 - (void)releaseDOMLockWithCompletionHandler:(ProceduralBlock)completionHandler {
381 NOTREACHED(); 380 NOTREACHED();
382 } 381 }
383 382
384 @end 383 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/find_in_page/BUILD.gn ('k') | ios/chrome/browser/find_in_page/find_tab_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698