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 #import "ios/chrome/browser/find_in_page/js_findinpage_manager.h" | 5 #import "ios/chrome/browser/find_in_page/js_findinpage_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #import "base/ios/weak_nsobject.h" | 9 #import "base/ios/weak_nsobject.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 } // namespace | 54 } // namespace |
55 | 55 |
56 @interface JsFindinpageManager () | 56 @interface JsFindinpageManager () |
57 // Update find in page model with results, return true if fip completes or | 57 // Update find in page model with results, return true if fip completes or |
58 // false if still pending and requires pumping. If |point| is not nil, it will | 58 // false if still pending and requires pumping. If |point| is not nil, it will |
59 // contain the scroll position upon return. | 59 // contain the scroll position upon return. |
60 - (BOOL)processFindInPageResult:(NSString*)result | 60 - (BOOL)processFindInPageResult:(NSString*)result |
61 scrollPosition:(CGPoint*)point; | 61 scrollPosition:(CGPoint*)point; |
62 // Updates find in page model with results. Calls |completionHandler| with the | 62 // Updates find in page model with results. Calls |completionHandler| with the |
63 // the result of the processing and the new scroll position if successfull. If | 63 // the result of the processing and the new scroll position if successful. If |
64 // |completionHandler| is called with NO, further pumping is required. | 64 // |completionHandler| is called with NO, further pumping is required. |
65 // |completionHandler| cannot be nil. | 65 // |completionHandler| cannot be nil. |
66 - (void)processFindInPagePumpResult:(NSString*)result | 66 - (void)processFindInPagePumpResult:(NSString*)result |
67 completionHandler:(void (^)(BOOL, CGPoint))completionHandler; | 67 completionHandler:(void (^)(BOOL, CGPoint))completionHandler; |
68 // Helper functions to extract FindInPageEntry from JSON. | 68 // Helper functions to extract FindInPageEntry from JSON. |
69 - (FindInPageEntry)findInPageEntryForJson:(NSString*)jsonStr; | 69 - (FindInPageEntry)findInPageEntryForJson:(NSString*)jsonStr; |
70 - (FindInPageEntry)entryForListValue:(base::ListValue*)position; | 70 - (FindInPageEntry)entryForListValue:(base::ListValue*)position; |
71 // Executes |script| which is a piece of JavaScript to move to the next or | 71 // Executes |script| which is a piece of JavaScript to move to the next or |
72 // previous element in the page and executes |completionHandler| after moving | 72 // previous element in the page and executes |completionHandler| after moving |
73 // with the new scroll position passed in. | 73 // with the new scroll position passed in. |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 262 |
263 - (NSString*)scriptPath { | 263 - (NSString*)scriptPath { |
264 return @"find_in_page"; | 264 return @"find_in_page"; |
265 } | 265 } |
266 | 266 |
267 - (NSString*)presenceBeacon { | 267 - (NSString*)presenceBeacon { |
268 return kFindInPageBeacon; | 268 return kFindInPageBeacon; |
269 } | 269 } |
270 | 270 |
271 @end | 271 @end |
OLD | NEW |