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/web/public/web_state/js/crw_js_injection_receiver.h" | 5 #import "ios/web/public/web_state/js/crw_js_injection_receiver.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #import "base/mac/scoped_nsobject.h" | 8 #import "base/mac/scoped_nsobject.h" |
9 #import "ios/web/public/web_state/js/crw_js_injection_evaluator.h" | 9 #import "ios/web/public/web_state/js/crw_js_injection_evaluator.h" |
10 #import "ios/web/public/web_state/js/crw_js_injection_manager.h" | 10 #import "ios/web/public/web_state/js/crw_js_injection_manager.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 if (self) { | 29 if (self) { |
30 _evaluator = evaluator; | 30 _evaluator = evaluator; |
31 _managers.reset([[NSMutableDictionary alloc] init]); | 31 _managers.reset([[NSMutableDictionary alloc] init]); |
32 } | 32 } |
33 return self; | 33 return self; |
34 } | 34 } |
35 | 35 |
36 #pragma mark - | 36 #pragma mark - |
37 #pragma mark CRWJSInjectionEvaluatorMethods | 37 #pragma mark CRWJSInjectionEvaluatorMethods |
38 | 38 |
39 - (void)evaluateJavaScript:(NSString*)script | |
40 stringResultHandler:(web::JavaScriptCompletion)handler { | |
41 [_evaluator evaluateJavaScript:script stringResultHandler:handler]; | |
42 } | |
43 | |
44 - (void)executeJavaScript:(NSString*)script | 39 - (void)executeJavaScript:(NSString*)script |
45 completionHandler:(web::JavaScriptResultBlock)completionHandler { | 40 completionHandler:(web::JavaScriptResultBlock)completionHandler { |
46 [_evaluator executeJavaScript:script completionHandler:completionHandler]; | 41 [_evaluator executeJavaScript:script completionHandler:completionHandler]; |
47 } | 42 } |
48 | 43 |
49 - (BOOL)scriptHasBeenInjectedForClass:(Class)injectionManagerClass { | 44 - (BOOL)scriptHasBeenInjectedForClass:(Class)injectionManagerClass { |
50 return [_evaluator scriptHasBeenInjectedForClass:injectionManagerClass]; | 45 return [_evaluator scriptHasBeenInjectedForClass:injectionManagerClass]; |
51 } | 46 } |
52 | 47 |
53 - (void)injectScript:(NSString*)script forClass:(Class)jsInjectionManagerClass { | 48 - (void)injectScript:(NSString*)script forClass:(Class)jsInjectionManagerClass { |
(...skipping 14 matching lines...) Expand all Loading... |
68 return manager; | 63 return manager; |
69 } | 64 } |
70 | 65 |
71 @end | 66 @end |
72 | 67 |
73 @implementation CRWJSInjectionReceiver (Testing) | 68 @implementation CRWJSInjectionReceiver (Testing) |
74 - (NSDictionary*)managers { | 69 - (NSDictionary*)managers { |
75 return _managers.get(); | 70 return _managers.get(); |
76 } | 71 } |
77 @end | 72 @end |
OLD | NEW |