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

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

Issue 1051083003: Cast ATV: default resolution back to 720, but with command-line switch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastSwitches.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 318de79c242d2cea1f28d6c12975757738dd2e6a..2d70a754a61458cba91f9b928c354ccc7298e15d 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
@@ -24,6 +24,7 @@ import org.chromium.content.browser.ActivityContentVideoViewClient;
import org.chromium.content.browser.ContentVideoViewClient;
import org.chromium.content.browser.ContentViewClient;
import org.chromium.content.browser.ContentViewCore;
+import org.chromium.content.common.ContentSwitches;
import org.chromium.ui.base.WindowAndroid;
/**
@@ -34,7 +35,7 @@ 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 = 1080;
+ private static final int DEFAULT_HEIGHT_PIXELS = 720;
public static final String ACTION_EXTRA_RESOLUTION_HEIGHT =
"org.chromium.chromecast.shell.intent.extra.RESOLUTION_HEIGHT";
@@ -245,16 +246,26 @@ public class CastShellActivity extends Activity {
}
private void setResolution() {
- int requestedHeight = getIntent().getIntExtra(
- ACTION_EXTRA_RESOLUTION_HEIGHT, DEFAULT_HEIGHT_PIXELS);
+ 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: " + commandLineHeightString);
+ }
+ }
+ int requestedHeight =
+ getIntent().getIntExtra(ACTION_EXTRA_RESOLUTION_HEIGHT, defaultHeight);
int displayHeight = getResources().getDisplayMetrics().heightPixels;
- // Clamp within [DEFAULT_HEIGHT_PIXELS, displayHeight]
- int desiredHeight =
- Math.min(displayHeight, Math.max(DEFAULT_HEIGHT_PIXELS, requestedHeight));
+ // Clamp within [defaultHeight, displayHeight]
+ int desiredHeight = Math.min(displayHeight, Math.max(defaultHeight, requestedHeight));
double deviceScaleFactor = ((double) displayHeight) / desiredHeight;
Log.d(TAG, "Using scale factor " + deviceScaleFactor + " to set height " + desiredHeight);
- CommandLine.getInstance().appendSwitchWithValue("force-device-scale-factor",
- String.valueOf(deviceScaleFactor));
+ commandLine.appendSwitchWithValue(
+ ContentSwitches.FORCE_DEVICE_SCALE_FACTOR, String.valueOf(deviceScaleFactor));
}
private void exitIfUrlMissing() {
« no previous file with comments | « no previous file | chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastSwitches.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698