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

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

Issue 2916473002: [ObjC ARC] Converts ios/web:web to ARC. (Closed)
Patch Set: Fixing silly mistake Created 3 years, 6 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
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 1afe2d8a9ba9d9cbe6f6463aa4df09fa90d931a6..6bdca3bbceaef1ee18faa5c4734e158c3356ed66 100644
--- a/ios/web/web_state/ui/web_view_js_utils.mm
+++ b/ios/web/web_state/ui/web_view_js_utils.mm
@@ -9,11 +9,14 @@
#include "base/logging.h"
#include "base/mac/foundation_util.h"
-#import "base/mac/scoped_nsobject.h"
#include "base/memory/ptr_util.h"
#include "base/strings/sys_string_conversions.h"
#include "base/values.h"
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
namespace {
// Converts result of WKWebView script evaluation to base::Value, parsing
@@ -30,7 +33,8 @@ std::unique_ptr<base::Value> ValueResultFromWKResult(id wk_result,
return result;
}
- CFTypeID result_type = CFGetTypeID(wk_result);
+ CFTypeRef typeRef = (__bridge CFTypeRef)wk_result;
+ CFTypeID result_type = CFGetTypeID(typeRef);
if (result_type == CFStringGetTypeID()) {
result.reset(new base::Value(base::SysNSStringToUTF16(wk_result)));
DCHECK(result->IsType(base::Value::Type::STRING));
@@ -91,10 +95,10 @@ void ExecuteJavaScript(WKWebView* web_view,
dispatch_async(dispatch_get_main_queue(), ^{
NSString* error_message =
@"JS evaluation failed because there is no web view.";
- base::scoped_nsobject<NSError> error([[NSError alloc]
+ NSError* error = [[NSError alloc]
initWithDomain:kJSEvaluationErrorDomain
code:JS_EVALUATION_ERROR_CODE_NO_WEB_VIEW
- userInfo:@{NSLocalizedDescriptionKey : error_message}]);
+ userInfo:@{NSLocalizedDescriptionKey : error_message}];
completion_handler(nil, error);
});
return;
« no previous file with comments | « ios/web/web_state/ui/crw_wk_script_message_router.mm ('k') | ios/web/web_state/ui/wk_web_view_configuration_provider.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698