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

Unified Diff: chromecast/base/java/src/org/chromium/chromecast/base/SystemTimeChangeNotifierAndroid.java

Issue 2807263002: Android: Remove GetApplicationContext for cast (Closed)
Patch Set: 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: chromecast/base/java/src/org/chromium/chromecast/base/SystemTimeChangeNotifierAndroid.java
diff --git a/chromecast/base/java/src/org/chromium/chromecast/base/SystemTimeChangeNotifierAndroid.java b/chromecast/base/java/src/org/chromium/chromecast/base/SystemTimeChangeNotifierAndroid.java
index f7451c4c3b4c7aad88fd5c85c2d1935a2035c1bd..da3aaf1e6708417d59883bd932978f0e6683c6dc 100644
--- a/chromecast/base/java/src/org/chromium/chromecast/base/SystemTimeChangeNotifierAndroid.java
+++ b/chromecast/base/java/src/org/chromium/chromecast/base/SystemTimeChangeNotifierAndroid.java
@@ -9,6 +9,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import org.chromium.base.ContextUtils;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
@@ -18,17 +19,14 @@ import org.chromium.base.annotations.JNINamespace;
*/
@JNINamespace("chromecast")
public final class SystemTimeChangeNotifierAndroid {
- private final Context mContext;
private BroadcastReceiver mTimeChangeObserver;
@CalledByNative
- private static SystemTimeChangeNotifierAndroid create(Context context) {
- return new SystemTimeChangeNotifierAndroid(context);
+ private static SystemTimeChangeNotifierAndroid create() {
+ return new SystemTimeChangeNotifierAndroid();
}
- private SystemTimeChangeNotifierAndroid(Context context) {
- mContext = context;
- }
+ private SystemTimeChangeNotifierAndroid() {}
@CalledByNative
private void initializeFromNative(final long nativeSystemTimeChangeNotifier) {
@@ -40,11 +38,11 @@ public final class SystemTimeChangeNotifierAndroid {
}
};
IntentFilter filter = new IntentFilter(Intent.ACTION_TIME_CHANGED);
- mContext.registerReceiver(mTimeChangeObserver, filter);
+ ContextUtils.getApplicationContext().registerReceiver(mTimeChangeObserver, filter);
}
@CalledByNative private void finalizeFromNative() {
- mContext.unregisterReceiver(mTimeChangeObserver);
+ ContextUtils.getApplicationContext().unregisterReceiver(mTimeChangeObserver);
mTimeChangeObserver = null;
}

Powered by Google App Engine
This is Rietveld 408576698