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

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: Rebase + comments Created 9 years, 7 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 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 // Check whether the preference has the preferred directory for saving file. If 1235 // Check whether the preference has the preferred directory for saving file. If
1236 // not, initialize it with default directory. 1236 // not, initialize it with default directory.
1237 FilePath SavePackage::GetSaveDirPreference(PrefService* prefs) { 1237 FilePath SavePackage::GetSaveDirPreference(PrefService* prefs) {
1238 DCHECK(prefs); 1238 DCHECK(prefs);
1239 1239
1240 if (!prefs->FindPreference(prefs::kSaveFileDefaultDirectory)) { 1240 if (!prefs->FindPreference(prefs::kSaveFileDefaultDirectory)) {
1241 DCHECK(prefs->FindPreference(prefs::kDownloadDefaultDirectory)); 1241 DCHECK(prefs->FindPreference(prefs::kDownloadDefaultDirectory));
1242 FilePath default_save_path = prefs->GetFilePath( 1242 FilePath default_save_path = prefs->GetFilePath(
1243 prefs::kDownloadDefaultDirectory); 1243 prefs::kDownloadDefaultDirectory);
1244 prefs->RegisterFilePathPref(prefs::kSaveFileDefaultDirectory, 1244 prefs->RegisterFilePathPref(prefs::kSaveFileDefaultDirectory,
1245 default_save_path); 1245 default_save_path,
1246 false /* don't sync pref */);
1246 } 1247 }
1247 1248
1248 // Get the directory from preference. 1249 // Get the directory from preference.
1249 FilePath save_file_path = prefs->GetFilePath( 1250 FilePath save_file_path = prefs->GetFilePath(
1250 prefs::kSaveFileDefaultDirectory); 1251 prefs::kSaveFileDefaultDirectory);
1251 DCHECK(!save_file_path.empty()); 1252 DCHECK(!save_file_path.empty());
1252 1253
1253 return save_file_path; 1254 return save_file_path;
1254 } 1255 }
1255 1256
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1464 } 1465 }
1465 1466
1466 // SelectFileDialog::Listener interface. 1467 // SelectFileDialog::Listener interface.
1467 void SavePackage::FileSelected(const FilePath& path, 1468 void SavePackage::FileSelected(const FilePath& path,
1468 int index, void* params) { 1469 int index, void* params) {
1469 ContinueSave(path, index); 1470 ContinueSave(path, index);
1470 } 1471 }
1471 1472
1472 void SavePackage::FileSelectionCanceled(void* params) { 1473 void SavePackage::FileSelectionCanceled(void* params) {
1473 } 1474 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698