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

Unified Diff: chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastShellActivity.java

Issue 1972433002: [Chromecast] Handle device scale factor correctly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test compile error Created 4 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: chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastShellActivity.java
diff --git a/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastShellActivity.java b/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastShellActivity.java
index 32231cca71e87057d5e9f5baa1d5c8e64050bba9..4f36020b6d2285402a73df54045057f76554a5c0 100644
--- a/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastShellActivity.java
+++ b/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastShellActivity.java
@@ -19,13 +19,11 @@ import android.view.MotionEvent;
import android.view.WindowManager;
import android.widget.Toast;
-import org.chromium.base.CommandLine;
import org.chromium.base.Log;
import org.chromium.content.browser.ActivityContentVideoViewEmbedder;
import org.chromium.content.browser.ContentVideoViewEmbedder;
import org.chromium.content.browser.ContentViewClient;
import org.chromium.content.browser.ContentViewCore;
-import org.chromium.content.common.ContentSwitches;
import org.chromium.ui.base.WindowAndroid;
/**
@@ -36,9 +34,6 @@ public class CastShellActivity extends Activity {
private static final boolean DEBUG = false;
private static final String ACTIVE_SHELL_URL_KEY = "activeUrl";
- private static final int DEFAULT_HEIGHT_PIXELS = 720;
- public static final String ACTION_EXTRA_RESOLUTION_HEIGHT =
- "org.chromium.chromecast.shell.intent.extra.RESOLUTION_HEIGHT";
private CastWindowManager mCastWindowManager;
private AudioManager mAudioManager;
@@ -112,7 +107,6 @@ public class CastShellActivity extends Activity {
finish();
}
});
- setResolution();
mCastWindowManager.setWindow(new WindowAndroid(this));
registerBroadcastReceiver();
@@ -270,29 +264,6 @@ public class CastShellActivity extends Activity {
broadcastManager.unregisterReceiver(mBroadcastReceiver);
}
- private void setResolution() {
- CommandLine commandLine = CommandLine.getInstance();
- int defaultHeight = DEFAULT_HEIGHT_PIXELS;
- if (commandLine.hasSwitch(CastSwitches.DEFAULT_RESOLUTION_HEIGHT)) {
- String commandLineHeightString =
- commandLine.getSwitchValue(CastSwitches.DEFAULT_RESOLUTION_HEIGHT);
- try {
- defaultHeight = Integer.parseInt(commandLineHeightString);
- } catch (NumberFormatException e) {
- Log.w(TAG, "Ignored invalid height: %d", commandLineHeightString);
- }
- }
- int requestedHeight =
- getIntent().getIntExtra(ACTION_EXTRA_RESOLUTION_HEIGHT, defaultHeight);
- int displayHeight = getResources().getDisplayMetrics().heightPixels;
- // Clamp within [defaultHeight, displayHeight]
- int desiredHeight = Math.min(displayHeight, Math.max(defaultHeight, requestedHeight));
- double deviceScaleFactor = ((double) displayHeight) / desiredHeight;
- Log.d(TAG, "Using scale factor %f to set height %d", deviceScaleFactor, desiredHeight);
- commandLine.appendSwitchWithValue(
- ContentSwitches.FORCE_DEVICE_SCALE_FACTOR, String.valueOf(deviceScaleFactor));
- }
-
private void exitIfUrlMissing() {
Intent intent = getIntent();
if (intent != null && intent.getData() != null && !intent.getData().equals(Uri.EMPTY)) {

Powered by Google App Engine
This is Rietveld 408576698