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

Side by Side Diff: ios/web/web_state/js/crw_js_injection_manager.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
OLDNEW
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_manager.h" 5 #import "ios/web/public/web_state/js/crw_js_injection_manager.h"
6 6
7 #import <UIKit/UIKit.h> 7 #import <UIKit/UIKit.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/bundle_locations.h" 10 #include "base/mac/bundle_locations.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 if ([self hasBeenInjected]) 49 if ([self hasBeenInjected])
50 return; 50 return;
51 [_receiver injectScript:[self injectionContent] forClass:[self class]]; 51 [_receiver injectScript:[self injectionContent] forClass:[self class]];
52 DCHECK([self hasBeenInjected]); 52 DCHECK([self hasBeenInjected]);
53 } 53 }
54 54
55 - (void)lowMemoryWarning:(NSNotification*)notify { 55 - (void)lowMemoryWarning:(NSNotification*)notify {
56 _injectObject.reset(); 56 _injectObject.reset();
57 } 57 }
58 58
59 - (void)evaluate:(NSString*)script
60 stringResultHandler:(web::JavaScriptCompletion)completionHandler {
61 [_receiver evaluateJavaScript:script stringResultHandler:completionHandler];
62 }
63
64 - (void)executeJavaScript:(NSString*)script 59 - (void)executeJavaScript:(NSString*)script
65 completionHandler:(web::JavaScriptResultBlock)completionHandler { 60 completionHandler:(web::JavaScriptResultBlock)completionHandler {
66 [_receiver executeJavaScript:script completionHandler:completionHandler]; 61 [_receiver executeJavaScript:script completionHandler:completionHandler];
67 } 62 }
68 63
69 #pragma mark - 64 #pragma mark -
70 #pragma mark ProtectedMethods 65 #pragma mark ProtectedMethods
71 66
72 - (CRWJSInjectionReceiver*)receiver { 67 - (CRWJSInjectionReceiver*)receiver {
73 return _receiver; 68 return _receiver;
74 } 69 }
75 70
76 - (NSString*)scriptPath { 71 - (NSString*)scriptPath {
77 NOTREACHED(); 72 NOTREACHED();
78 return nil; 73 return nil;
79 } 74 }
80 75
81 - (NSString*)injectionContent { 76 - (NSString*)injectionContent {
82 if (!_injectObject) 77 if (!_injectObject)
83 _injectObject.reset([[self staticInjectionContent] copy]); 78 _injectObject.reset([[self staticInjectionContent] copy]);
84 return _injectObject.get(); 79 return _injectObject.get();
85 } 80 }
86 81
87 - (NSString*)staticInjectionContent { 82 - (NSString*)staticInjectionContent {
88 return web::GetPageScript([self scriptPath]); 83 return web::GetPageScript([self scriptPath]);
89 } 84 }
90 85
91 @end 86 @end
OLDNEW
« no previous file with comments | « ios/web/public/web_state/js/crw_js_injection_manager.h ('k') | ios/web/web_state/js/crw_js_injection_receiver.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698