Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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(); |
|
asanka
2016/11/10 20:49:39
It's possible for the WebContents to be null here.
qinmin
2016/11/10 21:37:08
null WebContents caused by resumption attempt with
asanka
2016/11/10 21:57:13
Sure. But ReserveVirtualPathDone() isn't where we
| |
| 621 InfoBarService::FromWebContents(download->GetWebContents()), download, | 621 chrome::android::ChromeDuplicateDownloadInfoBarDelegate::Create( |
| 622 suggested_path, callback); | 622 InfoBarService::FromWebContents(web_contents), download, |
| 623 suggested_path, web_contents->GetBrowserContext()->IsOffTheRecord(), | |
|
asanka
2016/11/10 20:49:39
Nit: IsOffTheRecord() is redundant. ChromeDuplicat
qinmin
2016/11/10 21:37:08
Done.
| |
| 624 callback); | |
| 623 #else | 625 #else |
| 624 DownloadFilePicker::ShowFilePicker(download, suggested_path, callback); | 626 DownloadFilePicker::ShowFilePicker(download, suggested_path, callback); |
| 625 #endif | 627 #endif |
| 626 } | 628 } |
| 627 | 629 |
| 628 void ChromeDownloadManagerDelegate::DetermineLocalPath( | 630 void ChromeDownloadManagerDelegate::DetermineLocalPath( |
| 629 DownloadItem* download, | 631 DownloadItem* download, |
| 630 const base::FilePath& virtual_path, | 632 const base::FilePath& virtual_path, |
| 631 const DownloadTargetDeterminerDelegate::LocalPathCallback& callback) { | 633 const DownloadTargetDeterminerDelegate::LocalPathCallback& callback) { |
| 632 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 634 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 807 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || | 809 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || |
| 808 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || | 810 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || |
| 809 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || | 811 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || |
| 810 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || | 812 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || |
| 811 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { | 813 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { |
| 812 return true; | 814 return true; |
| 813 } | 815 } |
| 814 #endif | 816 #endif |
| 815 return false; | 817 return false; |
| 816 } | 818 } |
| OLD | NEW |