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 21 matching lines...) Expand all Loading... |
32 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" | 32 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" |
33 #include "chrome/browser/chromeos/drive/drive_system_service.h" | 33 #include "chrome/browser/chromeos/drive/drive_system_service.h" |
34 #endif | 34 #endif |
35 | 35 |
36 using content::BrowserContext; | 36 using content::BrowserContext; |
37 using content::BrowserThread; | 37 using content::BrowserThread; |
38 using content::DownloadManager; | 38 using content::DownloadManager; |
39 | 39 |
40 DownloadPrefs::DownloadPrefs(Profile* profile) : profile_(profile) { | 40 DownloadPrefs::DownloadPrefs(Profile* profile) : profile_(profile) { |
41 PrefService* prefs = profile->GetPrefs(); | 41 PrefService* prefs = profile->GetPrefs(); |
42 prompt_for_download_.Init(prefs::kPromptForDownload, prefs, NULL); | 42 prompt_for_download_.Init(prefs::kPromptForDownload, prefs); |
43 download_path_.Init(prefs::kDownloadDefaultDirectory, prefs, NULL); | 43 download_path_.Init(prefs::kDownloadDefaultDirectory, prefs); |
44 save_file_type_.Init(prefs::kSaveFileType, prefs, NULL); | 44 save_file_type_.Init(prefs::kSaveFileType, prefs); |
45 | 45 |
46 // We store any file extension that should be opened automatically at | 46 // We store any file extension that should be opened automatically at |
47 // download completion in this pref. | 47 // download completion in this pref. |
48 std::string extensions_to_open = | 48 std::string extensions_to_open = |
49 prefs->GetString(prefs::kDownloadExtensionsToOpen); | 49 prefs->GetString(prefs::kDownloadExtensionsToOpen); |
50 std::vector<std::string> extensions; | 50 std::vector<std::string> extensions; |
51 base::SplitString(extensions_to_open, ':', &extensions); | 51 base::SplitString(extensions_to_open, ':', &extensions); |
52 | 52 |
53 for (size_t i = 0; i < extensions.size(); ++i) { | 53 for (size_t i = 0; i < extensions.size(); ++i) { |
54 #if defined(OS_POSIX) | 54 #if defined(OS_POSIX) |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 extensions.erase(extensions.size() - 1); | 200 extensions.erase(extensions.size() - 1); |
201 | 201 |
202 profile_->GetPrefs()->SetString(prefs::kDownloadExtensionsToOpen, extensions); | 202 profile_->GetPrefs()->SetString(prefs::kDownloadExtensionsToOpen, extensions); |
203 } | 203 } |
204 | 204 |
205 bool DownloadPrefs::AutoOpenCompareFunctor::operator()( | 205 bool DownloadPrefs::AutoOpenCompareFunctor::operator()( |
206 const FilePath::StringType& a, | 206 const FilePath::StringType& a, |
207 const FilePath::StringType& b) const { | 207 const FilePath::StringType& b) const { |
208 return FilePath::CompareLessIgnoreCase(a, b); | 208 return FilePath::CompareLessIgnoreCase(a, b); |
209 } | 209 } |
OLD | NEW |