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

Issue 1455793005: Adding a way to associate Android Activities with PlatformWindowAndroid (Closed)

Created:
5 years, 1 month ago by mfomitchev
Modified:
4 years, 11 months ago
Reviewers:
sadrul
CC:
chromium-reviews, kalyank, sadrul
Base URL:
https://chromium.googlesource.com/chromium/src.git@auraclank_upstream_native_widget
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Adding a way to associate Android Activities with PlatformWindowAndroid Adding kActivityForRootWindow property to aura::Window and using this new property in WindowTreeHostPlatform::Show to set PlatformWindowAndroid as the content view on the Activity. The expectation is that the client code will set the activity as a property on the root window before WTH::Show() is called. BUG=507792

Patch Set 1 #

Total comments: 10

Patch Set 2 : Adding WindowTreeHostPlatform.java #

Patch Set 3 : Updating upstream #

Patch Set 4 : Fleshing out more: WindowTreeHostPlatformAndroid.java #

Patch Set 5 : Getting rid of WindowTreeHostPlatformAndroid.java, just using a static method in PlatformWindowAndr… #

Total comments: 6

Patch Set 6 : Addressing feedback #

Total comments: 5

Patch Set 7 : Addressing feedback. #

Patch Set 8 : Rebase + using JavaObjectWeakGlobalRef* instead of jobject for the new WindowProperty. #

