OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_target_determiner.h" | 5 #include "chrome/browser/download/download_target_determiner.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 base::FilePath target_directory; | 203 base::FilePath target_directory; |
204 if (should_prompt_) { | 204 if (should_prompt_) { |
205 DCHECK(!download_prefs_->IsDownloadPathManaged()); | 205 DCHECK(!download_prefs_->IsDownloadPathManaged()); |
206 // If the user is going to be prompted and the user has been prompted | 206 // If the user is going to be prompted and the user has been prompted |
207 // before, then always prefer the last directory that the user selected. | 207 // before, then always prefer the last directory that the user selected. |
208 target_directory = download_prefs_->SaveFilePath(); | 208 target_directory = download_prefs_->SaveFilePath(); |
209 } else { | 209 } else { |
210 target_directory = download_prefs_->DownloadPath(); | 210 target_directory = download_prefs_->DownloadPath(); |
211 } | 211 } |
212 virtual_path_ = target_directory.Append(generated_filename); | 212 virtual_path_ = target_directory.Append(generated_filename); |
| 213 #if defined(OS_ANDROID) |
| 214 conflict_action_ = DownloadPathReservationTracker::PROMPT; |
| 215 #else |
213 conflict_action_ = DownloadPathReservationTracker::UNIQUIFY; | 216 conflict_action_ = DownloadPathReservationTracker::UNIQUIFY; |
| 217 #endif |
214 should_notify_extensions_ = true; | 218 should_notify_extensions_ = true; |
215 } else { | 219 } else { |
216 virtual_path_ = download_->GetForcedFilePath(); | 220 virtual_path_ = download_->GetForcedFilePath(); |
217 // If this is a resumed download which was previously interrupted due to an | 221 // If this is a resumed download which was previously interrupted due to an |
218 // issue with the forced path, the user is still not prompted. If the path | 222 // issue with the forced path, the user is still not prompted. If the path |
219 // supplied to a programmatic download is invalid, then the caller needs to | 223 // supplied to a programmatic download is invalid, then the caller needs to |
220 // intervene. | 224 // intervene. |
221 } | 225 } |
222 DCHECK(virtual_path_.IsAbsolute()); | 226 DCHECK(virtual_path_.IsAbsolute()); |
223 DVLOG(20) << "Generated virtual path: " << virtual_path_.AsUTF8Unsafe(); | 227 DVLOG(20) << "Generated virtual path: " << virtual_path_.AsUTF8Unsafe(); |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 const base::FilePath& suggested_path) { | 890 const base::FilePath& suggested_path) { |
887 return base::FilePath(suggested_path.value() + kCrdownloadSuffix); | 891 return base::FilePath(suggested_path.value() + kCrdownloadSuffix); |
888 } | 892 } |
889 | 893 |
890 #if defined(OS_WIN) | 894 #if defined(OS_WIN) |
891 // static | 895 // static |
892 bool DownloadTargetDeterminer::IsAdobeReaderUpToDate() { | 896 bool DownloadTargetDeterminer::IsAdobeReaderUpToDate() { |
893 return g_is_adobe_reader_up_to_date_; | 897 return g_is_adobe_reader_up_to_date_; |
894 } | 898 } |
895 #endif | 899 #endif |
OLD | NEW |