| 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/download_prefs.h" | 5 #include "chrome/browser/download/download_prefs.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 prefs->SetFilePath(prefs::kDownloadDefaultDirectory, | 149 prefs->SetFilePath(prefs::kDownloadDefaultDirectory, |
| 150 GetDefaultDownloadDirectoryForProfile()); | 150 GetDefaultDownloadDirectoryForProfile()); |
| 151 } | 151 } |
| 152 prefs->SetBoolean(prefs::kDownloadDirUpgraded, true); | 152 prefs->SetBoolean(prefs::kDownloadDirUpgraded, true); |
| 153 } | 153 } |
| 154 | 154 |
| 155 prompt_for_download_.Init(prefs::kPromptForDownload, prefs); | 155 prompt_for_download_.Init(prefs::kPromptForDownload, prefs); |
| 156 download_path_.Init(prefs::kDownloadDefaultDirectory, prefs); | 156 download_path_.Init(prefs::kDownloadDefaultDirectory, prefs); |
| 157 save_file_path_.Init(prefs::kSaveFileDefaultDirectory, prefs); | 157 save_file_path_.Init(prefs::kSaveFileDefaultDirectory, prefs); |
| 158 save_file_type_.Init(prefs::kSaveFileType, prefs); | 158 save_file_type_.Init(prefs::kSaveFileType, prefs); |
| 159 download_restriction_.Init(prefs::kDownloadRestrictions, prefs); |
| 159 | 160 |
| 160 // We store any file extension that should be opened automatically at | 161 // We store any file extension that should be opened automatically at |
| 161 // download completion in this pref. | 162 // download completion in this pref. |
| 162 std::string extensions_to_open = | 163 std::string extensions_to_open = |
| 163 prefs->GetString(prefs::kDownloadExtensionsToOpen); | 164 prefs->GetString(prefs::kDownloadExtensionsToOpen); |
| 164 | 165 |
| 165 for (const auto& extension_string : base::SplitString( | 166 for (const auto& extension_string : base::SplitString( |
| 166 extensions_to_open, ":", | 167 extensions_to_open, ":", |
| 167 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { | 168 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { |
| 168 #if defined(OS_POSIX) | 169 #if defined(OS_POSIX) |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 extensions.erase(extensions.size() - 1); | 381 extensions.erase(extensions.size() - 1); |
| 381 | 382 |
| 382 profile_->GetPrefs()->SetString(prefs::kDownloadExtensionsToOpen, extensions); | 383 profile_->GetPrefs()->SetString(prefs::kDownloadExtensionsToOpen, extensions); |
| 383 } | 384 } |
| 384 | 385 |
| 385 bool DownloadPrefs::AutoOpenCompareFunctor::operator()( | 386 bool DownloadPrefs::AutoOpenCompareFunctor::operator()( |
| 386 const base::FilePath::StringType& a, | 387 const base::FilePath::StringType& a, |
| 387 const base::FilePath::StringType& b) const { | 388 const base::FilePath::StringType& b) const { |
| 388 return base::FilePath::CompareLessIgnoreCase(a, b); | 389 return base::FilePath::CompareLessIgnoreCase(a, b); |
| 389 } | 390 } |
| OLD | NEW |