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

Side by Side Diff: ios/web/web_state/ui/web_view_js_utils.h

Issue 1808993002: [ios] Removed UIWebView JS evaluation code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added TODO Created 4 years, 9 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 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 #ifndef IOS_WEB_WEB_STATE_UI_WEB_VIEW_JS_UTILS_H_ 5 #ifndef IOS_WEB_WEB_STATE_UI_WEB_VIEW_JS_UTILS_H_
6 #define IOS_WEB_WEB_STATE_UI_WEB_VIEW_JS_UTILS_H_ 6 #define IOS_WEB_WEB_STATE_UI_WEB_VIEW_JS_UTILS_H_
7 7
8 #import <Foundation/Foundation.h> 8 #import <Foundation/Foundation.h>
9 9
10 #include "ios/web/public/block_types.h" 10 #include "ios/web/public/block_types.h"
11 11
12 @class UIWebView;
13 @class WKWebView; 12 @class WKWebView;
14 13
15 // This file contains functions that asynchronously evaluate JavaScript on
16 // WKWebView/UIWebView and provide result in the same format. Call
17 // |completion_handler| with results of the evaluation or an NSError if there is
18 // an error. The |completion_handler| can be nil.
19 namespace web { 14 namespace web {
20 15
21 // The domain for JS evaluation NSErrors in web. 16 // The domain for JS evaluation NSErrors in web.
22 extern NSString* const kJSEvaluationErrorDomain; 17 extern NSString* const kJSEvaluationErrorDomain;
23 18
24 // The type of errors that can occur while evaluating JS. 19 // The type of errors that can occur while evaluating JS.
25 enum JSEvaluationErrorCode { 20 enum JSEvaluationErrorCode {
26 // No web view present to evaluate JS. 21 // No web view present to evaluate JS.
27 JS_EVALUATION_ERROR_CODE_NO_WEB_VIEW = 1, 22 JS_EVALUATION_ERROR_CODE_NO_WEB_VIEW = 1,
28 }; 23 };
29 24
30 // The error code for JS evaluation NSErrors. 25 // Evaluates JavaScript on WKWebView. Provides evaluation result as a string.
31 extern const NSInteger kJSEvaluationErrorCode; 26 // If the web view cannot evaluate JS at the moment, |completion_handler| is
32 27 // called with an NSError.
33 // Asynchronous adaptor to evaluate JavaScript on UIWebView. Provides evaluation
34 // result as it is, without modifications.
35 void EvaluateJavaScript(UIWebView* web_view,
36 NSString* script,
37 JavaScriptCompletion completion_handler);
38
39 // Evaluates JavaScript on WKWebView. Provides evaluation result in the same
40 // format as UIWebView. If the web view cannot evaluate JS at the moment,
41 // |completion_handler| is called with an NSError.
42 void EvaluateJavaScript(WKWebView* web_view, 28 void EvaluateJavaScript(WKWebView* web_view,
43 NSString* script, 29 NSString* script,
44 JavaScriptCompletion completion_handler); 30 JavaScriptCompletion completion_handler);
45 31
46 } // namespace web 32 } // namespace web
47 33
48 #endif // IOS_WEB_WEB_STATE_UI_WEB_VIEW_JS_UTILS_H_ 34 #endif // IOS_WEB_WEB_STATE_UI_WEB_VIEW_JS_UTILS_H_
OLDNEW
« no previous file with comments | « ios/web/public/web_state/js/crw_js_injection_evaluator.h ('k') | ios/web/web_state/ui/web_view_js_utils.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698