| Index: chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBar.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBar.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBar.java
|
| index 71caf987c2794ae032a5efd5d4e6fcfd37d0ed17..e27ff5bf3b2e07c0de8954ebd0bfcc3831f94118 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBar.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBar.java
|
| @@ -35,7 +35,9 @@ public abstract class InfoBar implements InfoBarView {
|
| private long mNativeInfoBarPtr;
|
|
|
| /**
|
| + * Constructor for regular infobars.
|
| * @param iconDrawableId ID of the resource to use for the Icon. If 0, no icon will be shown.
|
| + * @param iconBitmap Icon to draw, in bitmap form. Used mainly for generated icons.
|
| * @param message The message to show in the infobar.
|
| */
|
| public InfoBar(int iconDrawableId, Bitmap iconBitmap, CharSequence message) {
|
| @@ -80,14 +82,34 @@ public abstract class InfoBar implements InfoBarView {
|
| protected final View createView() {
|
| assert mContext != null;
|
|
|
| - InfoBarLayout layout =
|
| - new InfoBarLayout(mContext, this, mIconDrawableId, mIconBitmap, mMessage);
|
| - createContent(layout);
|
| - layout.onContentCreated();
|
| - mView = layout;
|
| + if (usesCompactLayout()) {
|
| + InfoBarCompactLayout layout =
|
| + new InfoBarCompactLayout(mContext, this, mIconDrawableId, mIconBitmap);
|
| + createCompactLayoutContent(layout);
|
| + mView = layout;
|
| + } else {
|
| + InfoBarLayout layout =
|
| + new InfoBarLayout(mContext, this, mIconDrawableId, mIconBitmap, mMessage);
|
| + createContent(layout);
|
| + layout.onContentCreated();
|
| + mView = layout;
|
| + }
|
| +
|
| return mView;
|
| }
|
|
|
| + /** If this returns true, the infobar contents will be replaced with a one-line layout. */
|
| + protected boolean usesCompactLayout() {
|
| + return false;
|
| + }
|
| +
|
| + /**
|
| + * Prepares and inserts views into an {@link InfoBarCompactLayout}.
|
| + * {@link #usesCompactLayout} must return 'true' for this function to be called.
|
| + * @param layout Layout to plug views into.
|
| + */
|
| + protected void createCompactLayoutContent(InfoBarCompactLayout layout) {}
|
| +
|
| /**
|
| * Replaces the View currently shown in the infobar with the given View. Triggers the swap
|
| * animation via the InfoBarContainer.
|
|
|