Revert "Fix broken channel icon in chrome://help on CrOS" and try again
[chromium-blink-merge.git] / ios / chrome / browser / find_in_page / find_in_page_controller.h
blobcdd7a36ce0e38a90966d0d88c385060c9c054c87
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
3 // found in the LICENSE file.
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_
8 #import <Foundation/Foundation.h>
10 #include "base/ios/block_types.h"
12 namespace web {
13 class WebState;
16 @class FindInPageModel;
18 extern NSString* const kFindBarTextFieldWillBecomeFirstResponderNotification;
19 extern NSString* const kFindBarTextFieldDidResignFirstResponderNotification;
21 @protocol FindInPageControllerDelegate<NSObject>
22 // Informs the delegate when the scroll position is about to be changed on the
23 // page.
24 - (void)willAdjustScrollPosition;
25 @end
27 @interface FindInPageController : NSObject
29 // Designated initializer.
30 - (id)initWithWebState:(web::WebState*)webState
31 delegate:(id<FindInPageControllerDelegate>)delegate;
32 // Inject the find in page scripts into the web state.
33 - (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 - (BOOL)canFindInPage;
38 // Find |query| in page, update model with results of find. Calls
39 // |completionHandler| after the find operation is complete. |completionHandler|
40 // can be nil.
41 - (void)findStringInPage:(NSString*)query
42 completionHandler:(ProceduralBlock)completionHandler;
43 // Move to the next find result based on |-findInPageModel|, and scroll to
44 // match. Calls |completionHandler| when the next string has been found.
45 // |completionHandler| can be nil.
46 - (void)findNextStringInPageWithCompletionHandler:
47 (ProceduralBlock)completionHandler;
48 // Move to the previous find result based on |-findInPageModel|. Calls
49 // |completionHandler| when the previous string has been found.
50 // |completionHandler| can be nil.
51 - (void)findPreviousStringInPageWithCompletionHandler:
52 (ProceduralBlock)completionHandler;
53 // Disable find in page script and model. Calls |completionHandler| once the
54 // model has been disabled and cleanup is complete. |completionHandler| can be
55 // nil.
56 - (void)disableFindInPageWithCompletionHandler:
57 (ProceduralBlock)completionHandler;
59 // Save search term to Paste UIPasteboard.
60 - (void)saveSearchTerm;
61 // Restore search term from Paste UIPasteboard, updating findInPageModel.
62 - (void)restoreSearchTerm;
64 // Instructs the controller to detach itself from the web state.
65 - (void)detachFromWebState;
66 @end
68 #endif // IOS_CHROME_BROWSER_FIND_IN_PAGE_FIND_IN_PAGE_CONTROLLER_H_