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" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "base/sys_string_conversions.h" | 12 #include "base/sys_string_conversions.h" |
13 #include "base/task.h" | 13 #include "base/task.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 15 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
16 #include "chrome/browser/download/download_extensions.h" | 16 #include "chrome/browser/download/download_extensions.h" |
17 #include "chrome/browser/download/download_util.h" | 17 #include "chrome/browser/download/download_util.h" |
18 #include "chrome/browser/prefs/pref_service.h" | 18 #include "chrome/browser/prefs/pref_service.h" |
19 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
20 #include "content/browser/download/download_manager.h" | 20 #include "content/browser/download/download_manager.h" |
21 #include "content/browser/download/save_package.h" | 21 #include "content/browser/download/save_package.h" |
22 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
23 | 23 |
| 24 using content::BrowserThread; |
| 25 |
24 DownloadPrefs::DownloadPrefs(PrefService* prefs) : prefs_(prefs) { | 26 DownloadPrefs::DownloadPrefs(PrefService* prefs) : prefs_(prefs) { |
25 prompt_for_download_.Init(prefs::kPromptForDownload, prefs, NULL); | 27 prompt_for_download_.Init(prefs::kPromptForDownload, prefs, NULL); |
26 download_path_.Init(prefs::kDownloadDefaultDirectory, prefs, NULL); | 28 download_path_.Init(prefs::kDownloadDefaultDirectory, prefs, NULL); |
27 save_file_type_.Init(prefs::kSaveFileType, prefs, NULL); | 29 save_file_type_.Init(prefs::kSaveFileType, prefs, NULL); |
28 | 30 |
29 // We store any file extension that should be opened automatically at | 31 // We store any file extension that should be opened automatically at |
30 // download completion in this pref. | 32 // download completion in this pref. |
31 std::string extensions_to_open = | 33 std::string extensions_to_open = |
32 prefs->GetString(prefs::kDownloadExtensionsToOpen); | 34 prefs->GetString(prefs::kDownloadExtensionsToOpen); |
33 std::vector<std::string> extensions; | 35 std::vector<std::string> extensions; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 extensions.erase(extensions.size() - 1); | 165 extensions.erase(extensions.size() - 1); |
164 | 166 |
165 prefs_->SetString(prefs::kDownloadExtensionsToOpen, extensions); | 167 prefs_->SetString(prefs::kDownloadExtensionsToOpen, extensions); |
166 } | 168 } |
167 | 169 |
168 bool DownloadPrefs::AutoOpenCompareFunctor::operator()( | 170 bool DownloadPrefs::AutoOpenCompareFunctor::operator()( |
169 const FilePath::StringType& a, | 171 const FilePath::StringType& a, |
170 const FilePath::StringType& b) const { | 172 const FilePath::StringType& b) const { |
171 return FilePath::CompareLessIgnoreCase(a, b); | 173 return FilePath::CompareLessIgnoreCase(a, b); |
172 } | 174 } |
OLD | NEW |