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

Unified Diff: media/capture/video/android/java/src/org/chromium/media/VideoCapture.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/video/android/java/src/org/chromium/media/VideoCapture.java
diff --git a/media/capture/video/android/java/src/org/chromium/media/VideoCapture.java b/media/capture/video/android/java/src/org/chromium/media/VideoCapture.java
index 9cd599fb8b7de76d75a7d0e442ddbacf039535f5..a69f654bcdaf125a90b72b67fe45b56b30664c18 100644
--- a/media/capture/video/android/java/src/org/chromium/media/VideoCapture.java
+++ b/media/capture/video/android/java/src/org/chromium/media/VideoCapture.java
@@ -9,6 +9,7 @@ import android.graphics.ImageFormat;
import android.view.Surface;
import android.view.WindowManager;
+import org.chromium.base.ContextUtils;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
@@ -21,7 +22,7 @@ import java.util.List;
/**
* Video Capture Device base class, defines a set of methods that native code
* needs to use to configure, start capture, and to be reached by callbacks and
- * provides some neccesary data type(s) with accessors.
+ * provides some necessary data type(s) with accessors.
**/
@JNINamespace("media")
public abstract class VideoCapture {
@@ -46,15 +47,13 @@ public abstract class VideoCapture {
protected boolean mInvertDeviceOrientationReadings;
protected VideoCaptureFormat mCaptureFormat;
- protected final Context mContext;
protected final int mId;
// Native callback context variable.
protected final long mNativeVideoCaptureDeviceAndroid;
protected boolean mUseBackgroundThreadForTesting;
- VideoCapture(Context context, int id, long nativeVideoCaptureDeviceAndroid) {
- mContext = context;
+ VideoCapture(int id, long nativeVideoCaptureDeviceAndroid) {
mId = id;
mNativeVideoCaptureDeviceAndroid = nativeVideoCaptureDeviceAndroid;
}
@@ -144,9 +143,9 @@ public abstract class VideoCapture {
}
protected final int getDeviceRotation() {
- if (mContext == null) return 0;
final int orientation;
- WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
+ WindowManager wm = (WindowManager) ContextUtils.getApplicationContext().getSystemService(
+ Context.WINDOW_SERVICE);
switch (wm.getDefaultDisplay().getRotation()) {
case Surface.ROTATION_90:
orientation = 90;

Powered by Google App Engine
This is Rietveld 408576698