Index: components/web_restrictions/browser/web_restrictions_client_result.cc |
diff --git a/components/web_restrictions/browser/web_restrictions_client_result.cc b/components/web_restrictions/browser/web_restrictions_client_result.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6eab3d5beb9d761a25531aae5edca3262e069a55 |
--- /dev/null |
+++ b/components/web_restrictions/browser/web_restrictions_client_result.cc |
@@ -0,0 +1,54 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "base/android/jni_string.h" |
+#include "components/web_restrictions/browser/web_restrictions_client_result.h" |
+#include "jni/WebRestrictionsClientResult_jni.h" |
+ |
+namespace web_restrictions { |
+ |
+WebRestrictionsClientResult::WebRestrictionsClientResult( |
+ base::android::ScopedJavaGlobalRef<jobject>& jresult) |
+ : jresult_(jresult) {} |
+ |
+WebRestrictionsClientResult::~WebRestrictionsClientResult() = default; |
+ |
+WebRestrictionsClientResult::WebRestrictionsClientResult( |
+ const WebRestrictionsClientResult& other) = default; |
+ |
+int WebRestrictionsClientResult::GetInt(int column) const { |
+ return Java_WebRestrictionsClientResult_getInt( |
+ base::android::AttachCurrentThread(), jresult_.obj(), column); |
+} |
+ |
+std::string WebRestrictionsClientResult::GetString(int column) const { |
+ JNIEnv* env = base::android::AttachCurrentThread(); |
+ return base::android::ConvertJavaStringToUTF8( |
+ env, |
+ Java_WebRestrictionsClientResult_getString(env, jresult_.obj(), column)); |
+} |
+ |
+std::string WebRestrictionsClientResult::GetColumnName(int column) const { |
+ JNIEnv* env = base::android::AttachCurrentThread(); |
+ return base::android::ConvertJavaStringToUTF8( |
+ env, Java_WebRestrictionsClientResult_getColumnName(env, jresult_.obj(), |
+ column)); |
+} |
+ |
+bool WebRestrictionsClientResult::ShouldProceed() const { |
+ return Java_WebRestrictionsClientResult_shouldProceed( |
+ base::android::AttachCurrentThread(), jresult_.obj()); |
+} |
+ |
+int web_restrictions::WebRestrictionsClientResult::GetColumnCount() const { |
+ return Java_WebRestrictionsClientResult_getColumnCount( |
+ base::android::AttachCurrentThread(), jresult_.obj()); |
+} |
+ |
+bool web_restrictions::WebRestrictionsClientResult::IsString(int column) const { |
+ return Java_WebRestrictionsClientResult_isString( |
+ base::android::AttachCurrentThread(), jresult_.obj(), column); |
+} |
+ |
+} // namespace web_restrictions |