OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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_UI_CONTEXTUAL_SEARCH_JS_CONTEXTUAL_SEARCH_MANAGER_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_JS_CONTEXTUAL_SEARCH_MANAGER_H_ |
| 7 |
| 8 #import <UIKit/UIKit.h> |
| 9 |
| 10 #import "ios/web/public/web_state/js/crw_js_injection_manager.h" |
| 11 |
| 12 #include "base/ios/block_types.h" |
| 13 |
| 14 // JsContextualSearchManager manages the scripts related to contextual search. |
| 15 @interface JsContextualSearchManager : CRWJSInjectionManager |
| 16 |
| 17 // Asynchronously fetches the search context for |point| in the web view. |
| 18 // |handler| is called back with the JSON-encoded search context, or an |
| 19 // empty dictionary if no search context was found at |point| |
| 20 - (void)fetchContextFromSelectionAtPoint:(CGPoint)point |
| 21 completionHandler:(void (^)(NSString*))handler; |
| 22 |
| 23 // Sets the JavaScript events listeners on selection change and DOM mutation. |
| 24 // |mutationDelay| is the timeout of the DOM mutation events. |
| 25 // |bodyTouchDelay| is the timeout of the body touch events. |
| 26 - (void)enableEventListenersWithMutationDelay:(CGFloat)mutationDelay |
| 27 bodyTouchDelay:(CGFloat)bodyTouchDelay; |
| 28 |
| 29 // Disables the JavaScript events listeners on selection change and DOM |
| 30 // mutation. |
| 31 - (void)disableListeners; |
| 32 |
| 33 // Expands the highlight zone to the specified range. |
| 34 - (void)expandHighlightToStartOffset:(int)startOffset |
| 35 endOffset:(int)endOffset |
| 36 completionHandler:(web::JavaScriptResultBlock)completion; |
| 37 |
| 38 // Retrieve the position of the highlight in the web view. |
| 39 - (void)highlightRectsWithCompletionHandler: |
| 40 (web::JavaScriptResultBlock)completion; |
| 41 |
| 42 // Clears the highlight info. |
| 43 - (void)clearHighlight; |
| 44 |
| 45 @end |
| 46 |
| 47 #endif // IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_JS_CONTEXTUAL_SEARCH_MANAGER_
H_ |
OLD | NEW |