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_restictions_client_result.h" |
| 7 #include "jni/WebRestrictionsClientResult_jni.h" |
| 8 |
| 9 namespace web_restrictions { |
| 10 |
| 11 WebRestrictionsClientResult::WebRestrictionsClientResult() {} |
| 12 |
| 13 WebRestrictionsClientResult::WebRestrictionsClientResult( |
| 14 base::android::ScopedJavaGlobalRef<jobject>& jresult) |
| 15 : jresult_(jresult) {} |
| 16 |
| 17 int WebRestrictionsClientResult::GetInt(int column) const { |
| 18 return Java_WebRestrictionsClientResult_getInt( |
| 19 base::android::AttachCurrentThread(), jresult_.obj(), column); |
| 20 } |
| 21 |
| 22 std::string WebRestrictionsClientResult::GetString(int column) const { |
| 23 JNIEnv* env = base::android::AttachCurrentThread(); |
| 24 return base::android::ConvertJavaStringToUTF8( |
| 25 env, |
| 26 Java_WebRestrictionsClientResult_getString(env, jresult_.obj(), column)); |
| 27 } |
| 28 |
| 29 std::string WebRestrictionsClientResult::GetColumnName(int column) const { |
| 30 JNIEnv* env = base::android::AttachCurrentThread(); |
| 31 return base::android::ConvertJavaStringToUTF8( |
| 32 env, Java_WebRestrictionsClientResult_getColumnName(env, jresult_.obj(), |
| 33 column)); |
| 34 } |
| 35 |
| 36 bool WebRestrictionsClientResult::ShouldProceed() const { |
| 37 return Java_WebRestrictionsClientResult_shouldProceed( |
| 38 base::android::AttachCurrentThread(), jresult_.obj()); |
| 39 } |
| 40 |
| 41 int web_restrictions::WebRestrictionsClientResult::GetColumnCount() const { |
| 42 return Java_WebRestrictionsClientResult_getColumnCount( |
| 43 base::android::AttachCurrentThread(), jresult_.obj()); |
| 44 } |
| 45 |
| 46 bool web_restrictions::WebRestrictionsClientResult::IsString(int column) const { |
| 47 return Java_WebRestrictionsClientResult_isString( |
| 48 base::android::AttachCurrentThread(), jresult_.obj(), column); |
| 49 } |
| 50 |
| 51 bool WebRestrictionsClientResult::Register(JNIEnv* env) { // static |
| 52 return RegisterNativesImpl(env); |
| 53 } |
| 54 |
| 55 } // namespace web_restrictions |
OLD | NEW |