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

Unified Diff: components/gcm_driver/instance_id/android/java/src/org/chromium/components/gcm_driver/instance_id/InstanceIDBridge.java

Issue 2810863003: Android: Remove GetApplicationContext: components/ (Closed)
Patch Set: Fix tests Created 3 years, 8 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: components/gcm_driver/instance_id/android/java/src/org/chromium/components/gcm_driver/instance_id/InstanceIDBridge.java
diff --git a/components/gcm_driver/instance_id/android/java/src/org/chromium/components/gcm_driver/instance_id/InstanceIDBridge.java b/components/gcm_driver/instance_id/android/java/src/org/chromium/components/gcm_driver/instance_id/InstanceIDBridge.java
index f819390a63e48e24ee19d0e6771515277cbe36a6..d0c91f4644956bf719776d6c3f6c3a7c02e10cfd 100644
--- a/components/gcm_driver/instance_id/android/java/src/org/chromium/components/gcm_driver/instance_id/InstanceIDBridge.java
+++ b/components/gcm_driver/instance_id/android/java/src/org/chromium/components/gcm_driver/instance_id/InstanceIDBridge.java
@@ -4,12 +4,12 @@
package org.chromium.components.gcm_driver.instance_id;
-import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import com.google.android.gms.iid.InstanceID;
+import org.chromium.base.ContextUtils;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
@@ -22,7 +22,6 @@ import java.util.concurrent.ExecutionException;
*/
@JNINamespace("instance_id")
public class InstanceIDBridge {
- private final Context mContext;
private final String mSubtype;
private long mNativeInstanceIDAndroid;
/**
@@ -33,9 +32,7 @@ public class InstanceIDBridge {
private static boolean sBlockOnAsyncTasksForTesting;
- private InstanceIDBridge(
- long nativeInstanceIDAndroid, Context context, String subtype) {
- mContext = context.getApplicationContext(); // Storing activity context would leak activity.
+ private InstanceIDBridge(long nativeInstanceIDAndroid, String subtype) {
mSubtype = subtype;
mNativeInstanceIDAndroid = nativeInstanceIDAndroid;
}
@@ -45,9 +42,8 @@ public class InstanceIDBridge {
* share an underlying InstanceIDWithSubtype.
*/
@CalledByNative
- public static InstanceIDBridge create(
- long nativeInstanceIDAndroid, Context context, String subtype) {
- return new InstanceIDBridge(nativeInstanceIDAndroid, context, subtype);
+ public static InstanceIDBridge create(long nativeInstanceIDAndroid, String subtype) {
+ return new InstanceIDBridge(nativeInstanceIDAndroid, subtype);
}
/**
@@ -198,7 +194,8 @@ public class InstanceIDBridge {
protected Result doInBackground(Void... params) {
synchronized (InstanceIDBridge.this) {
if (mInstanceID == null) {
- mInstanceID = InstanceIDWithSubtype.getInstance(mContext, mSubtype);
+ mInstanceID = InstanceIDWithSubtype.getInstance(
+ ContextUtils.getApplicationContext(), mSubtype);
}
}
return doBackgroundWork();
« no previous file with comments | « components/gcm_driver/gcm_driver_android.cc ('k') | components/gcm_driver/instance_id/instance_id_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698