Index: content/public/android/java/src/org/chromium/content/browser/ContentVideoView.java |
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentVideoView.java b/content/public/android/java/src/org/chromium/content/browser/ContentVideoView.java |
index a1c2f1492ec1b3c39295bfac80f6b53c224d5767..a0c7692f4a6a1fd6e2d6bd07864dacef28236e49 100644 |
--- a/content/public/android/java/src/org/chromium/content/browser/ContentVideoView.java |
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentVideoView.java |
@@ -5,9 +5,11 @@ |
package org.chromium.content.browser; |
import android.app.Activity; |
+import android.content.pm.ActivityInfo; |
import android.app.AlertDialog; |
import android.content.Context; |
import android.content.DialogInterface; |
+import android.graphics.Point; |
import android.util.Log; |
import android.view.Gravity; |
import android.view.KeyEvent; |
@@ -77,6 +79,8 @@ public class ContentVideoView extends FrameLayout implements SurfaceHolder.Callb |
private String mErrorTitle; |
private String mVideoLoadingText; |
+ private int mSavedOrientation; |
+ private boolean mRotated; |
// This view will contain the video. |
private VideoSurfaceView mVideoSurfaceView; |
@@ -159,6 +163,14 @@ public class ContentVideoView extends FrameLayout implements SurfaceHolder.Callb |
} |
protected void showContentVideoView() { |
+ Activity a = (Activity) getContext(); |
+ Point displaySize = new Point(); |
+ a.getWindowManager().getDefaultDisplay().getSize(displaySize); |
+ if (displaySize.y > displaySize.x) { |
+ mSavedOrientation = a.getRequestedOrientation(); |
+ a.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); |
philipj_slow
2014/01/29 13:02:50
SCREEN_ORIENTATION_USER_LANDSCAPE is probably the
|
+ mRotated = true; |
+ } |
mVideoSurfaceView.getHolder().addCallback(this); |
this.addView(mVideoSurfaceView, new FrameLayout.LayoutParams( |
ViewGroup.LayoutParams.MATCH_PARENT, |
@@ -386,6 +398,13 @@ public class ContentVideoView extends FrameLayout implements SurfaceHolder.Callb |
nativeExitFullscreen(mNativeContentVideoView, relaseMediaPlayer); |
mNativeContentVideoView = 0; |
} |
+ |
+ if (mRotated) { |
+ Activity a = (Activity) getContext(); |
+ a.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); |
philipj_slow
2014/01/29 13:02:50
This line should be removed, it's overridden immed
|
+ a.setRequestedOrientation(mSavedOrientation); |
+ mRotated = false; |
+ } |
} |
@CalledByNative |