| 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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 can_save_as_complete, | 426 can_save_as_complete, |
| 427 download_prefs_.get(), | 427 download_prefs_.get(), |
| 428 callback); | 428 callback); |
| 429 } | 429 } |
| 430 | 430 |
| 431 void ChromeDownloadManagerDelegate::OpenDownloadUsingPlatformHandler( | 431 void ChromeDownloadManagerDelegate::OpenDownloadUsingPlatformHandler( |
| 432 DownloadItem* download) { | 432 DownloadItem* download) { |
| 433 base::FilePath platform_path( | 433 base::FilePath platform_path( |
| 434 GetPlatformDownloadPath(profile_, download, PLATFORM_TARGET_PATH)); | 434 GetPlatformDownloadPath(profile_, download, PLATFORM_TARGET_PATH)); |
| 435 DCHECK(!platform_path.empty()); | 435 DCHECK(!platform_path.empty()); |
| 436 platform_util::OpenItem(profile_, platform_path); | 436 platform_util::OpenItem(profile_, platform_path, platform_util::OPEN_FILE, |
| 437 platform_util::OpenOperationCallback()); |
| 437 } | 438 } |
| 438 | 439 |
| 439 void ChromeDownloadManagerDelegate::OpenDownload(DownloadItem* download) { | 440 void ChromeDownloadManagerDelegate::OpenDownload(DownloadItem* download) { |
| 440 DCHECK_EQ(DownloadItem::COMPLETE, download->GetState()); | 441 DCHECK_EQ(DownloadItem::COMPLETE, download->GetState()); |
| 441 DCHECK(!download->GetTargetFilePath().empty()); | 442 DCHECK(!download->GetTargetFilePath().empty()); |
| 442 if (!download->CanOpenDownload()) | 443 if (!download->CanOpenDownload()) |
| 443 return; | 444 return; |
| 444 | 445 |
| 445 if (!DownloadItemModel(download).ShouldPreferOpeningInBrowser()) { | 446 if (!DownloadItemModel(download).ShouldPreferOpeningInBrowser()) { |
| 446 RecordDownloadOpenMethod(DOWNLOAD_OPEN_METHOD_DEFAULT_PLATFORM); | 447 RecordDownloadOpenMethod(DOWNLOAD_OPEN_METHOD_DEFAULT_PLATFORM); |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || | 752 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || |
| 752 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || | 753 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || |
| 753 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || | 754 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || |
| 754 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || | 755 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || |
| 755 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { | 756 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { |
| 756 return true; | 757 return true; |
| 757 } | 758 } |
| 758 #endif | 759 #endif |
| 759 return false; | 760 return false; |
| 760 } | 761 } |
| OLD | NEW |