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

Side by Side Diff: ios/web/public/web_state/js/crw_js_injection_evaluator.h

Issue 790803002: Upstream JavaScript injection for iOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 6 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef IOS_WEB_PUBLIC_WEB_STATE_JS_CRW_JS_INJECTION_EVALUATOR_H_
6 #define IOS_WEB_PUBLIC_WEB_STATE_JS_CRW_JS_INJECTION_EVALUATOR_H_
7
8 #import <Foundation/Foundation.h>
9
10 // The type of the completion handler block that is called from
11 // |evaluateJavaScript:completionHandler|
12 namespace web {
13 typedef void (^JavaScriptCompletion)(NSString*, NSError*);
14 }
15
16 @protocol CRWJSInjectionEvaluator
17
18 // Evaluates the supplied JavaScript in the WebView. Calls |completionHandler|
19 // with results of the evaluation (which may be nil if the implementing object
20 // has no way to run the evaluation or the evaluation returns a nil value)
21 // or an NSError if there is an error. The |completionHandler| can be nil.
22 - (void)evaluateJavaScript:(NSString*)script
23 stringResultHandler:(web::JavaScriptCompletion)handler;
24
25 // Checks to see if the script for a class has been injected into the
26 // current page already, given the class and the script's presence
27 // beacon (a JS object that should exist iff the script has been injected).
28 - (BOOL)scriptHasBeenInjectedForClass:(Class)jsInjectionManagerClass
29 presenceBeacon:(NSString*)beacon;
30
31 // Injects the given script into the current page on behalf of
32 // |jsInjectionManagerClass|. This should only be used for injecting
33 // the manager's script, and not for evaluating arbitrary JavaScript.
34 - (void)injectScript:(NSString*)script forClass:(Class)jsInjectionManagerClass;
35
36 @end
37
38 #endif // IOS_WEB_PUBLIC_WEB_STATE_JS_CRW_JS_INJECTION_EVALUATOR_H_
OLDNEW
« no previous file with comments | « ios/web/public/web_state/js/crw_js_base_manager.h ('k') | ios/web/public/web_state/js/crw_js_injection_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698