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

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

Issue 2890853002: Downloads: replace BrowserThread::FILE with task scheduler. (Closed)
Patch Set: Add scoped COM initialization to quench a couple of assertion failures. Created 3 years, 5 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
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 const base::FilePath current = prefs->GetFilePath(path_pref[i]); 123 const base::FilePath current = prefs->GetFilePath(path_pref[i]);
124 base::FilePath migrated; 124 base::FilePath migrated;
125 if (!current.empty() && 125 if (!current.empty() &&
126 file_manager::util::MigratePathFromOldFormat( 126 file_manager::util::MigratePathFromOldFormat(
127 profile_, current, &migrated)) { 127 profile_, current, &migrated)) {
128 prefs->SetFilePath(path_pref[i], migrated); 128 prefs->SetFilePath(path_pref[i], migrated);
129 } 129 }
130 } 130 }
131 131
132 // Ensure that the default download directory exists. 132 // Ensure that the default download directory exists.
133 BrowserThread::PostTask( 133 content::DownloadManager::GetTaskRunner()->PostTask(
134 BrowserThread::FILE, FROM_HERE, 134 FROM_HERE, base::BindOnce(base::IgnoreResult(&base::CreateDirectory),
135 base::BindOnce(base::IgnoreResult(&base::CreateDirectory), 135 GetDefaultDownloadDirectoryForProfile()));
136 GetDefaultDownloadDirectoryForProfile()));
137 #endif // defined(OS_CHROMEOS) 136 #endif // defined(OS_CHROMEOS)
138 137
139 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_MACOSX) 138 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_MACOSX)
140 should_open_pdf_in_system_reader_ = 139 should_open_pdf_in_system_reader_ =
141 prefs->GetBoolean(prefs::kOpenPdfDownloadInSystemReader); 140 prefs->GetBoolean(prefs::kOpenPdfDownloadInSystemReader);
142 #endif 141 #endif
143 142
144 // If the download path is dangerous we forcefully reset it. But if we do 143 // If the download path is dangerous we forcefully reset it. But if we do
145 // so we set a flag to make sure we only do it once, to avoid fighting 144 // so we set a flag to make sure we only do it once, to avoid fighting
146 // the user if they really want it on an unsafe place such as the desktop. 145 // the user if they really want it on an unsafe place such as the desktop.
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 extensions.erase(extensions.size() - 1); 395 extensions.erase(extensions.size() - 1);
397 396
398 profile_->GetPrefs()->SetString(prefs::kDownloadExtensionsToOpen, extensions); 397 profile_->GetPrefs()->SetString(prefs::kDownloadExtensionsToOpen, extensions);
399 } 398 }
400 399
401 bool DownloadPrefs::AutoOpenCompareFunctor::operator()( 400 bool DownloadPrefs::AutoOpenCompareFunctor::operator()(
402 const base::FilePath::StringType& a, 401 const base::FilePath::StringType& a,
403 const base::FilePath::StringType& b) const { 402 const base::FilePath::StringType& b) const {
404 return base::FilePath::CompareLessIgnoreCase(a, b); 403 return base::FilePath::CompareLessIgnoreCase(a, b);
405 } 404 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698