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