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/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 "", | 54 "", |
55 PrefService::UNSYNCABLE_PREF); | 55 PrefService::UNSYNCABLE_PREF); |
56 prefs->RegisterBooleanPref(prefs::kDownloadDirUpgraded, | 56 prefs->RegisterBooleanPref(prefs::kDownloadDirUpgraded, |
57 false, | 57 false, |
58 PrefService::UNSYNCABLE_PREF); | 58 PrefService::UNSYNCABLE_PREF); |
59 prefs->RegisterIntegerPref(prefs::kSaveFileType, | 59 prefs->RegisterIntegerPref(prefs::kSaveFileType, |
60 SavePackage::SAVE_AS_COMPLETE_HTML, | 60 SavePackage::SAVE_AS_COMPLETE_HTML, |
61 PrefService::UNSYNCABLE_PREF); | 61 PrefService::UNSYNCABLE_PREF); |
62 | 62 |
63 // The default download path is userprofile\download. | 63 // The default download path is userprofile\download. |
64 const FilePath& default_download_path = | 64 FilePath default_download_path = |
65 download_util::GetDefaultDownloadDirectory(); | 65 download_util::DefaultDownloadDirectory::Get(); |
66 prefs->RegisterFilePathPref(prefs::kDownloadDefaultDirectory, | 66 prefs->RegisterFilePathPref(prefs::kDownloadDefaultDirectory, |
67 default_download_path, | 67 default_download_path, |
68 PrefService::UNSYNCABLE_PREF); | 68 PrefService::UNSYNCABLE_PREF); |
69 | 69 |
70 #if defined(OS_CHROMEOS) | 70 #if defined(OS_CHROMEOS) |
71 // Ensure that the download directory specified in the preferences exists. | 71 // Ensure that the download directory specified in the preferences exists. |
72 BrowserThread::PostTask( | 72 BrowserThread::PostTask( |
73 BrowserThread::FILE, FROM_HERE, | 73 BrowserThread::FILE, FROM_HERE, |
74 NewRunnableFunction(&file_util::CreateDirectory, default_download_path)); | 74 NewRunnableFunction(&file_util::CreateDirectory, default_download_path)); |
75 #endif // defined(OS_CHROMEOS) | 75 #endif // defined(OS_CHROMEOS) |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 extensions.erase(extensions.size() - 1); | 151 extensions.erase(extensions.size() - 1); |
152 | 152 |
153 prefs_->SetString(prefs::kDownloadExtensionsToOpen, extensions); | 153 prefs_->SetString(prefs::kDownloadExtensionsToOpen, extensions); |
154 } | 154 } |
155 | 155 |
156 bool DownloadPrefs::AutoOpenCompareFunctor::operator()( | 156 bool DownloadPrefs::AutoOpenCompareFunctor::operator()( |
157 const FilePath::StringType& a, | 157 const FilePath::StringType& a, |
158 const FilePath::StringType& b) const { | 158 const FilePath::StringType& b) const { |
159 return FilePath::CompareLessIgnoreCase(a, b); | 159 return FilePath::CompareLessIgnoreCase(a, b); |
160 } | 160 } |
OLD | NEW |