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

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

Issue 27354: Add FilePath setter/getter to pref service.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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
« no previous file with comments | « chrome/browser/browser_process_impl.cc ('k') | chrome/browser/download/save_package.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_manager.h" 5 #include "chrome/browser/download/download_manager.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 prefs->RegisterBooleanPref(prefs::kPromptForDownload, false); 295 prefs->RegisterBooleanPref(prefs::kPromptForDownload, false);
296 prefs->RegisterStringPref(prefs::kDownloadExtensionsToOpen, L""); 296 prefs->RegisterStringPref(prefs::kDownloadExtensionsToOpen, L"");
297 prefs->RegisterBooleanPref(prefs::kDownloadDirUpgraded, false); 297 prefs->RegisterBooleanPref(prefs::kDownloadDirUpgraded, false);
298 298
299 // The default download path is userprofile\download. 299 // The default download path is userprofile\download.
300 FilePath default_download_path; 300 FilePath default_download_path;
301 if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, 301 if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS,
302 &default_download_path)) { 302 &default_download_path)) {
303 NOTREACHED(); 303 NOTREACHED();
304 } 304 }
305 prefs->RegisterStringPref(prefs::kDownloadDefaultDirectory, 305 prefs->RegisterFilePathPref(prefs::kDownloadDefaultDirectory,
306 default_download_path.ToWStringHack()); 306 default_download_path);
307 307
308 // If the download path is dangerous we forcefully reset it. But if we do 308 // If the download path is dangerous we forcefully reset it. But if we do
309 // so we set a flag to make sure we only do it once, to avoid fighting 309 // so we set a flag to make sure we only do it once, to avoid fighting
310 // the user if he really wants it on an unsafe place such as the desktop. 310 // the user if he really wants it on an unsafe place such as the desktop.
311 311
312 if (!prefs->GetBoolean(prefs::kDownloadDirUpgraded)) { 312 if (!prefs->GetBoolean(prefs::kDownloadDirUpgraded)) {
313 FilePath current_download_dir = FilePath::FromWStringHack( 313 FilePath current_download_dir = FilePath::FromWStringHack(
314 prefs->GetString(prefs::kDownloadDefaultDirectory)); 314 prefs->GetString(prefs::kDownloadDefaultDirectory));
315 if (DownloadPathIsDangerous(current_download_dir)) { 315 if (DownloadPathIsDangerous(current_download_dir)) {
316 prefs->SetString(prefs::kDownloadDefaultDirectory, 316 prefs->SetString(prefs::kDownloadDefaultDirectory,
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 searched_downloads.push_back(dit->second); 1430 searched_downloads.push_back(dit->second);
1431 } 1431 }
1432 1432
1433 requestor->SetDownloads(searched_downloads); 1433 requestor->SetDownloads(searched_downloads);
1434 } 1434 }
1435 1435
1436 // Clears the last download path, used to initialize "save as" dialogs. 1436 // Clears the last download path, used to initialize "save as" dialogs.
1437 void DownloadManager::ClearLastDownloadPath() { 1437 void DownloadManager::ClearLastDownloadPath() {
1438 last_download_path_ = FilePath(); 1438 last_download_path_ = FilePath();
1439 } 1439 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_process_impl.cc ('k') | chrome/browser/download/save_package.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698