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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java

Issue 580043002: [Android] Prompt with infobar on filename conflict (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed pkasting@'s comments Created 5 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.download; 5 package org.chromium.chrome.browser.download;
6 6
7 import android.app.DownloadManager; 7 import android.app.DownloadManager;
8 import android.content.ActivityNotFoundException; 8 import android.content.ActivityNotFoundException;
9 import android.content.BroadcastReceiver; 9 import android.content.BroadcastReceiver;
10 import android.content.Context; 10 import android.content.Context;
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 // See crbug.com/143499 for more details. 648 // See crbug.com/143499 for more details.
649 Log.e(TAG, "Download failed: " + e); 649 Log.e(TAG, "Download failed: " + e);
650 mErrorId = R.string.cannot_download_generic; 650 mErrorId = R.string.cannot_download_generic;
651 return false; 651 return false;
652 } 652 }
653 return true; 653 return true;
654 } 654 }
655 655
656 @Override 656 @Override
657 protected void onPostExecute(Boolean result) { 657 protected void onPostExecute(Boolean result) {
658 boolean isPendingOMADownload = mOMADownloadHandler.isPendingOMADownl oad( 658 boolean isPendingOMADownload =
659 (long) mDownloadInfo.getDownloadId()); 659 mOMADownloadHandler.isPendingOMADownload(mDownloadInfo.getDo wnloadId());
660 if (!result) { 660 if (!result) {
661 Toast.makeText(mContext, mErrorId, Toast.LENGTH_SHORT).show(); 661 Toast.makeText(mContext, mErrorId, Toast.LENGTH_SHORT).show();
662 if (isPendingOMADownload) { 662 if (isPendingOMADownload) {
663 mOMADownloadHandler.onDownloadFailed( 663 mOMADownloadHandler.onDownloadFailed(
664 mDownloadInfo, DownloadManager.ERROR_UNKNOWN, null); 664 mDownloadInfo, DownloadManager.ERROR_UNKNOWN, null);
665 } 665 }
666 return; 666 return;
667 } 667 }
668 Toast.makeText(mContext, R.string.download_pending, Toast.LENGTH_SHO RT).show(); 668 Toast.makeText(mContext, R.string.download_pending, Toast.LENGTH_SHO RT).show();
669 if (isPendingOMADownload) { 669 if (isPendingOMADownload) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 * Returns true if the download meant to be treated as an attachment. 710 * Returns true if the download meant to be treated as an attachment.
711 * 711 *
712 * @param contentDisposition Content disposition of the download. 712 * @param contentDisposition Content disposition of the download.
713 * @return true if the downloaded is an attachment, or false otherwise. 713 * @return true if the downloaded is an attachment, or false otherwise.
714 */ 714 */
715 public static boolean isAttachment(String contentDisposition) { 715 public static boolean isAttachment(String contentDisposition) {
716 return contentDisposition != null 716 return contentDisposition != null
717 && contentDisposition.regionMatches(true, 0, "attachment", 0, 10 ); 717 && contentDisposition.regionMatches(true, 0, "attachment", 0, 10 );
718 } 718 }
719 } 719 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698