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 #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 content::WebContents* web_contents = download->GetWebContents(); | |
583 if (!web_contents) | |
Peter Kasting
2015/02/18 21:32:29
When can this conditional be true? Please add com
Changwan Ryu
2015/02/19 07:41:15
Removed
| |
584 return; | |
585 | |
586 InfoBarService* infobar_service = | |
587 InfoBarService::FromWebContents(web_contents); | |
Peter Kasting
2015/02/18 21:32:29
Nit: Just inline this into the call below.
Changwan Ryu
2015/02/19 07:41:15
Done.
| |
588 | |
589 chrome::android::DownloadOverwriteInfoBarDelegate::Create( | |
590 infobar_service, suggested_path, callback); | |
591 #else | |
576 DownloadFilePicker::ShowFilePicker(download, suggested_path, callback); | 592 DownloadFilePicker::ShowFilePicker(download, suggested_path, callback); |
593 #endif | |
577 } | 594 } |
578 | 595 |
579 void ChromeDownloadManagerDelegate::DetermineLocalPath( | 596 void ChromeDownloadManagerDelegate::DetermineLocalPath( |
580 DownloadItem* download, | 597 DownloadItem* download, |
581 const base::FilePath& virtual_path, | 598 const base::FilePath& virtual_path, |
582 const DownloadTargetDeterminerDelegate::LocalPathCallback& callback) { | 599 const DownloadTargetDeterminerDelegate::LocalPathCallback& callback) { |
583 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 600 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
584 #if defined(OS_CHROMEOS) | 601 #if defined(OS_CHROMEOS) |
585 drive::DownloadHandler* drive_download_handler = | 602 drive::DownloadHandler* drive_download_handler = |
586 drive::DownloadHandler::GetForProfile(profile_); | 603 drive::DownloadHandler::GetForProfile(profile_); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
740 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || | 757 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || |
741 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || | 758 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || |
742 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || | 759 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || |
743 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || | 760 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || |
744 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { | 761 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { |
745 return true; | 762 return true; |
746 } | 763 } |
747 #endif | 764 #endif |
748 return false; | 765 return false; |
749 } | 766 } |
OLD | NEW |