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

Side by Side Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 1419843002: Hold a reference to any kind of context in WindowAndroid. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove keyword explicit from TestResourceManagerImpl ctor. Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.android_webview; 5 package org.chromium.android_webview;
6 6
7 import android.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.app.Activity; 8 import android.app.Activity;
9 import android.content.ComponentCallbacks2; 9 import android.content.ComponentCallbacks2;
10 import android.content.Context; 10 import android.content.Context;
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 private static WeakHashMap<Activity, WindowAndroidWrapper> sActivityWindowMa p; 899 private static WeakHashMap<Activity, WindowAndroidWrapper> sActivityWindowMa p;
900 900
901 // getWindowAndroid is only called on UI thread, so there are no threading i ssues with lazy 901 // getWindowAndroid is only called on UI thread, so there are no threading i ssues with lazy
902 // initialization. 902 // initialization.
903 @SuppressFBWarnings("LI_LAZY_INIT_STATIC") 903 @SuppressFBWarnings("LI_LAZY_INIT_STATIC")
904 private static WindowAndroidWrapper getWindowAndroid(Context context) { 904 private static WindowAndroidWrapper getWindowAndroid(Context context) {
905 // TODO(boliu): WebView does not currently initialize ApplicationStatus, crbug.com/470582. 905 // TODO(boliu): WebView does not currently initialize ApplicationStatus, crbug.com/470582.
906 Activity activity = ContentViewCore.activityFromContext(context); 906 Activity activity = ContentViewCore.activityFromContext(context);
907 if (activity == null) { 907 if (activity == null) {
908 if (sCachedWindowAndroid == null) { 908 if (sCachedWindowAndroid == null) {
909 sCachedWindowAndroid = new WindowAndroidWrapper( 909 sCachedWindowAndroid = new WindowAndroidWrapper(new WindowAndroi d(context));
910 new WindowAndroid(context.getApplicationContext()));
911 } 910 }
912 return sCachedWindowAndroid; 911 return sCachedWindowAndroid;
913 } 912 }
914 913
915 if (sActivityWindowMap == null) sActivityWindowMap = new WeakHashMap<>() ; 914 if (sActivityWindowMap == null) sActivityWindowMap = new WeakHashMap<>() ;
916 WindowAndroidWrapper activityWindowAndroid = sActivityWindowMap.get(acti vity); 915 WindowAndroidWrapper activityWindowAndroid = sActivityWindowMap.get(acti vity);
917 if (activityWindowAndroid == null) { 916 if (activityWindowAndroid == null) {
918 final boolean listenToActivityState = false; 917 final boolean listenToActivityState = false;
919 activityWindowAndroid = new WindowAndroidWrapper( 918 activityWindowAndroid = new WindowAndroidWrapper(
920 new ActivityWindowAndroid(activity, listenToActivityState)); 919 new ActivityWindowAndroid(activity, listenToActivityState));
(...skipping 2258 matching lines...) Expand 10 before | Expand all | Expand 10 after
3179 private native void nativePreauthorizePermission(long nativeAwContents, Stri ng origin, 3178 private native void nativePreauthorizePermission(long nativeAwContents, Stri ng origin,
3180 long resources); 3179 long resources);
3181 3180
3182 private native void nativePostMessageToFrame(long nativeAwContents, String f rameId, 3181 private native void nativePostMessageToFrame(long nativeAwContents, String f rameId,
3183 String message, String targetOrigin, int[] msgPorts); 3182 String message, String targetOrigin, int[] msgPorts);
3184 3183
3185 private native void nativeCreateMessageChannel(long nativeAwContents, AwMess agePort[] ports); 3184 private native void nativeCreateMessageChannel(long nativeAwContents, AwMess agePort[] ports);
3186 3185
3187 private native void nativeGrantFileSchemeAccesstoChildProcess(long nativeAwC ontents); 3186 private native void nativeGrantFileSchemeAccesstoChildProcess(long nativeAwC ontents);
3188 } 3187 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698