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

Side by Side Diff: ios/web/public/test/crw_test_js_injection_receiver.mm

Issue 2281803002: [ios] Removed deprecated JS execution API. (Closed)
Patch Set: Merged with master Created 4 years, 3 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
« no previous file with comments | « ios/web/public/block_types.h ('k') | ios/web/public/web_state/js/crw_js_injection_evaluator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/web/public/test/crw_test_js_injection_receiver.h" 5 #import "ios/web/public/test/crw_test_js_injection_receiver.h"
6 6
7 #import <UIKit/UIKit.h> 7 #import <UIKit/UIKit.h>
8 #import <WebKit/WebKit.h> 8 #import <WebKit/WebKit.h>
9 9
10 #include "base/ios/weak_nsobject.h" 10 #include "base/ios/weak_nsobject.h"
(...skipping 12 matching lines...) Expand all
23 @implementation CRWTestWKWebViewEvaluator 23 @implementation CRWTestWKWebViewEvaluator
24 24
25 - (instancetype)init { 25 - (instancetype)init {
26 if (self = [super init]) { 26 if (self = [super init]) {
27 _webView.reset([[WKWebView alloc] init]); 27 _webView.reset([[WKWebView alloc] init]);
28 _injectedScriptManagers.reset([[NSMutableSet alloc] init]); 28 _injectedScriptManagers.reset([[NSMutableSet alloc] init]);
29 } 29 }
30 return self; 30 return self;
31 } 31 }
32 32
33 - (void)evaluateJavaScript:(NSString*)script
34 stringResultHandler:(web::JavaScriptCompletion)handler {
35 web::EvaluateJavaScript(_webView, script, handler);
36 }
37
38 - (void)executeJavaScript:(NSString*)script 33 - (void)executeJavaScript:(NSString*)script
39 completionHandler:(web::JavaScriptResultBlock)completionHandler { 34 completionHandler:(web::JavaScriptResultBlock)completionHandler {
40 web::ExecuteJavaScript(_webView, script, completionHandler); 35 web::ExecuteJavaScript(_webView, script, completionHandler);
41 } 36 }
42 37
43 - (BOOL)scriptHasBeenInjectedForClass:(Class)injectionManagerClass { 38 - (BOOL)scriptHasBeenInjectedForClass:(Class)injectionManagerClass {
44 return [_injectedScriptManagers containsObject:injectionManagerClass]; 39 return [_injectedScriptManagers containsObject:injectionManagerClass];
45 } 40 }
46 41
47 - (void)injectScript:(NSString*)script forClass:(Class)JSInjectionManagerClass { 42 - (void)injectScript:(NSString*)script forClass:(Class)JSInjectionManagerClass {
(...skipping 15 matching lines...) Expand all
63 58
64 - (id)init { 59 - (id)init {
65 base::scoped_nsobject<CRWTestWKWebViewEvaluator> evaluator( 60 base::scoped_nsobject<CRWTestWKWebViewEvaluator> evaluator(
66 [[CRWTestWKWebViewEvaluator alloc] init]); 61 [[CRWTestWKWebViewEvaluator alloc] init]);
67 if (self = [super initWithEvaluator:evaluator]) 62 if (self = [super initWithEvaluator:evaluator])
68 evaluator_.swap(evaluator); 63 evaluator_.swap(evaluator);
69 return self; 64 return self;
70 } 65 }
71 66
72 @end 67 @end
OLDNEW
« no previous file with comments | « ios/web/public/block_types.h ('k') | ios/web/public/web_state/js/crw_js_injection_evaluator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698