Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/infobar/DownloadOverwriteInfoBar.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/DownloadOverwriteInfoBar.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/DownloadOverwriteInfoBar.java |
| index 08fa74b27bbeb718cad669f64751e17166638619..80a55d196d503837156f6fb0404a413c5b2b5af8 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/infobar/DownloadOverwriteInfoBar.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/infobar/DownloadOverwriteInfoBar.java |
| @@ -19,6 +19,7 @@ import android.view.View; |
| import org.chromium.base.annotations.CalledByNative; |
| import org.chromium.chrome.R; |
| +import org.chromium.chrome.browser.download.DownloadUtils; |
| import java.util.List; |
| @@ -41,7 +42,8 @@ public class DownloadOverwriteInfoBar extends InfoBar { |
| * Constructs DownloadOverwriteInfoBar. |
| * @param fileName The file name. ex) example.jpg |
| * @param dirName The dir name. ex) Downloads |
| - * @param dirFullPath The full dir path. ex) sdcards/Downloads |
| + * @param dirFullPath The full dir path. ex) sdcards/Downloads. If empty, the Download Home |
| + * will be opened. |
| */ |
| private DownloadOverwriteInfoBar(String fileName, String dirName, String dirFullPath) { |
| super(R.drawable.infobar_downloading, null, null); |
| @@ -59,7 +61,8 @@ public class DownloadOverwriteInfoBar extends InfoBar { |
| private CharSequence getMessageText(Context context) { |
| String template = context.getString(R.string.download_overwrite_infobar_text); |
| - Intent intent = getIntentForDirectoryLaunch(mDirFullPath); |
| + Intent intent = null; |
| + if (!"".equals(mDirFullPath)) intent = getIntentForDirectoryLaunch(mDirFullPath); |
|
fgorski
2016/10/10 18:08:20
why that way? Is passing null ok?
How about: if (
Dmitry Titov
2016/10/10 18:25:29
+1 :)
dewittj
2016/10/10 18:37:02
Added a private opensDownloadMnaager()
|
| return formatInfoBarMessage(context, template, mFileName, mDirName, intent); |
| } |
| @@ -111,6 +114,13 @@ public class DownloadOverwriteInfoBar extends InfoBar { |
| context.startActivity(dirNameIntent); |
| } |
| }, 0, dirName.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); |
| + } else { |
| + formattedDirName.setSpan(new ClickableSpan() { |
| + @Override |
| + public void onClick(View view) { |
| + DownloadUtils.showDownloadManager(null, null); |
| + } |
| + }, 0, dirName.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); |
| } |
| return TextUtils.expandTemplate(template, formattedFileName, formattedDirName); |