| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/ui/contextual_search/js_contextual_search_manager.h" | 5 #import "ios/chrome/browser/ui/contextual_search/js_contextual_search_manager.h" |
| 6 | 6 |
| 7 #include "base/ios/ios_util.h" | 7 #include "base/ios/ios_util.h" |
| 8 #include "base/mac/foundation_util.h" | 8 #include "base/mac/foundation_util.h" |
| 9 #include "base/mac/scoped_block.h" | 9 #include "base/mac/scoped_block.h" |
| 10 #include "base/mac/scoped_nsobject.h" | |
| 11 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| 12 #include "base/strings/sys_string_conversions.h" | 11 #include "base/strings/sys_string_conversions.h" |
| 13 | 12 |
| 13 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 14 #error "This file requires ARC support." |
| 15 #endif |
| 16 |
| 14 static NSString* const kEnableSelectionChangeListener = | 17 static NSString* const kEnableSelectionChangeListener = |
| 15 @"__gCrWeb.contextualSearch.enableSelectionChangeListener(%@);"; | 18 @"__gCrWeb.contextualSearch.enableSelectionChangeListener(%@);"; |
| 16 | 19 |
| 17 static NSString* const kSetMutationObserverDelay = | 20 static NSString* const kSetMutationObserverDelay = |
| 18 @"__gCrWeb.contextualSearch.setMutationObserverDelay(%f);"; | 21 @"__gCrWeb.contextualSearch.setMutationObserverDelay(%f);"; |
| 19 | 22 |
| 20 static NSString* const kDisableMutationObserver = | 23 static NSString* const kDisableMutationObserver = |
| 21 @"__gCrWeb.contextualSearch.disableMutationObserver();"; | 24 @"__gCrWeb.contextualSearch.disableMutationObserver();"; |
| 22 | 25 |
| 23 static NSString* const kSetBodyTouchListenerDelay = | 26 static NSString* const kSetBodyTouchListenerDelay = |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 completionHandler:(web::JavaScriptResultBlock)completion { | 109 completionHandler:(web::JavaScriptResultBlock)completion { |
| 107 if (startOffset < 0 || endOffset < 0) | 110 if (startOffset < 0 || endOffset < 0) |
| 108 return; | 111 return; |
| 109 NSString* expandHightlightString = | 112 NSString* expandHightlightString = |
| 110 [NSString stringWithFormat:kExpandHighlight, startOffset, endOffset]; | 113 [NSString stringWithFormat:kExpandHighlight, startOffset, endOffset]; |
| 111 | 114 |
| 112 [self executeJavaScript:expandHightlightString completionHandler:completion]; | 115 [self executeJavaScript:expandHightlightString completionHandler:completion]; |
| 113 } | 116 } |
| 114 | 117 |
| 115 @end | 118 @end |
| OLD | NEW |