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

Unified Diff: chrome/browser/download/download_prefs.cc

Issue 10815024: Revert 147594 - NaCl: Remove two uses of '#include "nacl/nacl_log.h"' (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/download/download_prefs.h ('k') | chrome/browser/download/save_page_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_prefs.cc
===================================================================
--- chrome/browser/download/download_prefs.cc (revision 147600)
+++ chrome/browser/download/download_prefs.cc (working copy)
@@ -22,12 +22,14 @@
#include "chrome/browser/download/download_util.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/download_manager.h"
#include "content/public/browser/save_page_type.h"
#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/gdata/gdata_system_service.h"
#include "chrome/browser/chromeos/gdata/gdata_util.h"
#endif
@@ -35,7 +37,8 @@
using content::BrowserThread;
using content::DownloadManager;
-DownloadPrefs::DownloadPrefs(PrefService* prefs) : prefs_(prefs) {
+DownloadPrefs::DownloadPrefs(Profile* profile) : profile_(profile) {
+ PrefService* prefs = profile->GetPrefs();
prompt_for_download_.Init(prefs::kPromptForDownload, prefs, NULL);
download_path_.Init(prefs::kDownloadDefaultDirectory, prefs, NULL);
save_file_type_.Init(prefs::kSaveFileType, prefs, NULL);
@@ -122,6 +125,18 @@
return FromDownloadManager(BrowserContext::GetDownloadManager(context));
}
+FilePath DownloadPrefs::DownloadPath() const {
+#if defined(OS_CHROMEOS)
+ // If the download path is under /drive, and GDataSystemService isn't
+ // available (which it isn't for incognito mode, for instance), use the
+ // default download directory (/Downloads).
+ if (gdata::util::IsUnderGDataMountPoint(*download_path_) &&
+ !gdata::GDataSystemServiceFactory::GetForProfile(profile_))
+ return download_util::GetDefaultDownloadDirectory();
+#endif
+ return *download_path_;
+}
+
bool DownloadPrefs::PromptForDownload() const {
// If the DownloadDirectory policy is set, then |prompt_for_download_| should
// always be false.
@@ -184,7 +199,7 @@
if (!extensions.empty())
extensions.erase(extensions.size() - 1);
- prefs_->SetString(prefs::kDownloadExtensionsToOpen, extensions);
+ profile_->GetPrefs()->SetString(prefs::kDownloadExtensionsToOpen, extensions);
}
bool DownloadPrefs::AutoOpenCompareFunctor::operator()(
« no previous file with comments | « chrome/browser/download/download_prefs.h ('k') | chrome/browser/download/save_page_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698