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

Unified Diff: blimp/client/core/blimp_contents_impl.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: fixed gn order thing and fixed java visibility 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/blimp_contents_impl.cc
diff --git a/blimp/client/core/blimp_contents_impl.cc b/blimp/client/core/blimp_contents_impl.cc
index ac4e264ed2bde580bc0d853dde7ec5c681e261ea..2bb2b46b02e311baed4ad385f5210b0df8af1e24 100644
--- a/blimp/client/core/blimp_contents_impl.cc
+++ b/blimp/client/core/blimp_contents_impl.cc
@@ -5,14 +5,55 @@
#include "blimp/client/core/blimp_contents_impl.h"
#include "base/memory/ptr_util.h"
+#include "base/supports_user_data.h"
#include "blimp/client/core/public/blimp_contents_observer.h"
+#if defined(OS_ANDROID)
+#include "blimp/client/core/android/blimp_contents_impl_android.h"
+#endif // OS_ANDROID
+
namespace blimp {
namespace client {
+namespace {
+
+#if defined(OS_ANDROID)
+const char kBlimpContentsImplAndroidKey[] = "blimp_contents_impl_android";
+#endif // OS_ANDROID
+}
+
BlimpContentsImpl::BlimpContentsImpl() : navigation_controller_(this) {}
-BlimpContentsImpl::~BlimpContentsImpl() {}
+BlimpContentsImpl::~BlimpContentsImpl() {
+#if defined(OS_ANDROID)
+ BlimpContentsImplAndroid* blimp_contents_impl_android =
+ static_cast<BlimpContentsImplAndroid*>(
+ GetUserData(kBlimpContentsImplAndroidKey));
+ if (blimp_contents_impl_android) {
+ delete blimp_contents_impl_android;
David Trainor- moved to gerrit 2016/06/20 17:24:22 Will this crash? Doesn't the underlying map actua
nyquist 2016/06/21 20:27:20 Yes it will. :-( Updated the Java test code to ens
+ }
+#endif
+}
+
+#if defined(OS_ANDROID)
+
+base::android::ScopedJavaLocalRef<jobject>
+BlimpContentsImpl::GetJavaBlimpContentsImpl() {
+ return GetBlimpContentsImplAndroid()->GetJavaObject();
+}
+
+BlimpContentsImplAndroid* BlimpContentsImpl::GetBlimpContentsImplAndroid() {
+ BlimpContentsImplAndroid* blimp_contents_impl_android =
+ static_cast<BlimpContentsImplAndroid*>(
+ GetUserData(kBlimpContentsImplAndroidKey));
+ if (!blimp_contents_impl_android) {
+ blimp_contents_impl_android = new BlimpContentsImplAndroid(this);
+ SetUserData(kBlimpContentsImplAndroidKey, blimp_contents_impl_android);
+ }
+ return blimp_contents_impl_android;
+}
+
+#endif // defined(OS_ANDROID)
BlimpNavigationControllerImpl& BlimpContentsImpl::GetNavigationController() {
return navigation_controller_;

Powered by Google App Engine
This is Rietveld 408576698