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

Unified Diff: services/device/nfc/android/java/src/org/chromium/device/nfc/NfcImpl.java

Issue 2897313002: Android: Simplify isTablet and InterfaceRegistrars (Closed)
Patch Set: Pull out local variable Created 3 years, 7 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: services/device/nfc/android/java/src/org/chromium/device/nfc/NfcImpl.java
diff --git a/services/device/nfc/android/java/src/org/chromium/device/nfc/NfcImpl.java b/services/device/nfc/android/java/src/org/chromium/device/nfc/NfcImpl.java
index 53f44df31a937a8388bb3f6e78ba45b52b2cc083..3c6e2faefe208ca18052e8e67f8b576562a2a135 100644
--- a/services/device/nfc/android/java/src/org/chromium/device/nfc/NfcImpl.java
+++ b/services/device/nfc/android/java/src/org/chromium/device/nfc/NfcImpl.java
@@ -22,6 +22,7 @@ import android.os.Process;
import android.util.SparseArray;
import org.chromium.base.Callback;
+import org.chromium.base.ContextUtils;
import org.chromium.base.Log;
import org.chromium.device.mojom.Nfc;
import org.chromium.device.mojom.NfcClient;
@@ -117,11 +118,11 @@ public class NfcImpl implements Nfc {
*/
private Runnable mPushTimeoutRunnable;
- public NfcImpl(Context context, int hostId, NfcDelegate delegate) {
+ public NfcImpl(int hostId, NfcDelegate delegate) {
mHostId = hostId;
mDelegate = delegate;
- int permission =
- context.checkPermission(Manifest.permission.NFC, Process.myPid(), Process.myUid());
+ int permission = ContextUtils.getApplicationContext().checkPermission(
+ Manifest.permission.NFC, Process.myPid(), Process.myUid());
mHasPermission = permission == PackageManager.PERMISSION_GRANTED;
Callback<Activity> onActivityUpdatedCallback = new Callback<Activity>() {
@Override
@@ -137,7 +138,8 @@ public class NfcImpl implements Nfc {
mNfcAdapter = null;
mNfcManager = null;
} else {
- mNfcManager = (NfcManager) context.getSystemService(Context.NFC_SERVICE);
+ mNfcManager = (NfcManager) ContextUtils.getApplicationContext().getSystemService(
+ Context.NFC_SERVICE);
if (mNfcManager == null) {
Log.w(TAG, "NFC is not supported.");
mNfcAdapter = null;

Powered by Google App Engine
This is Rietveld 408576698