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

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

Issue 6905044: Refactor preference syncing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self review Created 9 years, 8 months 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) 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/save_package.h" 5 #include "chrome/browser/download/save_package.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 // Check whether the preference has the preferred directory for saving file. If 1236 // Check whether the preference has the preferred directory for saving file. If
1237 // not, initialize it with default directory. 1237 // not, initialize it with default directory.
1238 FilePath SavePackage::GetSaveDirPreference(PrefService* prefs) { 1238 FilePath SavePackage::GetSaveDirPreference(PrefService* prefs) {
1239 DCHECK(prefs); 1239 DCHECK(prefs);
1240 1240
1241 if (!prefs->FindPreference(prefs::kSaveFileDefaultDirectory)) { 1241 if (!prefs->FindPreference(prefs::kSaveFileDefaultDirectory)) {
1242 DCHECK(prefs->FindPreference(prefs::kDownloadDefaultDirectory)); 1242 DCHECK(prefs->FindPreference(prefs::kDownloadDefaultDirectory));
1243 FilePath default_save_path = prefs->GetFilePath( 1243 FilePath default_save_path = prefs->GetFilePath(
1244 prefs::kDownloadDefaultDirectory); 1244 prefs::kDownloadDefaultDirectory);
1245 prefs->RegisterFilePathPref(prefs::kSaveFileDefaultDirectory, 1245 prefs->RegisterFilePathPref(prefs::kSaveFileDefaultDirectory,
1246 default_save_path); 1246 default_save_path,
1247 false /* don't sync pref */);
1247 } 1248 }
1248 1249
1249 // Get the directory from preference. 1250 // Get the directory from preference.
1250 FilePath save_file_path = prefs->GetFilePath( 1251 FilePath save_file_path = prefs->GetFilePath(
1251 prefs::kSaveFileDefaultDirectory); 1252 prefs::kSaveFileDefaultDirectory);
1252 DCHECK(!save_file_path.empty()); 1253 DCHECK(!save_file_path.empty());
1253 1254
1254 return save_file_path; 1255 return save_file_path;
1255 } 1256 }
1256 1257
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 } 1466 }
1466 1467
1467 // SelectFileDialog::Listener interface. 1468 // SelectFileDialog::Listener interface.
1468 void SavePackage::FileSelected(const FilePath& path, 1469 void SavePackage::FileSelected(const FilePath& path,
1469 int index, void* params) { 1470 int index, void* params) {
1470 ContinueSave(path, index); 1471 ContinueSave(path, index);
1471 } 1472 }
1472 1473
1473 void SavePackage::FileSelectionCanceled(void* params) { 1474 void SavePackage::FileSelectionCanceled(void* params) {
1474 } 1475 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698