| 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_overwrite_infobar_delegate.h" |
| 54 #endif |
| 55 |
| 52 #if defined(OS_CHROMEOS) | 56 #if defined(OS_CHROMEOS) |
| 53 #include "chrome/browser/chromeos/drive/download_handler.h" | 57 #include "chrome/browser/chromeos/drive/download_handler.h" |
| 54 #include "chrome/browser/chromeos/drive/file_system_util.h" | 58 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 55 #endif | 59 #endif |
| 56 | 60 |
| 57 #if defined(ENABLE_EXTENSIONS) | 61 #if defined(ENABLE_EXTENSIONS) |
| 58 #include "chrome/browser/extensions/api/downloads/downloads_api.h" | 62 #include "chrome/browser/extensions/api/downloads/downloads_api.h" |
| 59 #include "chrome/browser/extensions/crx_installer.h" | 63 #include "chrome/browser/extensions/crx_installer.h" |
| 60 #include "chrome/browser/extensions/webstore_installer.h" | 64 #include "chrome/browser/extensions/webstore_installer.h" |
| 61 #include "extensions/browser/notification_types.h" | 65 #include "extensions/browser/notification_types.h" |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 create_directory, | 570 create_directory, |
| 567 conflict_action, | 571 conflict_action, |
| 568 callback); | 572 callback); |
| 569 } | 573 } |
| 570 | 574 |
| 571 void ChromeDownloadManagerDelegate::PromptUserForDownloadPath( | 575 void ChromeDownloadManagerDelegate::PromptUserForDownloadPath( |
| 572 DownloadItem* download, | 576 DownloadItem* download, |
| 573 const base::FilePath& suggested_path, | 577 const base::FilePath& suggested_path, |
| 574 const DownloadTargetDeterminerDelegate::FileSelectedCallback& callback) { | 578 const DownloadTargetDeterminerDelegate::FileSelectedCallback& callback) { |
| 575 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 579 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 580 #if defined(OS_ANDROID) |
| 581 chrome::android::DownloadOverwriteInfoBarDelegate::Create( |
| 582 download, suggested_path, callback); |
| 583 #else |
| 576 DownloadFilePicker::ShowFilePicker(download, suggested_path, callback); | 584 DownloadFilePicker::ShowFilePicker(download, suggested_path, callback); |
| 585 #endif |
| 577 } | 586 } |
| 578 | 587 |
| 579 void ChromeDownloadManagerDelegate::DetermineLocalPath( | 588 void ChromeDownloadManagerDelegate::DetermineLocalPath( |
| 580 DownloadItem* download, | 589 DownloadItem* download, |
| 581 const base::FilePath& virtual_path, | 590 const base::FilePath& virtual_path, |
| 582 const DownloadTargetDeterminerDelegate::LocalPathCallback& callback) { | 591 const DownloadTargetDeterminerDelegate::LocalPathCallback& callback) { |
| 583 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 592 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 584 #if defined(OS_CHROMEOS) | 593 #if defined(OS_CHROMEOS) |
| 585 drive::DownloadHandler* drive_download_handler = | 594 drive::DownloadHandler* drive_download_handler = |
| 586 drive::DownloadHandler::GetForProfile(profile_); | 595 drive::DownloadHandler::GetForProfile(profile_); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || | 749 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || |
| 741 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || | 750 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || |
| 742 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || | 751 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || |
| 743 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || | 752 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || |
| 744 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { | 753 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { |
| 745 return true; | 754 return true; |
| 746 } | 755 } |
| 747 #endif | 756 #endif |
| 748 return false; | 757 return false; |
| 749 } | 758 } |
| OLD | NEW |