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/files/file_util.h" | 12 #include "base/files/file_util.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
15 #include "base/metrics/histogram_macros.h" | 15 #include "base/metrics/histogram_macros.h" |
16 #include "base/rand_util.h" | 16 #include "base/rand_util.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "base/task_runner.h" | 18 #include "base/task_runner.h" |
19 #include "base/task_scheduler/post_task.h" | 19 #include "base/task_scheduler/post_task.h" |
20 #include "base/threading/sequenced_worker_pool.h" | 20 #include "base/threading/sequenced_worker_pool.h" |
21 #include "base/time/time.h" | 21 #include "base/time/time.h" |
22 #include "build/build_config.h" | 22 #include "build/build_config.h" |
23 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
24 #include "chrome/browser/download/download_completion_blocker.h" | 24 #include "chrome/browser/download/download_completion_blocker.h" |
| 25 #include "chrome/browser/download/download_core_service.h" |
| 26 #include "chrome/browser/download/download_core_service_factory.h" |
25 #include "chrome/browser/download/download_crx_util.h" | 27 #include "chrome/browser/download/download_crx_util.h" |
26 #include "chrome/browser/download/download_file_picker.h" | 28 #include "chrome/browser/download/download_file_picker.h" |
27 #include "chrome/browser/download/download_history.h" | 29 #include "chrome/browser/download/download_history.h" |
28 #include "chrome/browser/download/download_item_model.h" | 30 #include "chrome/browser/download/download_item_model.h" |
29 #include "chrome/browser/download/download_path_reservation_tracker.h" | 31 #include "chrome/browser/download/download_path_reservation_tracker.h" |
30 #include "chrome/browser/download/download_prefs.h" | 32 #include "chrome/browser/download/download_prefs.h" |
31 #include "chrome/browser/download/download_service.h" | |
32 #include "chrome/browser/download/download_service_factory.h" | |
33 #include "chrome/browser/download/download_stats.h" | 33 #include "chrome/browser/download/download_stats.h" |
34 #include "chrome/browser/download/download_target_determiner.h" | 34 #include "chrome/browser/download/download_target_determiner.h" |
35 #include "chrome/browser/download/save_package_file_picker.h" | 35 #include "chrome/browser/download/save_package_file_picker.h" |
36 #include "chrome/browser/platform_util.h" | 36 #include "chrome/browser/platform_util.h" |
37 #include "chrome/browser/profiles/profile.h" | 37 #include "chrome/browser/profiles/profile.h" |
38 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 38 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
39 #include "chrome/browser/ui/browser.h" | 39 #include "chrome/browser/ui/browser.h" |
40 #include "chrome/browser/ui/browser_finder.h" | 40 #include "chrome/browser/ui/browser_finder.h" |
41 #include "chrome/browser/ui/chrome_pages.h" | 41 #include "chrome/browser/ui/chrome_pages.h" |
42 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 42 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 return NULL; | 577 return NULL; |
578 } | 578 } |
579 | 579 |
580 void ChromeDownloadManagerDelegate::NotifyExtensions( | 580 void ChromeDownloadManagerDelegate::NotifyExtensions( |
581 DownloadItem* download, | 581 DownloadItem* download, |
582 const base::FilePath& virtual_path, | 582 const base::FilePath& virtual_path, |
583 const NotifyExtensionsCallback& callback) { | 583 const NotifyExtensionsCallback& callback) { |
584 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 584 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
585 #if BUILDFLAG(ENABLE_EXTENSIONS) | 585 #if BUILDFLAG(ENABLE_EXTENSIONS) |
586 extensions::ExtensionDownloadsEventRouter* router = | 586 extensions::ExtensionDownloadsEventRouter* router = |
587 DownloadServiceFactory::GetForBrowserContext(profile_) | 587 DownloadCoreServiceFactory::GetForBrowserContext(profile_) |
588 ->GetExtensionEventRouter(); | 588 ->GetExtensionEventRouter(); |
589 if (router) { | 589 if (router) { |
590 base::Closure original_path_callback = | 590 base::Closure original_path_callback = |
591 base::Bind(callback, base::FilePath(), | 591 base::Bind(callback, base::FilePath(), |
592 DownloadPathReservationTracker::UNIQUIFY); | 592 DownloadPathReservationTracker::UNIQUIFY); |
593 router->OnDeterminingFilename(download, virtual_path.BaseName(), | 593 router->OnDeterminingFilename(download, virtual_path.BaseName(), |
594 original_path_callback, | 594 original_path_callback, |
595 callback); | 595 callback); |
596 return; | 596 return; |
597 } | 597 } |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || | 863 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || |
864 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || | 864 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || |
865 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || | 865 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || |
866 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || | 866 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || |
867 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { | 867 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { |
868 return true; | 868 return true; |
869 } | 869 } |
870 #endif | 870 #endif |
871 return false; | 871 return false; |
872 } | 872 } |
OLD | NEW |