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/location.h" |
7 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
8 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
| 10 #include "base/single_thread_task_runner.h" |
9 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 #include "base/thread_task_runner_handle.h" |
10 #include "base/time/time.h" | 13 #include "base/time/time.h" |
11 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 14 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
12 #include "chrome/browser/download/download_crx_util.h" | 15 #include "chrome/browser/download/download_crx_util.h" |
13 #include "chrome/browser/download/download_extensions.h" | 16 #include "chrome/browser/download/download_extensions.h" |
14 #include "chrome/browser/download/download_prefs.h" | 17 #include "chrome/browser/download/download_prefs.h" |
15 #include "chrome/browser/history/history_service_factory.h" | 18 #include "chrome/browser/history/history_service_factory.h" |
16 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
18 #include "chrome/grit/generated_resources.h" | 21 #include "chrome/grit/generated_resources.h" |
19 #include "components/history/core/browser/history_service.h" | 22 #include "components/history/core/browser/history_service.h" |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 target_info->target_disposition = | 729 target_info->target_disposition = |
727 (HasPromptedForPath() || should_prompt_ | 730 (HasPromptedForPath() || should_prompt_ |
728 ? DownloadItem::TARGET_DISPOSITION_PROMPT | 731 ? DownloadItem::TARGET_DISPOSITION_PROMPT |
729 : DownloadItem::TARGET_DISPOSITION_OVERWRITE); | 732 : DownloadItem::TARGET_DISPOSITION_OVERWRITE); |
730 target_info->danger_type = danger_type_; | 733 target_info->danger_type = danger_type_; |
731 target_info->is_dangerous_file = is_dangerous_file_; | 734 target_info->is_dangerous_file = is_dangerous_file_; |
732 target_info->intermediate_path = intermediate_path_; | 735 target_info->intermediate_path = intermediate_path_; |
733 target_info->mime_type = mime_type_; | 736 target_info->mime_type = mime_type_; |
734 target_info->is_filetype_handled_safely = is_filetype_handled_safely_; | 737 target_info->is_filetype_handled_safely = is_filetype_handled_safely_; |
735 | 738 |
736 base::MessageLoop::current()->PostTask( | 739 base::ThreadTaskRunnerHandle::Get()->PostTask( |
737 FROM_HERE, base::Bind(completion_callback_, base::Passed(&target_info))); | 740 FROM_HERE, base::Bind(completion_callback_, base::Passed(&target_info))); |
738 completion_callback_.Reset(); | 741 completion_callback_.Reset(); |
739 delete this; | 742 delete this; |
740 } | 743 } |
741 | 744 |
742 void DownloadTargetDeterminer::CancelOnFailureAndDeleteSelf() { | 745 void DownloadTargetDeterminer::CancelOnFailureAndDeleteSelf() { |
743 // Path substitution failed. | 746 // Path substitution failed. |
744 virtual_path_.clear(); | 747 virtual_path_.clear(); |
745 local_path_.clear(); | 748 local_path_.clear(); |
746 intermediate_path_.clear(); | 749 intermediate_path_.clear(); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 const base::FilePath& suggested_path) { | 895 const base::FilePath& suggested_path) { |
893 return base::FilePath(suggested_path.value() + kCrdownloadSuffix); | 896 return base::FilePath(suggested_path.value() + kCrdownloadSuffix); |
894 } | 897 } |
895 | 898 |
896 #if defined(OS_WIN) | 899 #if defined(OS_WIN) |
897 // static | 900 // static |
898 bool DownloadTargetDeterminer::IsAdobeReaderUpToDate() { | 901 bool DownloadTargetDeterminer::IsAdobeReaderUpToDate() { |
899 return g_is_adobe_reader_up_to_date_; | 902 return g_is_adobe_reader_up_to_date_; |
900 } | 903 } |
901 #endif | 904 #endif |
OLD | NEW |