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

Side by Side Diff: components/safe_json/json_sanitizer_android.cc

Issue 2237943002: Remove now-unnecessary .obj() in Java method calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@switch-context
Patch Set: Rebase *again* :( Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "components/safe_json/json_sanitizer.h" 5 #include "components/safe_json/json_sanitizer.h"
6 6
7 #include "base/android/jni_string.h" 7 #include "base/android/jni_string.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 OnError("Unsupported encoding"); 66 OnError("Unsupported encoding");
67 return; 67 return;
68 } 68 }
69 69
70 JNIEnv* env = base::android::AttachCurrentThread(); 70 JNIEnv* env = base::android::AttachCurrentThread();
71 base::android::ScopedJavaLocalRef<jstring> unsafe_json_java = 71 base::android::ScopedJavaLocalRef<jstring> unsafe_json_java =
72 base::android::ConvertUTF8ToJavaString(env, unsafe_json); 72 base::android::ConvertUTF8ToJavaString(env, unsafe_json);
73 73
74 // This will synchronously call either OnSuccess() or OnError(). 74 // This will synchronously call either OnSuccess() or OnError().
75 Java_JsonSanitizer_sanitize(env, reinterpret_cast<jlong>(this), 75 Java_JsonSanitizer_sanitize(env, reinterpret_cast<jlong>(this),
76 unsafe_json_java.obj()); 76 unsafe_json_java);
77 } 77 }
78 78
79 void JsonSanitizerAndroid::OnSuccess(const std::string& json) { 79 void JsonSanitizerAndroid::OnSuccess(const std::string& json) {
80 base::SequencedTaskRunnerHandle::Get()->PostTask( 80 base::SequencedTaskRunnerHandle::Get()->PostTask(
81 FROM_HERE, base::Bind(success_callback_, json)); 81 FROM_HERE, base::Bind(success_callback_, json));
82 } 82 }
83 83
84 void JsonSanitizerAndroid::OnError(const std::string& error) { 84 void JsonSanitizerAndroid::OnError(const std::string& error) {
85 base::SequencedTaskRunnerHandle::Get()->PostTask( 85 base::SequencedTaskRunnerHandle::Get()->PostTask(
86 FROM_HERE, base::Bind(error_callback_, error)); 86 FROM_HERE, base::Bind(error_callback_, error));
(...skipping 29 matching lines...) Expand all
116 JsonSanitizerAndroid sanitizer(success_callback, error_callback); 116 JsonSanitizerAndroid sanitizer(success_callback, error_callback);
117 sanitizer.Sanitize(unsafe_json); 117 sanitizer.Sanitize(unsafe_json);
118 } 118 }
119 119
120 // static 120 // static
121 bool JsonSanitizer::Register(JNIEnv* env) { 121 bool JsonSanitizer::Register(JNIEnv* env) {
122 return RegisterNativesImpl(env); 122 return RegisterNativesImpl(env);
123 } 123 }
124 124
125 } // namespace safe_json 125 } // namespace safe_json
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698