OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/android/jni_string.h" |
| 6 #include "components/web_restrictions/browser/web_restrictions_client_result.h" |
| 7 #include "jni/WebRestrictionsClientResult_jni.h" |
| 8 |
| 9 namespace web_restrictions { |
| 10 |
| 11 WebRestrictionsClientResult::WebRestrictionsClientResult( |
| 12 base::android::ScopedJavaGlobalRef<jobject>& jresult) |
| 13 : jresult_(jresult) {} |
| 14 |
| 15 int WebRestrictionsClientResult::GetInt(int column) const { |
| 16 return Java_WebRestrictionsClientResult_getInt( |
| 17 base::android::AttachCurrentThread(), jresult_.obj(), column); |
| 18 } |
| 19 |
| 20 std::string WebRestrictionsClientResult::GetString(int column) const { |
| 21 JNIEnv* env = base::android::AttachCurrentThread(); |
| 22 return base::android::ConvertJavaStringToUTF8( |
| 23 env, |
| 24 Java_WebRestrictionsClientResult_getString(env, jresult_.obj(), column)); |
| 25 } |
| 26 |
| 27 std::string WebRestrictionsClientResult::GetColumnName(int column) const { |
| 28 JNIEnv* env = base::android::AttachCurrentThread(); |
| 29 return base::android::ConvertJavaStringToUTF8( |
| 30 env, Java_WebRestrictionsClientResult_getColumnName(env, jresult_.obj(), |
| 31 column)); |
| 32 } |
| 33 |
| 34 bool WebRestrictionsClientResult::ShouldProceed() const { |
| 35 return Java_WebRestrictionsClientResult_shouldProceed( |
| 36 base::android::AttachCurrentThread(), jresult_.obj()); |
| 37 } |
| 38 |
| 39 int web_restrictions::WebRestrictionsClientResult::GetColumnCount() const { |
| 40 return Java_WebRestrictionsClientResult_getColumnCount( |
| 41 base::android::AttachCurrentThread(), jresult_.obj()); |
| 42 } |
| 43 |
| 44 bool web_restrictions::WebRestrictionsClientResult::IsString(int column) const { |
| 45 return Java_WebRestrictionsClientResult_isString( |
| 46 base::android::AttachCurrentThread(), jresult_.obj(), column); |
| 47 } |
| 48 |
| 49 bool WebRestrictionsClientResult::Register(JNIEnv* env) { // static |
| 50 return RegisterNativesImpl(env); |
| 51 } |
| 52 |
| 53 } // namespace web_restrictions |
OLD | NEW |