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

Side by Side Diff: chrome/browser/download/chrome_download_manager_delegate.cc

Issue 2478583004: implementation for new duplicate download UI (Closed)
Patch Set: do null check on webcontents Created 4 years, 1 month 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/download/chrome_download_manager_delegate.h" 5 #include "chrome/browser/download/chrome_download_manager_delegate.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "components/prefs/pref_service.h" 50 #include "components/prefs/pref_service.h"
51 #include "content/public/browser/download_item.h" 51 #include "content/public/browser/download_item.h"
52 #include "content/public/browser/download_manager.h" 52 #include "content/public/browser/download_manager.h"
53 #include "content/public/browser/notification_source.h" 53 #include "content/public/browser/notification_source.h"
54 #include "content/public/browser/page_navigator.h" 54 #include "content/public/browser/page_navigator.h"
55 #include "net/base/filename_util.h" 55 #include "net/base/filename_util.h"
56 #include "net/base/mime_util.h" 56 #include "net/base/mime_util.h"
57 #include "ui/base/l10n/l10n_util.h" 57 #include "ui/base/l10n/l10n_util.h"
58 58
59 #if BUILDFLAG(ANDROID_JAVA_UI) 59 #if BUILDFLAG(ANDROID_JAVA_UI)
60 #include "chrome/browser/android/download/chrome_download_manager_overwrite_info bar_delegate.h" 60 #include "chrome/browser/android/download/chrome_duplicate_download_infobar_dele gate.h"
61 #include "chrome/browser/infobars/infobar_service.h" 61 #include "chrome/browser/infobars/infobar_service.h"
62 #endif 62 #endif
63 63
64 #if defined(OS_CHROMEOS) 64 #if defined(OS_CHROMEOS)
65 #include "chrome/browser/chromeos/drive/download_handler.h" 65 #include "chrome/browser/chromeos/drive/download_handler.h"
66 #include "chrome/browser/chromeos/drive/file_system_util.h" 66 #include "chrome/browser/chromeos/drive/file_system_util.h"
67 #endif 67 #endif
68 68
69 #if defined(ENABLE_EXTENSIONS) 69 #if defined(ENABLE_EXTENSIONS)
70 #include "chrome/browser/extensions/api/downloads/downloads_api.h" 70 #include "chrome/browser/extensions/api/downloads/downloads_api.h"
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 conflict_action, 610 conflict_action,
611 callback); 611 callback);
612 } 612 }
613 613
614 void ChromeDownloadManagerDelegate::PromptUserForDownloadPath( 614 void ChromeDownloadManagerDelegate::PromptUserForDownloadPath(
615 DownloadItem* download, 615 DownloadItem* download,
616 const base::FilePath& suggested_path, 616 const base::FilePath& suggested_path,
617 const DownloadTargetDeterminerDelegate::FileSelectedCallback& callback) { 617 const DownloadTargetDeterminerDelegate::FileSelectedCallback& callback) {
618 DCHECK_CURRENTLY_ON(BrowserThread::UI); 618 DCHECK_CURRENTLY_ON(BrowserThread::UI);
619 #if BUILDFLAG(ANDROID_JAVA_UI) 619 #if BUILDFLAG(ANDROID_JAVA_UI)
620 chrome::android::ChromeDownloadManagerOverwriteInfoBarDelegate::Create( 620 content::WebContents* web_contents = download->GetWebContents();
621 InfoBarService::FromWebContents(download->GetWebContents()), download, 621 if (!web_contents) {
622 callback.Run(base::FilePath());
623 return;
624 }
625 chrome::android::ChromeDuplicateDownloadInfoBarDelegate::Create(
626 InfoBarService::FromWebContents(web_contents), download,
622 suggested_path, callback); 627 suggested_path, callback);
623 #else 628 #else
624 DownloadFilePicker::ShowFilePicker(download, suggested_path, callback); 629 DownloadFilePicker::ShowFilePicker(download, suggested_path, callback);
625 #endif 630 #endif
626 } 631 }
627 632
628 void ChromeDownloadManagerDelegate::DetermineLocalPath( 633 void ChromeDownloadManagerDelegate::DetermineLocalPath(
629 DownloadItem* download, 634 DownloadItem* download,
630 const base::FilePath& virtual_path, 635 const base::FilePath& virtual_path,
631 const DownloadTargetDeterminerDelegate::LocalPathCallback& callback) { 636 const DownloadTargetDeterminerDelegate::LocalPathCallback& callback) {
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || 812 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) ||
808 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || 813 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) ||
809 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || 814 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) ||
810 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || 815 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) ||
811 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { 816 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) {
812 return true; 817 return true;
813 } 818 }
814 #endif 819 #endif
815 return false; 820 return false;
816 } 821 }
OLDNEW
« no previous file with comments | « chrome/browser/android/offline_pages/downloads/offline_page_infobar_delegate.cc ('k') | chrome/browser/ui/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698