Patch Set 9 : Making the new property "owned" property. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+69 lines, -8 lines) Patch
M ui/aura/client/aura_constants.h View 1 2 3 4 5 6 7 2 chunks +10 lines, -0 lines 0 comments Download
M ui/aura/client/aura_constants.cc View 1 2 3 4 5 6 7 8 2 chunks +15 lines, -0 lines 0 comments Download
M ui/aura/window_tree_host_platform.cc View 1 2 3 4 5 6 7 2 chunks +14 lines, -0 lines 0 comments Download
M ui/platform_window/android/platform_window_android.h View 1 2 3 4 5 6 7 1 chunk +4 lines, -0 lines 0 comments Download
M ui/platform_window/android/platform_window_android.cc View 1 2 3 4 5 6 7 3 chunks +26 lines, -8 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 25 (5 generated)
mfomitchev
https://codereview.chromium.org/1455793005/diff/1/ui/aura/client/aura_constants.h File ui/aura/client/aura_constants.h (right): https://codereview.chromium.org/1455793005/diff/1/ui/aura/client/aura_constants.h#newcode27 ui/aura/client/aura_constants.h:27: AURA_EXPORT extern const WindowProperty<jobject>* const kActivityForRootWindow; Not sure if ...
5 years, 1 month ago (2015-11-19 20:57:05 UTC) #1
mfomitchev
Sadrul, can you PTAL?
5 years, 1 month ago (2015-11-19 20:57:29 UTC) #3
sadrul
https://codereview.chromium.org/1455793005/diff/1/ui/platform_window/android/java/src/org/chromium/ui/PlatformWindowAndroid.java File ui/platform_window/android/java/src/org/chromium/ui/PlatformWindowAndroid.java (right): https://codereview.chromium.org/1455793005/diff/1/ui/platform_window/android/java/src/org/chromium/ui/PlatformWindowAndroid.java#newcode39 ui/platform_window/android/java/src/org/chromium/ui/PlatformWindowAndroid.java:39: } It's not clear who will be calling createForActivity()
5 years, 1 month ago (2015-11-20 18:21:09 UTC) #4
mfomitchev
https://codereview.chromium.org/1455793005/diff/1/ui/platform_window/android/java/src/org/chromium/ui/PlatformWindowAndroid.java File ui/platform_window/android/java/src/org/chromium/ui/PlatformWindowAndroid.java (right): https://codereview.chromium.org/1455793005/diff/1/ui/platform_window/android/java/src/org/chromium/ui/PlatformWindowAndroid.java#newcode39 ui/platform_window/android/java/src/org/chromium/ui/PlatformWindowAndroid.java:39: } Please see my comment in window_tree_host_platform.cc. It can ...
5 years, 1 month ago (2015-11-20 18:27:15 UTC) #5
sadrul
https://codereview.chromium.org/1455793005/diff/1/ui/aura/window_tree_host_platform.cc File ui/aura/window_tree_host_platform.cc (right): https://codereview.chromium.org/1455793005/diff/1/ui/aura/window_tree_host_platform.cc#newcode81 ui/aura/window_tree_host_platform.cc:81: // Java_PlatformWindowAndroid_createForActivity( On 2015/11/19 20:57:05, mfomitchev wrote: > We ...
5 years, 1 month ago (2015-11-20 18:32:35 UTC) #6
mfomitchev
https://codereview.chromium.org/1455793005/diff/1/ui/aura/window_tree_host_platform.cc File ui/aura/window_tree_host_platform.cc (right): https://codereview.chromium.org/1455793005/diff/1/ui/aura/window_tree_host_platform.cc#newcode81 ui/aura/window_tree_host_platform.cc:81: // Java_PlatformWindowAndroid_createForActivity( Well, the problem is that PWA has ...
5 years, 1 month ago (2015-11-20 18:35:01 UTC) #7
sadrul
https://codereview.chromium.org/1455793005/diff/1/ui/aura/window_tree_host_platform.cc File ui/aura/window_tree_host_platform.cc (right): https://codereview.chromium.org/1455793005/diff/1/ui/aura/window_tree_host_platform.cc#newcode81 ui/aura/window_tree_host_platform.cc:81: // Java_PlatformWindowAndroid_createForActivity( On 2015/11/20 18:35:01, mfomitchev wrote: > Well, ...
5 years, 1 month ago (2015-11-20 20:04:13 UTC) #8
mfomitchev
https://codereview.chromium.org/1455793005/diff/1/ui/aura/window_tree_host_platform.cc File ui/aura/window_tree_host_platform.cc (right): https://codereview.chromium.org/1455793005/diff/1/ui/aura/window_tree_host_platform.cc#newcode81 ui/aura/window_tree_host_platform.cc:81: // Java_PlatformWindowAndroid_createForActivity( Something like this: - We will have ...
5 years, 1 month ago (2015-11-20 20:11:35 UTC) #9
mfomitchev
On 2015/11/20 20:11:35, mfomitchev wrote: > https://codereview.chromium.org/1455793005/diff/1/ui/aura/window_tree_host_platform.cc > File ui/aura/window_tree_host_platform.cc (right): > > https://codereview.chromium.org/1455793005/diff/1/ui/aura/window_tree_host_platform.cc#newcode81 > ...
5 years, 1 month ago (2015-11-23 17:26:28 UTC) #10
mfomitchev
Patch Set 4 is the working version where WindowTreeHostPlatform.java is used to create PlatformWindowAndroid. I ...
5 years, 1 month ago (2015-11-24 02:45:00 UTC) #11
sadrul
I think the CL description is a little out of date. Mind updating that? Also, ...
5 years ago (2015-11-25 20:59:44 UTC) #12
mfomitchev
Addressed the feedback except for this part: > Also, it would be good to include ...
5 years ago (2015-11-27 20:57:15 UTC) #16
mfomitchev
*ping*
5 years ago (2015-12-01 15:03:04 UTC) #17
sadrul
s/WindowTreeHostAndroid/WindowTreeHostPlatform/ in the CL description. https://codereview.chromium.org/1455793005/diff/100001/ui/platform_window/android/platform_window_android.cc File ui/platform_window/android/platform_window_android.cc (right): https://codereview.chromium.org/1455793005/diff/100001/ui/platform_window/android/platform_window_android.cc#newcode78 ui/platform_window/android/platform_window_android.cc:78: JNIEnv* env = base::android::AttachCurrentThread(); ...
5 years ago (2015-12-01 21:29:34 UTC) #18
mfomitchev
https://codereview.chromium.org/1455793005/diff/100001/ui/platform_window/android/platform_window_android.cc File ui/platform_window/android/platform_window_android.cc (right): https://codereview.chromium.org/1455793005/diff/100001/ui/platform_window/android/platform_window_android.cc#newcode78 ui/platform_window/android/platform_window_android.cc:78: JNIEnv* env = base::android::AttachCurrentThread(); On 2015/12/01 21:29:34, sadrul wrote: ...
5 years ago (2015-12-01 21:50:51 UTC) #20
mfomitchev
*ping*
5 years ago (2015-12-03 18:57:33 UTC) #21
mfomitchev
Based on sievers's feedback in crrev.com/1487123002, I guess we shouldn't be storing a raw jobject ...
5 years ago (2015-12-03 21:04:29 UTC) #22
no sievers
On 2015/12/03 21:04:29, mfomitchev wrote: > Based on sievers's feedback in crrev.com/1487123002, I guess we ...
5 years ago (2015-12-03 21:44:31 UTC) #23
no sievers
On 2015/12/03 21:44:31, sievers wrote: > On 2015/12/03 21:04:29, mfomitchev wrote: > > Based on ...
5 years ago (2015-12-03 21:55:54 UTC) #24
mfomitchev
5 years ago (2015-12-03 23:22:18 UTC) #25
On 2015/12/03 21:55:54, sievers wrote:
> On 2015/12/03 21:44:31, sievers wrote:
> > On 2015/12/03 21:04:29, mfomitchev wrote:
> > > Based on sievers's feedback in crrev.com/1487123002, I guess we shouldn't
be
> > > storing a raw jobject as a Window property :/
> > > We should probably change it to a weak reference.
> > 
> > Yes, you can use JavaObjectWeakGlobalRef.
> > 
> > We can do this as a follow-up but:
> > Eventually we'd want to handle recreating the PWA Java object and activity
if
> it
> > got destroyed.
> > From onDestroy() we could adjust the visibility to hidden (so that all
> resources
> > get released in case we were destroyed while visible), and when Show()
happens
> > the next time we can recreate activity and PWA.
> 
> Actually this didn't make sense, since the activity would get recreated first.
> So we'd have to figure out if we want the activity destruction to cause the
> tear-down of all the native parts or not.

Yeah, I think we'd want to do that. We should call nativeDestroy, which would
call WTHA::OnClosed(), which should probably result in WTHA's self destruction.
Perhaps we can override onDetachedFromWindow in PWA to be notified when the
Activity is destroyed?
If all else fails, we could use a special ID for PWA, so that we can find it and
call something on it from Activity.onDestroy.
In any case, I think that can be done in a separate CL.

Powered by Google App Engine
This is Rietveld 408576698