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

Unified Diff: blimp/client/core/android/blimp_contents_impl_android.cc

Issue 2059443002: Java versions of BlimpContents[,Observer] and BlimpNavigationController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chrome-with-blimp
Patch Set: git merge origin/master - track master Created 4 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: blimp/client/core/android/blimp_contents_impl_android.cc
diff --git a/blimp/client/core/android/blimp_contents_impl_android.cc b/blimp/client/core/android/blimp_contents_impl_android.cc
new file mode 100644
index 0000000000000000000000000000000000000000..bee849691bb3f057e92105e332c6dfe4a7396b5e
--- /dev/null
+++ b/blimp/client/core/android/blimp_contents_impl_android.cc
@@ -0,0 +1,58 @@
+// 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 "blimp/client/core/android/blimp_contents_impl_android.h"
+
+#include "base/android/jni_android.h"
+#include "base/android/scoped_java_ref.h"
+#include "blimp/client/core/android/blimp_navigation_controller_impl_android.h"
+#include "jni/BlimpContentsImpl_jni.h"
+
+namespace blimp {
+namespace client {
+
+// static
+bool BlimpContentsImplAndroid::RegisterJni(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
+// static
+BlimpContentsImplAndroid* BlimpContentsImplAndroid::FromJavaObject(
+ JNIEnv* env,
+ jobject jobj) {
+ return reinterpret_cast<BlimpContentsImplAndroid*>(
+ Java_BlimpContentsImpl_getNativePtr(env, jobj));
+}
+
+base::android::ScopedJavaLocalRef<jobject>
+BlimpContentsImplAndroid::GetJavaObject() {
+ return base::android::ScopedJavaLocalRef<jobject>(java_obj_);
+}
+
+BlimpContentsImplAndroid::BlimpContentsImplAndroid(
+ BlimpContentsImpl* blimp_contents_impl)
+ : blimp_contents_impl_(blimp_contents_impl),
+ blimp_navigation_controller_impl_android_(
+ static_cast<BlimpNavigationControllerImpl*>(
+ &(blimp_contents_impl->GetNavigationController()))) {
+ JNIEnv* env = base::android::AttachCurrentThread();
+
+ java_obj_.Reset(
+ env, Java_BlimpContentsImpl_create(
+ env, reinterpret_cast<intptr_t>(this),
+ blimp_navigation_controller_impl_android_.GetJavaObject().obj())
+ .obj());
+}
+
+void BlimpContentsImplAndroid::Destroy(JNIEnv* env, jobject jobj) {
+ delete blimp_contents_impl_;
+}
+
+BlimpContentsImplAndroid::~BlimpContentsImplAndroid() {
+ Java_BlimpContentsImpl_clearNativePtr(base::android::AttachCurrentThread(),
+ java_obj_.obj());
+}
+
+} // namespace client
+} // namespace blimp
« no previous file with comments | « blimp/client/core/android/blimp_contents_impl_android.h ('k') | blimp/client/core/android/blimp_contents_observer_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698