Index: ios/web/web_state/ui/web_view_js_utils.mm |
diff --git a/ios/web/web_state/ui/web_view_js_utils.mm b/ios/web/web_state/ui/web_view_js_utils.mm |
index 78ce1d861694ff252cc6eaa73f6282b25d8e678e..77817a1f0176d12abcd8c32d0ba8760a0764672f 100644 |
--- a/ios/web/web_state/ui/web_view_js_utils.mm |
+++ b/ios/web/web_state/ui/web_view_js_utils.mm |
@@ -13,33 +13,6 @@ |
#include "base/strings/sys_string_conversions.h" |
#include "base/values.h" |
-namespace { |
- |
-// Converts result of WKWebView script evaluation to a string. |
-NSString* StringResultFromWKResult(id result) { |
- if (!result) |
- return @""; |
- |
- CFTypeID result_type = CFGetTypeID(result); |
- if (result_type == CFStringGetTypeID()) |
- return result; |
- |
- if (result_type == CFNumberGetTypeID()) |
- return [result stringValue]; |
- |
- if (result_type == CFBooleanGetTypeID()) |
- return [result boolValue] ? @"true" : @"false"; |
- |
- if (result_type == CFNullGetTypeID()) |
- return @""; |
- |
- // TODO(stuartmorgan): Stringify other types. |
- NOTREACHED(); |
- return nil; |
-} |
- |
-} // namespace |
- |
namespace web { |
NSString* const kJSEvaluationErrorDomain = @"JSEvaluationError"; |
@@ -79,23 +52,6 @@ std::unique_ptr<base::Value> ValueResultFromWKResult(id wk_result) { |
return result; |
} |
-void EvaluateJavaScript(WKWebView* web_view, |
- NSString* script, |
- JavaScriptCompletion completion_handler) { |
- void (^web_view_completion_handler)(id, NSError*) = nil; |
- // Do not create a web_view_completion_handler if no |completion_handler| is |
- // passed to this function. WKWebView guarantees to call all completion |
- // handlers before deallocation. Passing nil as completion handler (when |
- // appropriate) may speed up web view deallocation, because there will be no |
- // need to call those completion handlers. |
- if (completion_handler) { |
- web_view_completion_handler = ^(id result, NSError* error) { |
- completion_handler(StringResultFromWKResult(result), error); |
- }; |
- } |
- ExecuteJavaScript(web_view, script, web_view_completion_handler); |
-} |
- |
void ExecuteJavaScript(WKWebView* web_view, |
NSString* script, |
JavaScriptResultBlock completion_handler) { |