| 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 <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 176 |
| 177 DownloadPrefs::~DownloadPrefs() {} | 177 DownloadPrefs::~DownloadPrefs() {} |
| 178 | 178 |
| 179 // static | 179 // static |
| 180 void DownloadPrefs::RegisterProfilePrefs( | 180 void DownloadPrefs::RegisterProfilePrefs( |
| 181 user_prefs::PrefRegistrySyncable* registry) { | 181 user_prefs::PrefRegistrySyncable* registry) { |
| 182 registry->RegisterBooleanPref( | 182 registry->RegisterBooleanPref( |
| 183 prefs::kPromptForDownload, | 183 prefs::kPromptForDownload, |
| 184 false, | 184 false, |
| 185 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 185 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
| 186 registry->RegisterStringPref( | 186 registry->RegisterStringPref(prefs::kDownloadExtensionsToOpen, std::string()); |
| 187 prefs::kDownloadExtensionsToOpen, | 187 registry->RegisterBooleanPref(prefs::kDownloadDirUpgraded, false); |
| 188 std::string(), | 188 registry->RegisterIntegerPref(prefs::kSaveFileType, |
| 189 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 189 content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML); |
| 190 registry->RegisterBooleanPref( | |
| 191 prefs::kDownloadDirUpgraded, | |
| 192 false, | |
| 193 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 194 registry->RegisterIntegerPref( | |
| 195 prefs::kSaveFileType, | |
| 196 content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML, | |
| 197 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 198 | 190 |
| 199 const base::FilePath& default_download_path = GetDefaultDownloadDirectory(); | 191 const base::FilePath& default_download_path = GetDefaultDownloadDirectory(); |
| 200 registry->RegisterFilePathPref( | 192 registry->RegisterFilePathPref(prefs::kDownloadDefaultDirectory, |
| 201 prefs::kDownloadDefaultDirectory, | 193 default_download_path); |
| 202 default_download_path, | 194 registry->RegisterFilePathPref(prefs::kSaveFileDefaultDirectory, |
| 203 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 195 default_download_path); |
| 204 registry->RegisterFilePathPref( | |
| 205 prefs::kSaveFileDefaultDirectory, | |
| 206 default_download_path, | |
| 207 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 208 #if defined(OS_WIN) || defined(OS_LINUX) || \ | 196 #if defined(OS_WIN) || defined(OS_LINUX) || \ |
| 209 (defined(OS_MACOSX) && !defined(OS_IOS)) | 197 (defined(OS_MACOSX) && !defined(OS_IOS)) |
| 210 registry->RegisterBooleanPref( | 198 registry->RegisterBooleanPref(prefs::kOpenPdfDownloadInSystemReader, false); |
| 211 prefs::kOpenPdfDownloadInSystemReader, | |
| 212 false, | |
| 213 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 214 #endif | 199 #endif |
| 215 } | 200 } |
| 216 | 201 |
| 217 base::FilePath DownloadPrefs::GetDefaultDownloadDirectoryForProfile() const { | 202 base::FilePath DownloadPrefs::GetDefaultDownloadDirectoryForProfile() const { |
| 218 #if defined(OS_CHROMEOS) | 203 #if defined(OS_CHROMEOS) |
| 219 return file_manager::util::GetDownloadsFolderForProfile(profile_); | 204 return file_manager::util::GetDownloadsFolderForProfile(profile_); |
| 220 #else | 205 #else |
| 221 return GetDefaultDownloadDirectory(); | 206 return GetDefaultDownloadDirectory(); |
| 222 #endif | 207 #endif |
| 223 } | 208 } |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 extensions.erase(extensions.size() - 1); | 364 extensions.erase(extensions.size() - 1); |
| 380 | 365 |
| 381 profile_->GetPrefs()->SetString(prefs::kDownloadExtensionsToOpen, extensions); | 366 profile_->GetPrefs()->SetString(prefs::kDownloadExtensionsToOpen, extensions); |
| 382 } | 367 } |
| 383 | 368 |
| 384 bool DownloadPrefs::AutoOpenCompareFunctor::operator()( | 369 bool DownloadPrefs::AutoOpenCompareFunctor::operator()( |
| 385 const base::FilePath::StringType& a, | 370 const base::FilePath::StringType& a, |
| 386 const base::FilePath::StringType& b) const { | 371 const base::FilePath::StringType& b) const { |
| 387 return base::FilePath::CompareLessIgnoreCase(a, b); | 372 return base::FilePath::CompareLessIgnoreCase(a, b); |
| 388 } | 373 } |
| OLD | NEW |