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

Side by Side Diff: ios/chrome/browser/find_in_page/js_findinpage_manager.h

Issue 1023813003: [iOS] Upstream ios/chrome/browser/find_in_page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@upstreamAutofill
Patch Set: Created 5 years, 9 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
(Empty)
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.
4
5 #ifndef IOS_CHROME_BROWSER_FIND_IN_PAGE_JS_FINDINPAGE_MANAGER_H_
6 #define IOS_CHROME_BROWSER_FIND_IN_PAGE_JS_FINDINPAGE_MANAGER_H_
7
8 #include <CoreGraphics/CGBase.h>
9 #include <CoreGraphics/CGGeometry.h>
10
11 #include "base/ios/block_types.h"
12 #import "base/mac/scoped_nsobject.h"
13 #import "ios/web/public/web_state/js/crw_js_injection_manager.h"
14
15 // Data from find in page.
16 typedef struct FindInPageEntry {
17 CGPoint point; // Scroll offset required to center the highlighted item.
18 NSInteger index; // Currently higlighted search term.
19 } FindInPageEntry;
20
21 // Constant for "not found".
22 extern FindInPageEntry FindInPageEntryZero;
23
24 @class CRWJSInjectionReceiver;
25 @class FindInPageModel;
26
27 // Manager for the injection of the Find In Page JavaScript.
28 @interface JsFindinpageManager : CRWJSInjectionManager {
29 @private
30 // Model for find in page.
31 base::scoped_nsobject<FindInPageModel> findInPageModel_;
32 }
33
34 // Find In Page model. TODO(justincohen) consider using find_tab_helper.cc.
35 @property(nonatomic, readonly) FindInPageModel* findInPageModel;
36
37 // Sets the width and height of the window.
38 - (void)setWidth:(CGFloat)width height:(CGFloat)height;
39
40 // Runs injected JavaScript to find |query| string. Calls |completionHandler|
41 // with YES if the find operation completed, it is called with NO otherwise.
42 // If the find operation was successfiul the first match to scroll to is
43 // also called with. If the |completionHandler| is called with NO, another
44 // call to |pumpWithCompletionHandler:| is required. |completionHandler| cannot
45 // be nil.
46 - (void)findString:(NSString*)query
47 completionHandler:(void (^)(BOOL, CGPoint))completionHandler;
48
49 // Searches for more matches. Calls |completionHandler| with a success BOOL and
50 // scroll position if pumping was successfull. If the pumping was unsuccessfull
51 // another pumping call maybe required. |completionHandler| cannot be nil.
52 // TODO(shreyasv): Consider folding the logic for re-pumping into this class
53 // instead of having clients having to do it.
54 - (void)pumpWithCompletionHandler:(void (^)(BOOL, CGPoint))completionHandler;
55
56 // Moves to the next matched location and executes the completion handler with
57 // the new scroll position passed in. The |completionHandler| can be nil.
58 - (void)nextMatchWithCompletionHandler:(void (^)(CGPoint))completionHandler;
59
60 // Moves to the previous matched location and executes the completion handle
61 // with the new scroll position passed in. The |completionHandler| can be nil.
62 - (void)previousMatchWithCompletionHandler:(void (^)(CGPoint))completionHandler;
63
64 // Stops find in page and calls |completionHandler| once find in page is
65 // stopped. |completionHandler| cannot be nil.
66 - (void)disableWithCompletionHandler:(ProceduralBlock)completionHandler;
67
68 @end
69
70 #endif // IOS_CHROME_BROWSER_FIND_IN_PAGE_JS_FINDINPAGE_MANAGER_H_
OLDNEW
« no previous file with comments | « ios/chrome/browser/find_in_page/find_in_page_model.mm ('k') | ios/chrome/browser/find_in_page/js_findinpage_manager.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698