Chromium Code Reviews| 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 260b2553732a1a91db1ca4cc4c094d69fd08f582..2f8082812c8e0551afdee90b41646062694dcc22 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 |
| @@ -26,7 +26,8 @@ public class WebappInfo { |
| private String mId; |
| private Bitmap mIcon; |
| private Uri mUri; |
| - private String mTitle; |
| + private String mName; |
| + private String mShortName; |
| private int mOrientation; |
| private int mSource; |
| @@ -41,13 +42,20 @@ public class WebappInfo { |
| public static WebappInfo create(Intent intent) { |
| String id = intent.getStringExtra(ShortcutHelper.EXTRA_ID); |
| String icon = intent.getStringExtra(ShortcutHelper.EXTRA_ICON); |
| - String title = intent.getStringExtra(ShortcutHelper.EXTRA_TITLE); |
| String url = intent.getStringExtra(ShortcutHelper.EXTRA_URL); |
| int orientation = intent.getIntExtra( |
| ShortcutHelper.EXTRA_ORIENTATION, ScreenOrientationValues.DEFAULT); |
| int source = intent.getIntExtra( |
| ShortcutHelper.EXTRA_SOURCE, ShortcutHelper.SOURCE_UNKNOWN); |
| - return create(id, url, icon, title, orientation, source); |
| + |
| + String title = intent.getStringExtra(ShortcutHelper.EXTRA_TITLE); |
|
mlamouri (slow - plz ping)
2015/07/09 16:34:17
nit: add comment explaining this is for backward c
|
| + String name = intent.getStringExtra(ShortcutHelper.EXTRA_NAME); |
| + String shortName = intent.getStringExtra(ShortcutHelper.EXTRA_SHORT_NAME); |
| + |
| + shortName = shortName == null ? title : shortName; |
| + name = name == null ? shortName : name; |
|
mlamouri (slow - plz ping)
2015/07/09 16:34:17
s/shortName/title/
We should avoid ending up in a
|
| + |
| + return create(id, url, icon, name, shortName, orientation, source); |
| } |
| /** |
| @@ -55,12 +63,13 @@ public class WebappInfo { |
| * @param id ID for the webapp. |
| * @param url URL for the webapp. |
| * @param icon Icon to show for the webapp. |
| - * @param title Title of 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. |
| */ |
| - public static WebappInfo create(String id, String url, String icon, String title, |
| - int orientation, int source) { |
| + public static WebappInfo create(String id, String url, String icon, String name, |
| + String shortName, int orientation, int source) { |
| if (id == null || url == null) { |
| Log.e("WebappInfo", "Data passed in was incomplete: " + id + ", " + url); |
| return null; |
| @@ -73,13 +82,15 @@ public class WebappInfo { |
| } |
| Uri uri = Uri.parse(url); |
| - return new WebappInfo(id, uri, favicon, title, orientation, source); |
| + return new WebappInfo(id, uri, favicon, name, shortName, orientation, source); |
| } |
| - private WebappInfo(String id, Uri uri, Bitmap icon, String title, int orientation, int source) { |
| + private WebappInfo(String id, Uri uri, Bitmap icon, String name, |
| + String shortName, int orientation, int source) { |
| mIcon = icon; |
| mId = id; |
| - mTitle = title; |
| + mName = name; |
| + mShortName = shortName; |
| mUri = uri; |
| mOrientation = orientation; |
| mSource = source; |
| @@ -99,7 +110,8 @@ public class WebappInfo { |
| outState.putString(ShortcutHelper.EXTRA_ID, mId); |
| outState.putString(ShortcutHelper.EXTRA_URL, mUri.toString()); |
| outState.putParcelable(ShortcutHelper.EXTRA_ICON, mIcon); |
| - outState.putString(ShortcutHelper.EXTRA_TITLE, mTitle); |
| + outState.putString(ShortcutHelper.EXTRA_NAME, mName); |
| + outState.putString(ShortcutHelper.EXTRA_SHORT_NAME, mShortName); |
| outState.putInt(ShortcutHelper.EXTRA_ORIENTATION, mOrientation); |
| outState.putInt(ShortcutHelper.EXTRA_SOURCE, mSource); |
| } |
| @@ -113,7 +125,8 @@ public class WebappInfo { |
| mIcon = newInfo.mIcon; |
| mId = newInfo.mId; |
| mUri = newInfo.mUri; |
| - mTitle = newInfo.mTitle; |
| + mName = newInfo.mName; |
| + mShortName = newInfo.mShortName; |
| mOrientation = newInfo.mOrientation; |
| mSource = newInfo.mSource; |
| } |
| @@ -134,8 +147,12 @@ public class WebappInfo { |
| return mIcon; |
| } |
| - public String title() { |
| - return mTitle; |
| + public String name() { |
| + return mName; |
| + } |
| + |
| + public String shortName() { |
| + return mShortName; |
| } |
| public int orientation() { |