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

Unified Diff: ui/aura/window_tree_host_platform.cc

Issue 1455793005: Adding a way to associate Android Activities with PlatformWindowAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@auraclank_upstream_native_widget
Patch Set: Making the new property "owned" property. Created 5 years 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
« no previous file with comments | « ui/aura/client/aura_constants.cc ('k') | ui/platform_window/android/platform_window_android.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/window_tree_host_platform.cc
diff --git a/ui/aura/window_tree_host_platform.cc b/ui/aura/window_tree_host_platform.cc
index 2a7d0541a744fa9e5747798d2f57699cc918aac6..59398808386fe2c05c6a52f4ca391545571978a4 100644
--- a/ui/aura/window_tree_host_platform.cc
+++ b/ui/aura/window_tree_host_platform.cc
@@ -11,6 +11,8 @@
#include "ui/gfx/screen.h"
#if defined(OS_ANDROID)
+#include "base/android/jni_android.h"
+#include "ui/aura/client/aura_constants.h"
#include "ui/platform_window/android/platform_window_android.h"
#endif
@@ -72,6 +74,18 @@ gfx::AcceleratedWidget WindowTreeHostPlatform::GetAcceleratedWidget() {
}
void WindowTreeHostPlatform::ShowImpl() {
+#if defined(OS_ANDROID)
+ JNIEnv* env = base::android::AttachCurrentThread();
+ ui::PlatformWindowAndroid* pwa =
+ ui::PlatformWindowAndroid::From(window_.get());
+ if (!pwa->IsAttachedToActivity()) {
+ base::android::ScopedJavaLocalRef<jobject> activity =
+ window()->GetProperty(aura::client::kActivityForRootWindow)->get(env);
+ if (activity.is_null())
+ return;
+ pwa->AttachToActivity(env, activity);
+ }
+#endif
window_->Show();
}
« no previous file with comments | « ui/aura/client/aura_constants.cc ('k') | ui/platform_window/android/platform_window_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698