OLD | NEW |
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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 DownloadPrefs* DownloadPrefs::FromBrowserContext( | 123 DownloadPrefs* DownloadPrefs::FromBrowserContext( |
124 content::BrowserContext* context) { | 124 content::BrowserContext* context) { |
125 return FromDownloadManager(BrowserContext::GetDownloadManager(context)); | 125 return FromDownloadManager(BrowserContext::GetDownloadManager(context)); |
126 } | 126 } |
127 | 127 |
128 FilePath DownloadPrefs::DownloadPath() const { | 128 FilePath DownloadPrefs::DownloadPath() const { |
129 #if defined(OS_CHROMEOS) | 129 #if defined(OS_CHROMEOS) |
130 // If the download path is under /drive, and DriveSystemService isn't | 130 // If the download path is under /drive, and DriveSystemService isn't |
131 // available (which it isn't for incognito mode, for instance), use the | 131 // available (which it isn't for incognito mode, for instance), use the |
132 // default download directory (/Downloads). | 132 // default download directory (/Downloads). |
133 if (gdata::util::IsUnderGDataMountPoint(*download_path_) && | 133 if (gdata::util::IsUnderDriveMountPoint(*download_path_) && |
134 !gdata::DriveSystemServiceFactory::GetForProfile(profile_)) | 134 !gdata::DriveSystemServiceFactory::GetForProfile(profile_)) |
135 return download_util::GetDefaultDownloadDirectory(); | 135 return download_util::GetDefaultDownloadDirectory(); |
136 #endif | 136 #endif |
137 return *download_path_; | 137 return *download_path_; |
138 } | 138 } |
139 | 139 |
140 bool DownloadPrefs::PromptForDownload() const { | 140 bool DownloadPrefs::PromptForDownload() const { |
141 // If the DownloadDirectory policy is set, then |prompt_for_download_| should | 141 // If the DownloadDirectory policy is set, then |prompt_for_download_| should |
142 // always be false. | 142 // always be false. |
143 DCHECK(!download_path_.IsManaged() || !prompt_for_download_.GetValue()); | 143 DCHECK(!download_path_.IsManaged() || !prompt_for_download_.GetValue()); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 extensions.erase(extensions.size() - 1); | 200 extensions.erase(extensions.size() - 1); |
201 | 201 |
202 profile_->GetPrefs()->SetString(prefs::kDownloadExtensionsToOpen, extensions); | 202 profile_->GetPrefs()->SetString(prefs::kDownloadExtensionsToOpen, extensions); |
203 } | 203 } |
204 | 204 |
205 bool DownloadPrefs::AutoOpenCompareFunctor::operator()( | 205 bool DownloadPrefs::AutoOpenCompareFunctor::operator()( |
206 const FilePath::StringType& a, | 206 const FilePath::StringType& a, |
207 const FilePath::StringType& b) const { | 207 const FilePath::StringType& b) const { |
208 return FilePath::CompareLessIgnoreCase(a, b); | 208 return FilePath::CompareLessIgnoreCase(a, b); |
209 } | 209 } |
OLD | NEW |