| OLD | NEW |
| 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 #import "ios/web/web_state/ui/web_view_js_utils.h" | 5 #import "ios/web/web_state/ui/web_view_js_utils.h" |
| 6 | 6 |
| 7 #include <CoreFoundation/CoreFoundation.h> | 7 #include <CoreFoundation/CoreFoundation.h> |
| 8 #import <WebKit/WebKit.h> | 8 #import <WebKit/WebKit.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/mac/foundation_util.h" | 11 #include "base/mac/foundation_util.h" |
| 12 #include "base/mac/scoped_nsobject.h" | 12 #import "base/mac/scoped_nsobject.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 // Converts result of WKWebView script evaluation to base::Value, parsing | 19 // Converts result of WKWebView script evaluation to base::Value, parsing |
| 20 // |wk_result| up to a depth of |max_depth|. | 20 // |wk_result| up to a depth of |max_depth|. |
| 21 std::unique_ptr<base::Value> ValueResultFromWKResult(id wk_result, | 21 std::unique_ptr<base::Value> ValueResultFromWKResult(id wk_result, |
| 22 int max_depth) { | 22 int max_depth) { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 userInfo:@{NSLocalizedDescriptionKey : error_message}]); | 98 userInfo:@{NSLocalizedDescriptionKey : error_message}]); |
| 99 completion_handler(nil, error); | 99 completion_handler(nil, error); |
| 100 }); | 100 }); |
| 101 return; | 101 return; |
| 102 } | 102 } |
| 103 | 103 |
| 104 [web_view evaluateJavaScript:script completionHandler:completion_handler]; | 104 [web_view evaluateJavaScript:script completionHandler:completion_handler]; |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace web | 107 } // namespace web |
| OLD | NEW |