| 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/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "chrome/browser/download/download_stats.h" | 33 #include "chrome/browser/download/download_stats.h" |
| 34 #include "chrome/browser/download/download_target_determiner.h" | 34 #include "chrome/browser/download/download_target_determiner.h" |
| 35 #include "chrome/browser/download/save_package_file_picker.h" | 35 #include "chrome/browser/download/save_package_file_picker.h" |
| 36 #include "chrome/browser/platform_util.h" | 36 #include "chrome/browser/platform_util.h" |
| 37 #include "chrome/browser/profiles/profile.h" | 37 #include "chrome/browser/profiles/profile.h" |
| 38 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 38 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 39 #include "chrome/browser/ui/browser.h" | 39 #include "chrome/browser/ui/browser.h" |
| 40 #include "chrome/browser/ui/browser_finder.h" | 40 #include "chrome/browser/ui/browser_finder.h" |
| 41 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 41 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
| 42 #include "chrome/common/chrome_constants.h" | 42 #include "chrome/common/chrome_constants.h" |
| 43 #include "chrome/common/features.h" |
| 43 #include "chrome/common/pref_names.h" | 44 #include "chrome/common/pref_names.h" |
| 44 #include "components/pref_registry/pref_registry_syncable.h" | 45 #include "components/pref_registry/pref_registry_syncable.h" |
| 45 #include "content/public/browser/download_item.h" | 46 #include "content/public/browser/download_item.h" |
| 46 #include "content/public/browser/download_manager.h" | 47 #include "content/public/browser/download_manager.h" |
| 47 #include "content/public/browser/notification_source.h" | 48 #include "content/public/browser/notification_source.h" |
| 48 #include "content/public/browser/page_navigator.h" | 49 #include "content/public/browser/page_navigator.h" |
| 49 #include "net/base/filename_util.h" | 50 #include "net/base/filename_util.h" |
| 50 #include "net/base/mime_util.h" | 51 #include "net/base/mime_util.h" |
| 51 | 52 |
| 52 #if defined(OS_ANDROID) | 53 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 53 #include "chrome/browser/android/download/chrome_download_manager_overwrite_info
bar_delegate.h" | 54 #include "chrome/browser/android/download/chrome_download_manager_overwrite_info
bar_delegate.h" |
| 54 #include "chrome/browser/infobars/infobar_service.h" | 55 #include "chrome/browser/infobars/infobar_service.h" |
| 55 #endif | 56 #endif |
| 56 | 57 |
| 57 #if defined(OS_CHROMEOS) | 58 #if defined(OS_CHROMEOS) |
| 58 #include "chrome/browser/chromeos/drive/download_handler.h" | 59 #include "chrome/browser/chromeos/drive/download_handler.h" |
| 59 #include "chrome/browser/chromeos/drive/file_system_util.h" | 60 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 60 #endif | 61 #endif |
| 61 | 62 |
| 62 #if defined(ENABLE_EXTENSIONS) | 63 #if defined(ENABLE_EXTENSIONS) |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 create_directory, | 573 create_directory, |
| 573 conflict_action, | 574 conflict_action, |
| 574 callback); | 575 callback); |
| 575 } | 576 } |
| 576 | 577 |
| 577 void ChromeDownloadManagerDelegate::PromptUserForDownloadPath( | 578 void ChromeDownloadManagerDelegate::PromptUserForDownloadPath( |
| 578 DownloadItem* download, | 579 DownloadItem* download, |
| 579 const base::FilePath& suggested_path, | 580 const base::FilePath& suggested_path, |
| 580 const DownloadTargetDeterminerDelegate::FileSelectedCallback& callback) { | 581 const DownloadTargetDeterminerDelegate::FileSelectedCallback& callback) { |
| 581 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 582 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 582 #if defined(OS_ANDROID) | 583 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 583 chrome::android::ChromeDownloadManagerOverwriteInfoBarDelegate::Create( | 584 chrome::android::ChromeDownloadManagerOverwriteInfoBarDelegate::Create( |
| 584 InfoBarService::FromWebContents(download->GetWebContents()), | 585 InfoBarService::FromWebContents(download->GetWebContents()), |
| 585 suggested_path, callback); | 586 suggested_path, callback); |
| 586 #else | 587 #else |
| 587 DownloadFilePicker::ShowFilePicker(download, suggested_path, callback); | 588 DownloadFilePicker::ShowFilePicker(download, suggested_path, callback); |
| 588 #endif | 589 #endif |
| 589 } | 590 } |
| 590 | 591 |
| 591 void ChromeDownloadManagerDelegate::DetermineLocalPath( | 592 void ChromeDownloadManagerDelegate::DetermineLocalPath( |
| 592 DownloadItem* download, | 593 DownloadItem* download, |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || | 753 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || |
| 753 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || | 754 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || |
| 754 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || | 755 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || |
| 755 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || | 756 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || |
| 756 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { | 757 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { |
| 757 return true; | 758 return true; |
| 758 } | 759 } |
| 759 #endif | 760 #endif |
| 760 return false; | 761 return false; |
| 761 } | 762 } |
| OLD | NEW |