| OLD | NEW |
| 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 #ifndef IOS_CHROME_BROWSER_FIND_IN_PAGE_FIND_IN_PAGE_CONTROLLER_H_ | 5 #ifndef IOS_CHROME_BROWSER_FIND_IN_PAGE_FIND_IN_PAGE_CONTROLLER_H_ |
| 6 #define IOS_CHROME_BROWSER_FIND_IN_PAGE_FIND_IN_PAGE_CONTROLLER_H_ | 6 #define IOS_CHROME_BROWSER_FIND_IN_PAGE_FIND_IN_PAGE_CONTROLLER_H_ |
| 7 | 7 |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 | 9 |
| 10 #include "base/ios/block_types.h" | 10 #include "base/ios/block_types.h" |
| 11 | 11 |
| 12 namespace web { | 12 namespace web { |
| 13 class WebState; | 13 class WebState; |
| 14 } | 14 } |
| 15 | 15 |
| 16 @class FindInPageModel; | 16 @class FindInPageModel; |
| 17 | 17 |
| 18 extern NSString* const kFindBarTextFieldWillBecomeFirstResponderNotification; | 18 extern NSString* const kFindBarTextFieldWillBecomeFirstResponderNotification; |
| 19 extern NSString* const kFindBarTextFieldDidResignFirstResponderNotification; | 19 extern NSString* const kFindBarTextFieldDidResignFirstResponderNotification; |
| 20 | 20 |
| 21 @protocol FindInPageControllerDelegate<NSObject> | 21 @protocol FindInPageControllerDelegate<NSObject> |
| 22 // Informs the delegate when the scroll position is about to be changed on the | 22 // Informs the delegate when the scroll position is about to be changed on the |
| 23 // page. | 23 // page. |
| 24 - (void)willAdjustScrollPosition; | 24 - (void)willAdjustScrollPosition; |
| 25 @end | 25 @end |
| 26 | 26 |
| 27 @interface FindInPageController : NSObject | 27 @interface FindInPageController : NSObject |
| 28 | 28 |
| 29 // Find In Page model. |
| 30 @property(nonatomic, readonly, strong) FindInPageModel* findInPageModel; |
| 31 |
| 29 // Designated initializer. | 32 // Designated initializer. |
| 30 - (id)initWithWebState:(web::WebState*)webState | 33 - (id)initWithWebState:(web::WebState*)webState |
| 31 delegate:(id<FindInPageControllerDelegate>)delegate; | 34 delegate:(id<FindInPageControllerDelegate>)delegate; |
| 32 // Inject the find in page scripts into the web state. | 35 // Inject the find in page scripts into the web state. |
| 33 - (void)initFindInPage; | 36 - (void)initFindInPage; |
| 34 // Find In Page model. TODO(justincohen) consider using find_tab_helper.cc. | |
| 35 - (FindInPageModel*)findInPageModel; | |
| 36 // Is Find In Page available right now (given the state of the WebState)? | 37 // Is Find In Page available right now (given the state of the WebState)? |
| 37 - (BOOL)canFindInPage; | 38 - (BOOL)canFindInPage; |
| 38 // Find |query| in page, update model with results of find. Calls | 39 // Find |query| in page, update model with results of find. Calls |
| 39 // |completionHandler| after the find operation is complete. |completionHandler| | 40 // |completionHandler| after the find operation is complete. |completionHandler| |
| 40 // can be nil. | 41 // can be nil. |
| 41 - (void)findStringInPage:(NSString*)query | 42 - (void)findStringInPage:(NSString*)query |
| 42 completionHandler:(ProceduralBlock)completionHandler; | 43 completionHandler:(ProceduralBlock)completionHandler; |
| 43 // Move to the next find result based on |-findInPageModel|, and scroll to | 44 // Move to the next find result based on |-findInPageModel|, and scroll to |
| 44 // match. Calls |completionHandler| when the next string has been found. | 45 // match. Calls |completionHandler| when the next string has been found. |
| 45 // |completionHandler| can be nil. | 46 // |completionHandler| can be nil. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 64 // Instructs the controller to detach itself from the web state. | 65 // Instructs the controller to detach itself from the web state. |
| 65 - (void)detachFromWebState; | 66 - (void)detachFromWebState; |
| 66 | 67 |
| 67 // Sets the search term to |string|. Stored until the application quit. | 68 // Sets the search term to |string|. Stored until the application quit. |
| 68 + (void)setSearchTerm:(NSString*)string; | 69 + (void)setSearchTerm:(NSString*)string; |
| 69 // The search term, stored until the application quit. | 70 // The search term, stored until the application quit. |
| 70 + (NSString*)searchTerm; | 71 + (NSString*)searchTerm; |
| 71 @end | 72 @end |
| 72 | 73 |
| 73 #endif // IOS_CHROME_BROWSER_FIND_IN_PAGE_FIND_IN_PAGE_CONTROLLER_H_ | 74 #endif // IOS_CHROME_BROWSER_FIND_IN_PAGE_FIND_IN_PAGE_CONTROLLER_H_ |
| OLD | NEW |