blob: cdd7a36ce0e38a90966d0d88c385060c9c054c87 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_FIND_IN_PAGE_FIND_IN_PAGE_CONTROLLER_H_
#define IOS_CHROME_BROWSER_FIND_IN_PAGE_FIND_IN_PAGE_CONTROLLER_H_
#import <Foundation/Foundation.h>
#include "base/ios/block_types.h"
namespace web {
class WebState;
}
@class FindInPageModel;
extern NSString* const kFindBarTextFieldWillBecomeFirstResponderNotification;
extern NSString* const kFindBarTextFieldDidResignFirstResponderNotification;
@protocol FindInPageControllerDelegate<NSObject>
// Informs the delegate when the scroll position is about to be changed on the
// page.
- (void)willAdjustScrollPosition;
@end
@interface FindInPageController : NSObject
// Designated initializer.
- (id)initWithWebState:(web::WebState*)webState
delegate:(id<FindInPageControllerDelegate>)delegate;
// Inject the find in page scripts into the web state.
- (void)initFindInPage;
// Find In Page model. TODO(justincohen) consider using find_tab_helper.cc.
- (FindInPageModel*)findInPageModel;
// Is Find In Page available right now (given the state of the WebState)?
- (BOOL)canFindInPage;
// Find |query| in page, update model with results of find. Calls
// |completionHandler| after the find operation is complete. |completionHandler|
// can be nil.
- (void)findStringInPage:(NSString*)query
completionHandler:(ProceduralBlock)completionHandler;
// Move to the next find result based on |-findInPageModel|, and scroll to
// match. Calls |completionHandler| when the next string has been found.
// |completionHandler| can be nil.
- (void)findNextStringInPageWithCompletionHandler:
(ProceduralBlock)completionHandler;
// Move to the previous find result based on |-findInPageModel|. Calls
// |completionHandler| when the previous string has been found.
// |completionHandler| can be nil.
- (void)findPreviousStringInPageWithCompletionHandler:
(ProceduralBlock)completionHandler;
// Disable find in page script and model. Calls |completionHandler| once the
// model has been disabled and cleanup is complete. |completionHandler| can be
// nil.
- (void)disableFindInPageWithCompletionHandler:
(ProceduralBlock)completionHandler;
// Save search term to Paste UIPasteboard.
- (void)saveSearchTerm;
// Restore search term from Paste UIPasteboard, updating findInPageModel.
- (void)restoreSearchTerm;
// Instructs the controller to detach itself from the web state.
- (void)detachFromWebState;
@end
#endif // IOS_CHROME_BROWSER_FIND_IN_PAGE_FIND_IN_PAGE_CONTROLLER_H_
|