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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappInfo.java

Issue 1961313002: Cache web app data for home screen sites declaring "display": "fullscreen" in their manifest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests 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: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappInfo.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappInfo.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappInfo.java
index 179991e89dc477e4ae99fcb1c28e8fc872628e7e..a0912e4adeede3d61d79c8ceabbe499c51c09679 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappInfo.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappInfo.java
@@ -9,6 +9,7 @@ import android.graphics.Bitmap;
import android.net.Uri;
import android.util.Log;
+import org.chromium.blink_public.platform.WebDisplayMode;
import org.chromium.chrome.browser.ShortcutHelper;
import org.chromium.chrome.browser.ShortcutSource;
import org.chromium.chrome.browser.util.IntentUtils;
@@ -25,6 +26,7 @@ public class WebappInfo {
private Uri mUri;
private String mName;
private String mShortName;
+ private int mDisplayMode;
private int mOrientation;
private int mSource;
private long mThemeColor;
@@ -61,6 +63,8 @@ public class WebappInfo {
String id = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTRA_ID);
String icon = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTRA_ICON);
String url = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTRA_URL);
+ int displayMode = IntentUtils.safeGetIntExtra(intent,
+ ShortcutHelper.EXTRA_DISPLAY_MODE, WebDisplayMode.Standalone);
int orientation = IntentUtils.safeGetIntExtra(intent,
ShortcutHelper.EXTRA_ORIENTATION, ScreenOrientationValues.DEFAULT);
int source = IntentUtils.safeGetIntExtra(intent,
@@ -77,24 +81,25 @@ public class WebappInfo {
String name = nameFromIntent(intent);
String shortName = shortNameFromIntent(intent);
- return create(id, url, icon, name, shortName, orientation, source,
+ return create(id, url, icon, name, shortName, displayMode, orientation, source,
themeColor, backgroundColor, isIconGenerated);
}
/**
* Construct a WebappInfo.
- * @param id ID for the webapp.
- * @param url URL for the webapp.
- * @param icon Icon to show for the webapp.
- * @param name Name of the webapp.
- * @param shortName The short name of the webapp.
- * @param orientation Orientation of the webapp.
- * @param source Source where the webapp was added from.
- * @param themeColor The theme color of the webapp.
+ * @param id ID for the webapp.
+ * @param url URL for the webapp.
+ * @param icon Icon to show for the webapp.
+ * @param name Name of the webapp.
+ * @param shortName The short name of the webapp.
+ * @param displayMode Display mode of the webapp.
+ * @param orientation Orientation of the webapp.
+ * @param source Source where the webapp was added from.
+ * @param themeColor The theme color of the webapp.
* @param isIconGenerated Whether the |icon| was generated by Chromium.
*/
public static WebappInfo create(String id, String url, String icon, String name,
- String shortName, int orientation, int source, long themeColor,
+ String shortName, int displayMode, int orientation, int source, long themeColor,
long backgroundColor, boolean isIconGenerated) {
if (id == null || url == null) {
Log.e("WebappInfo", "Data passed in was incomplete: " + id + ", " + url);
@@ -102,18 +107,19 @@ public class WebappInfo {
}
Uri uri = Uri.parse(url);
- return new WebappInfo(id, uri, icon, name, shortName, orientation, source,
+ return new WebappInfo(id, uri, icon, name, shortName, displayMode, orientation, source,
themeColor, backgroundColor, isIconGenerated);
}
- private WebappInfo(String id, Uri uri, String encodedIcon, String name,
- String shortName, int orientation, int source, long themeColor,
+ private WebappInfo(String id, Uri uri, String encodedIcon, String name, String shortName,
+ int displayMode, int orientation, int source, long themeColor,
long backgroundColor, boolean isIconGenerated) {
mEncodedIcon = encodedIcon;
mId = id;
mName = name;
mShortName = shortName;
mUri = uri;
+ mDisplayMode = displayMode;
mOrientation = orientation;
mSource = source;
mThemeColor = themeColor;
@@ -137,6 +143,7 @@ public class WebappInfo {
mUri = newInfo.mUri;
mName = newInfo.mName;
mShortName = newInfo.mShortName;
+ mDisplayMode = newInfo.mDisplayMode;
mOrientation = newInfo.mOrientation;
mSource = newInfo.mSource;
mThemeColor = newInfo.mThemeColor;
@@ -164,6 +171,10 @@ public class WebappInfo {
return mShortName;
}
+ public int displayMode() {
+ return mDisplayMode;
+ }
+
public int orientation() {
return mOrientation;
}
@@ -249,6 +260,7 @@ public class WebappInfo {
intent.putExtra(ShortcutHelper.EXTRA_VERSION, ShortcutHelper.WEBAPP_SHORTCUT_VERSION);
intent.putExtra(ShortcutHelper.EXTRA_NAME, name());
intent.putExtra(ShortcutHelper.EXTRA_SHORT_NAME, shortName());
+ intent.putExtra(ShortcutHelper.EXTRA_DISPLAY_MODE, displayMode());
intent.putExtra(ShortcutHelper.EXTRA_ORIENTATION, orientation());
intent.putExtra(ShortcutHelper.EXTRA_SOURCE, source());
intent.putExtra(ShortcutHelper.EXTRA_THEME_COLOR, themeColor());

Powered by Google App Engine
This is Rietveld 408576698