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

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

Issue 11570009: Split PrefService into PrefService, PrefServiceSimple and PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head again, previous had unrelated broken win_rel test. 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/chrome_download_manager_delegate.h" 5 #include "chrome/browser/download/chrome_download_manager_delegate.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 #else 476 #else
477 return false; 477 return false;
478 #endif 478 #endif
479 } 479 }
480 480
481 void ChromeDownloadManagerDelegate::GetSaveDir(BrowserContext* browser_context, 481 void ChromeDownloadManagerDelegate::GetSaveDir(BrowserContext* browser_context,
482 FilePath* website_save_dir, 482 FilePath* website_save_dir,
483 FilePath* download_save_dir, 483 FilePath* download_save_dir,
484 bool* skip_dir_check) { 484 bool* skip_dir_check) {
485 Profile* profile = Profile::FromBrowserContext(browser_context); 485 Profile* profile = Profile::FromBrowserContext(browser_context);
486 PrefService* prefs = profile->GetPrefs(); 486 PrefServiceSyncable* prefs = profile->GetPrefs();
487 487
488 // Check whether the preference has the preferred directory for saving file. 488 // Check whether the preference has the preferred directory for saving file.
489 // If not, initialize it with default directory. 489 // If not, initialize it with default directory.
490 if (!prefs->FindPreference(prefs::kSaveFileDefaultDirectory)) { 490 if (!prefs->FindPreference(prefs::kSaveFileDefaultDirectory)) {
491 DCHECK(prefs->FindPreference(prefs::kDownloadDefaultDirectory)); 491 DCHECK(prefs->FindPreference(prefs::kDownloadDefaultDirectory));
492 FilePath default_save_path = prefs->GetFilePath( 492 FilePath default_save_path = prefs->GetFilePath(
493 prefs::kDownloadDefaultDirectory); 493 prefs::kDownloadDefaultDirectory);
494 prefs->RegisterFilePathPref(prefs::kSaveFileDefaultDirectory, 494 prefs->RegisterFilePathPref(prefs::kSaveFileDefaultDirectory,
495 default_save_path, 495 default_save_path,
496 PrefService::UNSYNCABLE_PREF); 496 PrefServiceSyncable::UNSYNCABLE_PREF);
497 } 497 }
498 498
499 // Get the directory from preference. 499 // Get the directory from preference.
500 *website_save_dir = prefs->GetFilePath(prefs::kSaveFileDefaultDirectory); 500 *website_save_dir = prefs->GetFilePath(prefs::kSaveFileDefaultDirectory);
501 DCHECK(!website_save_dir->empty()); 501 DCHECK(!website_save_dir->empty());
502 502
503 *download_save_dir = prefs->GetFilePath(prefs::kDownloadDefaultDirectory); 503 *download_save_dir = prefs->GetFilePath(prefs::kDownloadDefaultDirectory);
504 504
505 *skip_dir_check = false; 505 *skip_dir_check = false;
506 #if defined(OS_CHROMEOS) 506 #if defined(OS_CHROMEOS)
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 // TODO(asanka): This logic is a hack. DownloadFilePicker should give us a 853 // TODO(asanka): This logic is a hack. DownloadFilePicker should give us a
854 // directory to persist. Or perhaps, if the Drive path 854 // directory to persist. Or perhaps, if the Drive path
855 // substitution logic is moved here, then we would have a 855 // substitution logic is moved here, then we would have a
856 // persistable path after the DownloadFilePicker is done. 856 // persistable path after the DownloadFilePicker is done.
857 if (disposition == DownloadItem::TARGET_DISPOSITION_PROMPT && 857 if (disposition == DownloadItem::TARGET_DISPOSITION_PROMPT &&
858 !download->IsTemporary()) 858 !download->IsTemporary())
859 last_download_path_ = target_path.DirName(); 859 last_download_path_ = target_path.DirName();
860 } 860 }
861 callback.Run(target_path, disposition, danger_type, intermediate_path); 861 callback.Run(target_path, disposition, danger_type, intermediate_path);
862 } 862 }
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_window.cc ('k') | chrome/browser/download/chrome_download_manager_delegate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698