OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.chrome.browser.infobar; |
| 6 |
| 7 import org.chromium.base.annotations.CalledByNative; |
| 8 import org.chromium.chrome.browser.ResourceId; |
| 9 |
| 10 /** |
| 11 * An InfoBar that lets the user know that a Preview page has been loaded, and g
ives the user |
| 12 * a link to reload the original page. This InfoBar will only be shown once per
page load. |
| 13 */ |
| 14 public class PreviewsInfoBar extends ConfirmInfoBar { |
| 15 private final String mTimestampText; |
| 16 |
| 17 @CalledByNative |
| 18 private static InfoBar show( |
| 19 int enumeratedIconId, String message, String linkText, String timest
ampText) { |
| 20 return new PreviewsInfoBar( |
| 21 ResourceId.mapToDrawableId(enumeratedIconId), message, linkText,
timestampText); |
| 22 } |
| 23 |
| 24 private PreviewsInfoBar( |
| 25 int iconDrawbleId, String message, String linkText, String timestamp
Text) { |
| 26 super(iconDrawbleId, null, message, linkText, null, null); |
| 27 mTimestampText = timestampText; |
| 28 } |
| 29 |
| 30 @Override |
| 31 public void createContent(InfoBarLayout layout) { |
| 32 super.createContent(layout); |
| 33 if (mTimestampText.isEmpty()) return; |
| 34 layout.getMessageLayout().addDescription(mTimestampText); |
| 35 } |
| 36 } |
OLD | NEW |