Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ios / web / web_state / ui / web_view_js_utils.h
bloba51dd55c7f2ae2abfca475f397b7dd9bd0f3b8a9
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
3 // found in the LICENSE file.
5 #ifndef IOS_WEB_WEB_STATE_UI_WEB_VIEW_JS_UTILS_H_
6 #define IOS_WEB_WEB_STATE_UI_WEB_VIEW_JS_UTILS_H_
8 #import <Foundation/Foundation.h>
10 #include "ios/web/public/block_types.h"
12 @class UIWebView;
13 @class WKWebView;
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 {
21 // Asynchronous adaptor to evaluate JavaScript on UIWebView. Provides evaluation
22 // result as it is, without modifications.
23 void EvaluateJavaScript(UIWebView* web_view,
24 NSString* script,
25 JavaScriptCompletion completion_handler);
27 // Evaluates JavaScript on WKWebView. Provides evaluation result is the same
28 // format as UIWebView.
29 void EvaluateJavaScript(WKWebView* web_view,
30 NSString* script,
31 JavaScriptCompletion completion_handler);
33 } // namespace web
35 #endif // IOS_WEB_WEB_STATE_UI_WEB_VIEW_JS_UTILS_H_