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/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "chrome/common/chrome_constants.h" | 42 #include "chrome/common/chrome_constants.h" |
43 #include "chrome/common/pref_names.h" | 43 #include "chrome/common/pref_names.h" |
44 #include "components/pref_registry/pref_registry_syncable.h" | 44 #include "components/pref_registry/pref_registry_syncable.h" |
45 #include "content/public/browser/download_item.h" | 45 #include "content/public/browser/download_item.h" |
46 #include "content/public/browser/download_manager.h" | 46 #include "content/public/browser/download_manager.h" |
47 #include "content/public/browser/notification_source.h" | 47 #include "content/public/browser/notification_source.h" |
48 #include "content/public/browser/page_navigator.h" | 48 #include "content/public/browser/page_navigator.h" |
49 #include "net/base/filename_util.h" | 49 #include "net/base/filename_util.h" |
50 #include "net/base/mime_util.h" | 50 #include "net/base/mime_util.h" |
51 | 51 |
| 52 #if defined(OS_ANDROID) |
| 53 #include "chrome/browser/android/download/chrome_download_manager_overwrite_info
bar_delegate.h" |
| 54 #include "chrome/browser/infobars/infobar_service.h" |
| 55 #endif |
| 56 |
52 #if defined(OS_CHROMEOS) | 57 #if defined(OS_CHROMEOS) |
53 #include "chrome/browser/chromeos/drive/download_handler.h" | 58 #include "chrome/browser/chromeos/drive/download_handler.h" |
54 #include "chrome/browser/chromeos/drive/file_system_util.h" | 59 #include "chrome/browser/chromeos/drive/file_system_util.h" |
55 #endif | 60 #endif |
56 | 61 |
57 #if defined(ENABLE_EXTENSIONS) | 62 #if defined(ENABLE_EXTENSIONS) |
58 #include "chrome/browser/extensions/api/downloads/downloads_api.h" | 63 #include "chrome/browser/extensions/api/downloads/downloads_api.h" |
59 #include "chrome/browser/extensions/crx_installer.h" | 64 #include "chrome/browser/extensions/crx_installer.h" |
60 #include "chrome/browser/extensions/webstore_installer.h" | 65 #include "chrome/browser/extensions/webstore_installer.h" |
61 #include "extensions/browser/notification_types.h" | 66 #include "extensions/browser/notification_types.h" |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 create_directory, | 571 create_directory, |
567 conflict_action, | 572 conflict_action, |
568 callback); | 573 callback); |
569 } | 574 } |
570 | 575 |
571 void ChromeDownloadManagerDelegate::PromptUserForDownloadPath( | 576 void ChromeDownloadManagerDelegate::PromptUserForDownloadPath( |
572 DownloadItem* download, | 577 DownloadItem* download, |
573 const base::FilePath& suggested_path, | 578 const base::FilePath& suggested_path, |
574 const DownloadTargetDeterminerDelegate::FileSelectedCallback& callback) { | 579 const DownloadTargetDeterminerDelegate::FileSelectedCallback& callback) { |
575 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 580 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 581 #if defined(OS_ANDROID) |
| 582 chrome::android::ChromeDownloadManagerOverwriteInfoBarDelegate::Create( |
| 583 InfoBarService::FromWebContents(download->GetWebContents()), |
| 584 suggested_path, callback); |
| 585 #else |
576 DownloadFilePicker::ShowFilePicker(download, suggested_path, callback); | 586 DownloadFilePicker::ShowFilePicker(download, suggested_path, callback); |
| 587 #endif |
577 } | 588 } |
578 | 589 |
579 void ChromeDownloadManagerDelegate::DetermineLocalPath( | 590 void ChromeDownloadManagerDelegate::DetermineLocalPath( |
580 DownloadItem* download, | 591 DownloadItem* download, |
581 const base::FilePath& virtual_path, | 592 const base::FilePath& virtual_path, |
582 const DownloadTargetDeterminerDelegate::LocalPathCallback& callback) { | 593 const DownloadTargetDeterminerDelegate::LocalPathCallback& callback) { |
583 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 594 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
584 #if defined(OS_CHROMEOS) | 595 #if defined(OS_CHROMEOS) |
585 drive::DownloadHandler* drive_download_handler = | 596 drive::DownloadHandler* drive_download_handler = |
586 drive::DownloadHandler::GetForProfile(profile_); | 597 drive::DownloadHandler::GetForProfile(profile_); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || | 751 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || |
741 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || | 752 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || |
742 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || | 753 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || |
743 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || | 754 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || |
744 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { | 755 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { |
745 return true; | 756 return true; |
746 } | 757 } |
747 #endif | 758 #endif |
748 return false; | 759 return false; |
749 } | 760 } |
OLD | NEW |