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

Unified Diff: ios/web/web_state/ui/web_view_js_utils.mm

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/web/web_state/ui/web_view_js_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a97f04f04ce085fcb60f83e6b3785f5bb7513286..4d08d733102f607eeecd5eae90c36eb699d8fe94 100644
--- a/ios/web/web_state/ui/web_view_js_utils.mm
+++ b/ios/web/web_state/ui/web_view_js_utils.mm
@@ -4,17 +4,16 @@
#import "ios/web/web_state/ui/web_view_js_utils.h"
-#import <UIKit/UIKit.h>
+#include <CoreFoundation/CoreFoundation.h>
#import <WebKit/WebKit.h>
-#include "base/ios/weak_nsobject.h"
#include "base/logging.h"
#include "base/mac/scoped_nsobject.h"
namespace {
-// Converts result of WKWebView script evaluation to UIWebView format.
-NSString* UIResultFromWKResult(id result) {
+// Converts result of WKWebView script evaluation to a string.
+NSString* StringResultFromWKResult(id result) {
if (!result)
return @"";
@@ -42,18 +41,6 @@ namespace web {
NSString* const kJSEvaluationErrorDomain = @"JSEvaluationError";
-void EvaluateJavaScript(UIWebView* web_view,
- NSString* script,
- JavaScriptCompletion completion_handler) {
- base::WeakNSObject<UIWebView> weak_web_view(web_view);
- dispatch_async(dispatch_get_main_queue(), ^{
- NSString* result =
- [weak_web_view stringByEvaluatingJavaScriptFromString:script];
- if (completion_handler)
- completion_handler(result, nil);
- });
-}
-
void EvaluateJavaScript(WKWebView* web_view,
NSString* script,
JavaScriptCompletion completion_handler) {
@@ -79,7 +66,7 @@ void EvaluateJavaScript(WKWebView* web_view,
// need to call those completion handlers.
if (completion_handler) {
web_view_completion_handler = ^(id result, NSError* error) {
- completion_handler(UIResultFromWKResult(result), error);
+ completion_handler(StringResultFromWKResult(result), error);
};
}
[web_view evaluateJavaScript:script
« no previous file with comments | « ios/web/web_state/ui/web_view_js_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698