| 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/chrome_download_manager_delegate.h" | 5 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/prefs/pref_service.h" |
| 13 #include "base/prefs/public/pref_member.h" | 14 #include "base/prefs/public/pref_member.h" |
| 14 #include "base/rand_util.h" | 15 #include "base/rand_util.h" |
| 15 #include "base/stringprintf.h" | 16 #include "base/stringprintf.h" |
| 16 #include "base/time.h" | 17 #include "base/time.h" |
| 17 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
| 18 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/download/download_completion_blocker.h" | 20 #include "chrome/browser/download/download_completion_blocker.h" |
| 20 #include "chrome/browser/download/download_crx_util.h" | 21 #include "chrome/browser/download/download_crx_util.h" |
| 21 #include "chrome/browser/download/download_extensions.h" | 22 #include "chrome/browser/download/download_extensions.h" |
| 22 #include "chrome/browser/download/download_file_picker.h" | 23 #include "chrome/browser/download/download_file_picker.h" |
| 23 #include "chrome/browser/download/download_history.h" | 24 #include "chrome/browser/download/download_history.h" |
| 24 #include "chrome/browser/download/download_path_reservation_tracker.h" | 25 #include "chrome/browser/download/download_path_reservation_tracker.h" |
| 25 #include "chrome/browser/download/download_prefs.h" | 26 #include "chrome/browser/download/download_prefs.h" |
| 26 #include "chrome/browser/download/download_status_updater.h" | 27 #include "chrome/browser/download/download_status_updater.h" |
| 27 #include "chrome/browser/download/download_util.h" | 28 #include "chrome/browser/download/download_util.h" |
| 28 #include "chrome/browser/download/save_package_file_picker.h" | 29 #include "chrome/browser/download/save_package_file_picker.h" |
| 29 #include "chrome/browser/extensions/api/downloads/downloads_api.h" | 30 #include "chrome/browser/extensions/api/downloads/downloads_api.h" |
| 30 #include "chrome/browser/extensions/crx_installer.h" | 31 #include "chrome/browser/extensions/crx_installer.h" |
| 31 #include "chrome/browser/extensions/extension_service.h" | 32 #include "chrome/browser/extensions/extension_service.h" |
| 32 #include "chrome/browser/extensions/extension_system.h" | 33 #include "chrome/browser/extensions/extension_system.h" |
| 33 #include "chrome/browser/history/history_service.h" | 34 #include "chrome/browser/history/history_service.h" |
| 34 #include "chrome/browser/history/history_service_factory.h" | 35 #include "chrome/browser/history/history_service_factory.h" |
| 35 #include "chrome/browser/intents/web_intents_util.h" | 36 #include "chrome/browser/intents/web_intents_util.h" |
| 36 #include "chrome/browser/platform_util.h" | 37 #include "chrome/browser/platform_util.h" |
| 37 #include "chrome/browser/prefs/pref_registry_syncable.h" | 38 #include "chrome/browser/prefs/pref_registry_syncable.h" |
| 38 #include "chrome/browser/prefs/pref_service.h" | |
| 39 #include "chrome/browser/profiles/profile.h" | 39 #include "chrome/browser/profiles/profile.h" |
| 40 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 40 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 41 #include "chrome/browser/ui/browser.h" | 41 #include "chrome/browser/ui/browser.h" |
| 42 #include "chrome/browser/ui/host_desktop.h" | 42 #include "chrome/browser/ui/host_desktop.h" |
| 43 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 43 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 44 #include "chrome/common/chrome_notification_types.h" | 44 #include "chrome/common/chrome_notification_types.h" |
| 45 #include "chrome/common/extensions/feature_switch.h" | 45 #include "chrome/common/extensions/feature_switch.h" |
| 46 #include "chrome/common/extensions/user_script.h" | 46 #include "chrome/common/extensions/user_script.h" |
| 47 #include "chrome/common/pref_names.h" | 47 #include "chrome/common/pref_names.h" |
| 48 #include "content/public/browser/download_item.h" | 48 #include "content/public/browser/download_item.h" |
| (...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 // TODO(asanka): This logic is a hack. DownloadFilePicker should give us a | 931 // TODO(asanka): This logic is a hack. DownloadFilePicker should give us a |
| 932 // directory to persist. Or perhaps, if the Drive path | 932 // directory to persist. Or perhaps, if the Drive path |
| 933 // substitution logic is moved here, then we would have a | 933 // substitution logic is moved here, then we would have a |
| 934 // persistable path after the DownloadFilePicker is done. | 934 // persistable path after the DownloadFilePicker is done. |
| 935 if (disposition == DownloadItem::TARGET_DISPOSITION_PROMPT && | 935 if (disposition == DownloadItem::TARGET_DISPOSITION_PROMPT && |
| 936 !download->IsTemporary()) | 936 !download->IsTemporary()) |
| 937 last_download_path_ = target_path.DirName(); | 937 last_download_path_ = target_path.DirName(); |
| 938 } | 938 } |
| 939 callback.Run(target_path, disposition, danger_type, intermediate_path); | 939 callback.Run(target_path, disposition, danger_type, intermediate_path); |
| 940 } | 940 } |
| OLD | NEW |