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

Unified Diff: media/capture/content/android/java/src/org/chromium/media/ScreenCapture.java

Issue 2847523002: Android: Remove GetApplicationContext part 4 (Closed)
Patch Set: Rebase and fix build 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: media/capture/content/android/java/src/org/chromium/media/ScreenCapture.java
diff --git a/media/capture/content/android/java/src/org/chromium/media/ScreenCapture.java b/media/capture/content/android/java/src/org/chromium/media/ScreenCapture.java
index 11a8a3558f643931462b636dc8955e6abcca52fc..57b78364fda82a28f4b8769f99a8cbf0b91227f1 100644
--- a/media/capture/content/android/java/src/org/chromium/media/ScreenCapture.java
+++ b/media/capture/content/android/java/src/org/chromium/media/ScreenCapture.java
@@ -28,6 +28,7 @@ import android.view.Surface;
import android.view.WindowManager;
import org.chromium.base.ApplicationStatus;
+import org.chromium.base.ContextUtils;
import org.chromium.base.Log;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
@@ -48,7 +49,6 @@ public class ScreenCapture extends Fragment {
// Native callback context variable.
private final long mNativeScreenCaptureMachineAndroid;
- private final Context mContext;
private static enum CaptureState { ATTACHED, ALLOWED, STARTED, STOPPING, STOPPED }
private static enum DeviceOrientation { PORTRAIT, LANDSCAPE }
@@ -72,17 +72,15 @@ public class ScreenCapture extends Fragment {
private int mFormat;
private int mResultCode;
- ScreenCapture(Context context, long nativeScreenCaptureMachineAndroid) {
- mContext = context;
+ ScreenCapture(long nativeScreenCaptureMachineAndroid) {
mNativeScreenCaptureMachineAndroid = nativeScreenCaptureMachineAndroid;
}
// Factory method.
@CalledByNative
- static ScreenCapture createScreenCaptureMachine(
- Context context, long nativeScreenCaptureMachineAndroid) {
+ static ScreenCapture createScreenCaptureMachine(long nativeScreenCaptureMachineAndroid) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- return new ScreenCapture(context, nativeScreenCaptureMachineAndroid);
+ return new ScreenCapture(nativeScreenCaptureMachineAndroid);
}
return null;
}
@@ -209,15 +207,17 @@ public class ScreenCapture extends Fragment {
mWidth = width;
mHeight = height;
- mMediaProjectionManager = (MediaProjectionManager) mContext.getSystemService(
- Context.MEDIA_PROJECTION_SERVICE);
+ mMediaProjectionManager =
+ (MediaProjectionManager) ContextUtils.getApplicationContext().getSystemService(
+ Context.MEDIA_PROJECTION_SERVICE);
if (mMediaProjectionManager == null) {
Log.e(TAG, "mMediaProjectionManager is null");
return false;
}
WindowManager windowManager =
- (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
+ (WindowManager) ContextUtils.getApplicationContext().getSystemService(
+ Context.WINDOW_SERVICE);
mDisplay = windowManager.getDefaultDisplay();
DisplayMetrics metrics = new DisplayMetrics();
« no previous file with comments | « media/base/android/media_server_crash_listener.cc ('k') | media/capture/content/android/screen_capture_machine_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698