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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 bool ChromeDownloadManagerDelegate::ShouldCompleteDownload( | 357 bool ChromeDownloadManagerDelegate::ShouldCompleteDownload( |
358 DownloadItem* item, | 358 DownloadItem* item, |
359 const base::Closure& user_complete_callback) { | 359 const base::Closure& user_complete_callback) { |
360 return IsDownloadReadyForCompletion(item, base::Bind( | 360 return IsDownloadReadyForCompletion(item, base::Bind( |
361 &ChromeDownloadManagerDelegate::ShouldCompleteDownloadInternal, | 361 &ChromeDownloadManagerDelegate::ShouldCompleteDownloadInternal, |
362 weak_ptr_factory_.GetWeakPtr(), item->GetId(), user_complete_callback)); | 362 weak_ptr_factory_.GetWeakPtr(), item->GetId(), user_complete_callback)); |
363 } | 363 } |
364 | 364 |
365 bool ChromeDownloadManagerDelegate::ShouldOpenDownload( | 365 bool ChromeDownloadManagerDelegate::ShouldOpenDownload( |
366 DownloadItem* item, const content::DownloadOpenDelayedCallback& callback) { | 366 DownloadItem* item, const content::DownloadOpenDelayedCallback& callback) { |
367 #if defined(ENABLE_EXTENSIONS) | 367 #if defined(ENABLE_EXTENSIONS) && !defined(OS_ANDROID) |
368 if (download_crx_util::IsExtensionDownload(*item) && | 368 if (download_crx_util::IsExtensionDownload(*item) && |
369 !extensions::WebstoreInstaller::GetAssociatedApproval(*item)) { | 369 !extensions::WebstoreInstaller::GetAssociatedApproval(*item)) { |
370 scoped_refptr<extensions::CrxInstaller> crx_installer = | 370 scoped_refptr<extensions::CrxInstaller> crx_installer = |
371 download_crx_util::OpenChromeExtension(profile_, *item); | 371 download_crx_util::OpenChromeExtension(profile_, *item); |
372 | 372 |
373 // CRX_INSTALLER_DONE will fire when the install completes. At that | 373 // CRX_INSTALLER_DONE will fire when the install completes. At that |
374 // time, Observe() will call the passed callback. | 374 // time, Observe() will call the passed callback. |
375 registrar_.Add( | 375 registrar_.Add( |
376 this, | 376 this, |
377 extensions::NOTIFICATION_CRX_INSTALLER_DONE, | 377 extensions::NOTIFICATION_CRX_INSTALLER_DONE, |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 create_directory, | 572 create_directory, |
573 conflict_action, | 573 conflict_action, |
574 callback); | 574 callback); |
575 } | 575 } |
576 | 576 |
577 void ChromeDownloadManagerDelegate::PromptUserForDownloadPath( | 577 void ChromeDownloadManagerDelegate::PromptUserForDownloadPath( |
578 DownloadItem* download, | 578 DownloadItem* download, |
579 const base::FilePath& suggested_path, | 579 const base::FilePath& suggested_path, |
580 const DownloadTargetDeterminerDelegate::FileSelectedCallback& callback) { | 580 const DownloadTargetDeterminerDelegate::FileSelectedCallback& callback) { |
581 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 581 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
582 #if defined(OS_ANDROID) | 582 #if defined(OS_ANDROID) && !defined(USE_AURA) |
583 chrome::android::ChromeDownloadManagerOverwriteInfoBarDelegate::Create( | 583 chrome::android::ChromeDownloadManagerOverwriteInfoBarDelegate::Create( |
584 InfoBarService::FromWebContents(download->GetWebContents()), | 584 InfoBarService::FromWebContents(download->GetWebContents()), |
585 suggested_path, callback); | 585 suggested_path, callback); |
586 #else | 586 #else |
587 DownloadFilePicker::ShowFilePicker(download, suggested_path, callback); | 587 DownloadFilePicker::ShowFilePicker(download, suggested_path, callback); |
588 #endif | 588 #endif |
589 } | 589 } |
590 | 590 |
591 void ChromeDownloadManagerDelegate::DetermineLocalPath( | 591 void ChromeDownloadManagerDelegate::DetermineLocalPath( |
592 DownloadItem* download, | 592 DownloadItem* download, |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || | 752 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || |
753 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || | 753 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || |
754 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || | 754 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || |
755 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || | 755 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || |
756 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { | 756 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { |
757 return true; | 757 return true; |
758 } | 758 } |
759 #endif | 759 #endif |
760 return false; | 760 return false; |
761 } | 761 } |
OLD | NEW |