Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: chrome/browser/download/download_prefs.cc

Issue 11570009: Split PrefService into PrefService, PrefServiceSimple and PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 download_util::GetFileDangerLevel(path) == download_util::NotDangerous) 60 download_util::GetFileDangerLevel(path) == download_util::NotDangerous)
61 auto_open_.insert(path.value()); 61 auto_open_.insert(path.value());
62 } 62 }
63 } 63 }
64 64
65 DownloadPrefs::~DownloadPrefs() { 65 DownloadPrefs::~DownloadPrefs() {
66 SaveAutoOpenState(); 66 SaveAutoOpenState();
67 } 67 }
68 68
69 // static 69 // static
70 void DownloadPrefs::RegisterUserPrefs(PrefServiceBase* prefs) { 70 void DownloadPrefs::RegisterUserPrefs(PrefServiceSyncable* prefs) {
71 prefs->RegisterBooleanPref(prefs::kPromptForDownload, 71 prefs->RegisterBooleanPref(prefs::kPromptForDownload,
72 false, 72 false,
73 PrefServiceBase::SYNCABLE_PREF); 73 PrefServiceSyncable::SYNCABLE_PREF);
74 prefs->RegisterStringPref(prefs::kDownloadExtensionsToOpen, 74 prefs->RegisterStringPref(prefs::kDownloadExtensionsToOpen,
75 "", 75 "",
76 PrefServiceBase::UNSYNCABLE_PREF); 76 PrefServiceSyncable::UNSYNCABLE_PREF);
77 prefs->RegisterBooleanPref(prefs::kDownloadDirUpgraded, 77 prefs->RegisterBooleanPref(prefs::kDownloadDirUpgraded,
78 false, 78 false,
79 PrefServiceBase::UNSYNCABLE_PREF); 79 PrefServiceSyncable::UNSYNCABLE_PREF);
80 prefs->RegisterIntegerPref(prefs::kSaveFileType, 80 prefs->RegisterIntegerPref(prefs::kSaveFileType,
81 content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML, 81 content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML,
82 PrefServiceBase::UNSYNCABLE_PREF); 82 PrefServiceSyncable::UNSYNCABLE_PREF);
83 83
84 // The default download path is userprofile\download. 84 // The default download path is userprofile\download.
85 const FilePath& default_download_path = 85 const FilePath& default_download_path =
86 download_util::GetDefaultDownloadDirectory(); 86 download_util::GetDefaultDownloadDirectory();
87 prefs->RegisterFilePathPref(prefs::kDownloadDefaultDirectory, 87 prefs->RegisterFilePathPref(prefs::kDownloadDefaultDirectory,
88 default_download_path, 88 default_download_path,
89 PrefServiceBase::UNSYNCABLE_PREF); 89 PrefServiceSyncable::UNSYNCABLE_PREF);
90 90
91 #if defined(OS_CHROMEOS) 91 #if defined(OS_CHROMEOS)
92 // Ensure that the download directory specified in the preferences exists. 92 // Ensure that the download directory specified in the preferences exists.
93 BrowserThread::PostTask( 93 BrowserThread::PostTask(
94 BrowserThread::FILE, FROM_HERE, 94 BrowserThread::FILE, FROM_HERE,
95 base::Bind(base::IgnoreResult(&file_util::CreateDirectory), 95 base::Bind(base::IgnoreResult(&file_util::CreateDirectory),
96 default_download_path)); 96 default_download_path));
97 #endif // defined(OS_CHROMEOS) 97 #endif // defined(OS_CHROMEOS)
98 98
99 // If the download path is dangerous we forcefully reset it. But if we do 99 // If the download path is dangerous we forcefully reset it. But if we do
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698