OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/download_manager.h" | 5 #include "chrome/browser/download/download_manager.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1320 // guess a reasonable file extension based on the content type. | 1320 // guess a reasonable file extension based on the content type. |
1321 // | 1321 // |
1322 // 3) Shell integration. Some file extensions automatically integrate with | 1322 // 3) Shell integration. Some file extensions automatically integrate with |
1323 // the shell. We block these extensions to prevent a malicious web site | 1323 // the shell. We block these extensions to prevent a malicious web site |
1324 // from integrating with the user's shell. | 1324 // from integrating with the user's shell. |
1325 | 1325 |
1326 static const FilePath::CharType default_extension[] = | 1326 static const FilePath::CharType default_extension[] = |
1327 FILE_PATH_LITERAL("download"); | 1327 FILE_PATH_LITERAL("download"); |
1328 | 1328 |
1329 // See if our file name already contains an extension. | 1329 // See if our file name already contains an extension. |
1330 FilePath::StringType extension( | 1330 FilePath::StringType extension = file_name.Extension(); |
1331 file_util::GetFileExtensionFromPath(file_name)); | 1331 if (!extension.empty()) |
tfarina
2010/07/08 17:33:11
The same code block is written in save_package.cc.
Evan Martin
2010/07/08 17:48:47
Yes, I think perhaps including the "." in the Exte
| |
1332 extension.erase(extension.begin()); // Erase preceding '.'. | |
Nico
2010/07/08 17:37:28
Should there be an "ExtensionWithoutDot" method on
| |
1332 | 1333 |
1333 #if defined(OS_WIN) | 1334 #if defined(OS_WIN) |
1334 // Rename shell-integrated extensions. | 1335 // Rename shell-integrated extensions. |
1335 if (win_util::IsShellIntegratedExtension(extension)) | 1336 if (win_util::IsShellIntegratedExtension(extension)) |
1336 extension.assign(default_extension); | 1337 extension.assign(default_extension); |
1337 #endif | 1338 #endif |
1338 | 1339 |
1339 std::string mime_type_from_extension; | 1340 std::string mime_type_from_extension; |
1340 net::GetMimeTypeFromFile(file_name, | 1341 net::GetMimeTypeFromFile(file_name, |
1341 &mime_type_from_extension); | 1342 &mime_type_from_extension); |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1839 observing_download_manager_->NotifyModelChanged(); | 1840 observing_download_manager_->NotifyModelChanged(); |
1840 } | 1841 } |
1841 | 1842 |
1842 void DownloadManager::OtherDownloadManagerObserver::SetDownloads( | 1843 void DownloadManager::OtherDownloadManagerObserver::SetDownloads( |
1843 std::vector<DownloadItem*>& downloads) { | 1844 std::vector<DownloadItem*>& downloads) { |
1844 } | 1845 } |
1845 | 1846 |
1846 void DownloadManager::OtherDownloadManagerObserver::ManagerGoingDown() { | 1847 void DownloadManager::OtherDownloadManagerObserver::ManagerGoingDown() { |
1847 observed_download_manager_ = NULL; | 1848 observed_download_manager_ = NULL; |
1848 } | 1849 } |
OLD | NEW |