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/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 return COMPLETE; | 453 return COMPLETE; |
454 } | 454 } |
455 | 455 |
456 void DownloadTargetDeterminer::ScheduleCallbackAndDeleteSelf() { | 456 void DownloadTargetDeterminer::ScheduleCallbackAndDeleteSelf() { |
457 DCHECK(download_); | 457 DCHECK(download_); |
458 DVLOG(20) << "Scheduling callback. Virtual:" << virtual_path_.AsUTF8Unsafe() | 458 DVLOG(20) << "Scheduling callback. Virtual:" << virtual_path_.AsUTF8Unsafe() |
459 << " Local:" << local_path_.AsUTF8Unsafe() | 459 << " Local:" << local_path_.AsUTF8Unsafe() |
460 << " Intermediate:" << intermediate_path_.AsUTF8Unsafe() | 460 << " Intermediate:" << intermediate_path_.AsUTF8Unsafe() |
461 << " Should prompt:" << should_prompt_ | 461 << " Should prompt:" << should_prompt_ |
462 << " Danger type:" << danger_type_; | 462 << " Danger type:" << danger_type_; |
463 MessageLoop::current()->PostTask( | 463 base::MessageLoop::current()->PostTask( |
464 FROM_HERE, | 464 FROM_HERE, |
465 base::Bind(completion_callback_, | 465 base::Bind(completion_callback_, |
466 local_path_, | 466 local_path_, |
467 (should_prompt_ ? DownloadItem::TARGET_DISPOSITION_PROMPT : | 467 (should_prompt_ ? DownloadItem::TARGET_DISPOSITION_PROMPT : |
468 DownloadItem::TARGET_DISPOSITION_OVERWRITE), | 468 DownloadItem::TARGET_DISPOSITION_OVERWRITE), |
469 danger_type_, | 469 danger_type_, |
470 intermediate_path_)); | 470 intermediate_path_)); |
471 completion_callback_.Reset(); | 471 completion_callback_.Reset(); |
472 delete this; | 472 delete this; |
473 } | 473 } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 new DownloadTargetDeterminer(download, download_prefs, | 594 new DownloadTargetDeterminer(download, download_prefs, |
595 last_selected_directory, delegate, callback); | 595 last_selected_directory, delegate, callback); |
596 } | 596 } |
597 | 597 |
598 // static | 598 // static |
599 base::FilePath DownloadTargetDeterminer::GetCrDownloadPath( | 599 base::FilePath DownloadTargetDeterminer::GetCrDownloadPath( |
600 const base::FilePath& suggested_path) { | 600 const base::FilePath& suggested_path) { |
601 return base::FilePath(suggested_path.value() + | 601 return base::FilePath(suggested_path.value() + |
602 FILE_PATH_LITERAL(".crdownload")); | 602 FILE_PATH_LITERAL(".crdownload")); |
603 } | 603 } |
OLD | NEW |