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 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
441 } | 441 } |
442 | 442 |
443 void ChromeDownloadManagerDelegate::GetSaveDir( | 443 void ChromeDownloadManagerDelegate::GetSaveDir( |
444 content::BrowserContext* browser_context, | 444 content::BrowserContext* browser_context, |
445 base::FilePath* website_save_dir, | 445 base::FilePath* website_save_dir, |
446 base::FilePath* download_save_dir, | 446 base::FilePath* download_save_dir, |
447 bool* skip_dir_check) { | 447 bool* skip_dir_check) { |
448 *website_save_dir = download_prefs_->SaveFilePath(); | 448 *website_save_dir = download_prefs_->SaveFilePath(); |
449 DCHECK(!website_save_dir->empty()); | 449 DCHECK(!website_save_dir->empty()); |
450 *download_save_dir = download_prefs_->DownloadPath(); | 450 *download_save_dir = download_prefs_->DownloadPath(); |
451 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | |
452 // TODO(thomasanderson): Remove this when all Linux distros with | |
453 // versions of GTK lower than 3.14.7 are no longer supported. This | |
454 // should happen when support for Ubuntu Trusty and Debian Jessie | |
455 // are removed. | |
456 // | |
457 // Use /var/tmp instead of /tmp here because /tmp may be | |
458 // memory-mounted and users may want to download files larger than | |
459 // will fit in memory. Existence of /var/tmp is guaranteed by the | |
460 // Filesystem Hierarchy Standard. | |
461 static const char kVarTmp[] = "/var/tmp"; | |
462 *download_save_dir = base::FilePath(kVarTmp); | |
qinmin
2017/06/06 22:10:14
Shouldn't this be done in download_prefs_?
what if
Tom Anderson
2017/06/07 01:29:51
Done.
| |
463 #endif | |
451 *skip_dir_check = false; | 464 *skip_dir_check = false; |
452 #if defined(OS_CHROMEOS) | 465 #if defined(OS_CHROMEOS) |
453 *skip_dir_check = drive::util::IsUnderDriveMountPoint(*website_save_dir); | 466 *skip_dir_check = drive::util::IsUnderDriveMountPoint(*website_save_dir); |
454 #endif | 467 #endif |
455 } | 468 } |
456 | 469 |
457 void ChromeDownloadManagerDelegate::ChooseSavePath( | 470 void ChromeDownloadManagerDelegate::ChooseSavePath( |
458 content::WebContents* web_contents, | 471 content::WebContents* web_contents, |
459 const base::FilePath& suggested_path, | 472 const base::FilePath& suggested_path, |
460 const base::FilePath::StringType& default_extension, | 473 const base::FilePath::StringType& default_extension, |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
870 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || | 883 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || |
871 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || | 884 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || |
872 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || | 885 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || |
873 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || | 886 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || |
874 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { | 887 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { |
875 return true; | 888 return true; |
876 } | 889 } |
877 #endif | 890 #endif |
878 return false; | 891 return false; |
879 } | 892 } |
OLD | NEW |