| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/download_prefs.h" | 5 #include "chrome/browser/download/download_prefs.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 if (download_util::DownloadPathIsDangerous(current_download_dir)) { | 87 if (download_util::DownloadPathIsDangerous(current_download_dir)) { |
| 88 prefs->SetFilePath(prefs::kDownloadDefaultDirectory, | 88 prefs->SetFilePath(prefs::kDownloadDefaultDirectory, |
| 89 default_download_path); | 89 default_download_path); |
| 90 } | 90 } |
| 91 prefs->SetBoolean(prefs::kDownloadDirUpgraded, true); | 91 prefs->SetBoolean(prefs::kDownloadDirUpgraded, true); |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 | 94 |
| 95 // static | 95 // static |
| 96 DownloadPrefs* DownloadPrefs::FromDownloadManager( | 96 DownloadPrefs* DownloadPrefs::FromDownloadManager( |
| 97 DownloadManager* download_manager) { | 97 DownloadManagerInterface* download_manager) { |
| 98 ChromeDownloadManagerDelegate* delegate = | 98 ChromeDownloadManagerDelegate* delegate = |
| 99 static_cast<ChromeDownloadManagerDelegate*>(download_manager->delegate()); | 99 static_cast<ChromeDownloadManagerDelegate*>(download_manager->delegate()); |
| 100 return delegate->download_prefs(); | 100 return delegate->download_prefs(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 bool DownloadPrefs::PromptForDownload() const { | 103 bool DownloadPrefs::PromptForDownload() const { |
| 104 // If the DownloadDirectory policy is set, then |prompt_for_download_| should | 104 // If the DownloadDirectory policy is set, then |prompt_for_download_| should |
| 105 // always be false. | 105 // always be false. |
| 106 DCHECK(!download_path_.IsManaged() || !prompt_for_download_.GetValue()); | 106 DCHECK(!download_path_.IsManaged() || !prompt_for_download_.GetValue()); |
| 107 return *prompt_for_download_; | 107 return *prompt_for_download_; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 extensions.erase(extensions.size() - 1); | 163 extensions.erase(extensions.size() - 1); |
| 164 | 164 |
| 165 prefs_->SetString(prefs::kDownloadExtensionsToOpen, extensions); | 165 prefs_->SetString(prefs::kDownloadExtensionsToOpen, extensions); |
| 166 } | 166 } |
| 167 | 167 |
| 168 bool DownloadPrefs::AutoOpenCompareFunctor::operator()( | 168 bool DownloadPrefs::AutoOpenCompareFunctor::operator()( |
| 169 const FilePath::StringType& a, | 169 const FilePath::StringType& a, |
| 170 const FilePath::StringType& b) const { | 170 const FilePath::StringType& b) const { |
| 171 return FilePath::CompareLessIgnoreCase(a, b); | 171 return FilePath::CompareLessIgnoreCase(a, b); |
| 172 } | 172 } |
| OLD | NEW |