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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 "extensions/browser/notification_types.h" | 49 #include "extensions/browser/notification_types.h" |
50 #include "net/base/filename_util.h" | 50 #include "net/base/filename_util.h" |
51 #include "net/base/mime_util.h" | 51 #include "net/base/mime_util.h" |
52 | 52 |
| 53 #if defined(OS_ANDROID) |
| 54 #include "chrome/browser/android/download_overwrite_infobar_delegate.h" |
| 55 #endif |
| 56 |
53 #if defined(OS_CHROMEOS) | 57 #if defined(OS_CHROMEOS) |
54 #include "chrome/browser/chromeos/drive/download_handler.h" | 58 #include "chrome/browser/chromeos/drive/download_handler.h" |
55 #include "chrome/browser/chromeos/drive/file_system_util.h" | 59 #include "chrome/browser/chromeos/drive/file_system_util.h" |
56 #endif | 60 #endif |
57 | 61 |
58 #if defined(ENABLE_EXTENSIONS) | 62 #if defined(ENABLE_EXTENSIONS) |
59 #include "chrome/browser/extensions/api/downloads/downloads_api.h" | 63 #include "chrome/browser/extensions/api/downloads/downloads_api.h" |
60 #include "chrome/browser/extensions/crx_installer.h" | 64 #include "chrome/browser/extensions/crx_installer.h" |
61 #include "chrome/browser/extensions/webstore_installer.h" | 65 #include "chrome/browser/extensions/webstore_installer.h" |
62 #include "extensions/common/constants.h" | 66 #include "extensions/common/constants.h" |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 create_directory, | 562 create_directory, |
559 conflict_action, | 563 conflict_action, |
560 callback); | 564 callback); |
561 } | 565 } |
562 | 566 |
563 void ChromeDownloadManagerDelegate::PromptUserForDownloadPath( | 567 void ChromeDownloadManagerDelegate::PromptUserForDownloadPath( |
564 DownloadItem* download, | 568 DownloadItem* download, |
565 const base::FilePath& suggested_path, | 569 const base::FilePath& suggested_path, |
566 const DownloadTargetDeterminerDelegate::FileSelectedCallback& callback) { | 570 const DownloadTargetDeterminerDelegate::FileSelectedCallback& callback) { |
567 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 571 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 572 #if defined(OS_ANDROID) |
| 573 chrome::android::DownloadOverwriteInfoBarDelegate::Create( |
| 574 download, suggested_path, callback); |
| 575 #else |
568 DownloadFilePicker::ShowFilePicker(download, suggested_path, callback); | 576 DownloadFilePicker::ShowFilePicker(download, suggested_path, callback); |
| 577 #endif |
569 } | 578 } |
570 | 579 |
571 void ChromeDownloadManagerDelegate::DetermineLocalPath( | 580 void ChromeDownloadManagerDelegate::DetermineLocalPath( |
572 DownloadItem* download, | 581 DownloadItem* download, |
573 const base::FilePath& virtual_path, | 582 const base::FilePath& virtual_path, |
574 const DownloadTargetDeterminerDelegate::LocalPathCallback& callback) { | 583 const DownloadTargetDeterminerDelegate::LocalPathCallback& callback) { |
575 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 584 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
576 #if defined(OS_CHROMEOS) | 585 #if defined(OS_CHROMEOS) |
577 drive::DownloadHandler* drive_download_handler = | 586 drive::DownloadHandler* drive_download_handler = |
578 drive::DownloadHandler::GetForProfile(profile_); | 587 drive::DownloadHandler::GetForProfile(profile_); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || | 742 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || |
734 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || | 743 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || |
735 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || | 744 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || |
736 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || | 745 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || |
737 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { | 746 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { |
738 return true; | 747 return true; |
739 } | 748 } |
740 #endif | 749 #endif |
741 return false; | 750 return false; |
742 } | 751 } |
OLD | NEW |