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

Unified Diff: ui/android/java/src/org/chromium/ui/resources/ResourceManager.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, 2 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: ui/android/java/src/org/chromium/ui/resources/ResourceManager.java
diff --git a/ui/android/java/src/org/chromium/ui/resources/ResourceManager.java b/ui/android/java/src/org/chromium/ui/resources/ResourceManager.java
index d58bddacddde6f35bddbf11b20a3bcb6470034b3..293b8c5f29110ca12cbd2f5ab29060d55374e77b 100644
--- a/ui/android/java/src/org/chromium/ui/resources/ResourceManager.java
+++ b/ui/android/java/src/org/chromium/ui/resources/ResourceManager.java
@@ -12,6 +12,7 @@ import android.util.SparseArray;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
+import org.chromium.ui.base.WindowAndroid;
import org.chromium.ui.resources.ResourceLoader.ResourceLoaderCallback;
import org.chromium.ui.resources.dynamics.DynamicResource;
import org.chromium.ui.resources.dynamics.DynamicResourceLoader;
@@ -51,12 +52,25 @@ public class ResourceManager implements ResourceLoaderCallback {
/**
* Creates an instance of a {@link ResourceManager}. This will
+ * @param windowAndroid A {@link WindowAndroid} instance to fetch a {@link Context}
+ * from which we can use to grab {@link Resources} from.
+ * @param staticResourceManagerPtr A pointer to the native component of this class.
+ * @return A new instance of a {@link ResourceManager}.
+ */
+ @CalledByNative
+ private static ResourceManager create(
+ WindowAndroid windowAndroid, long staticResourceManagerPtr) {
jdduke (slow) 2015/10/23 16:47:27 It's not really clear why we need both of these me
gsennton 2015/10/23 17:01:06 Right, so if we use the getter from the java side
boliu 2015/10/23 17:06:33 Hmm, looks like native getter is better in this ca
+ return new ResourceManager(windowAndroid.getDisplayContext(), staticResourceManagerPtr);
+ }
+
+ /**
+ * Creates an instance of a {@link ResourceManager}. This will
* @param context A {@link Context} instance to grab {@link Resources} from.
* @param staticResourceManagerPtr A pointer to the native component of this class.
* @return A new instance of a {@link ResourceManager}.
*/
@CalledByNative
- private static ResourceManager create(Context context, long staticResourceManagerPtr) {
+ private static ResourceManager createForTests(Context context, long staticResourceManagerPtr) {
return new ResourceManager(context, staticResourceManagerPtr);
}

Powered by Google App Engine
This is Rietveld 408576698