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 "content/browser/download/save_package.h" | 5 #include "content/browser/download/save_package.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1290 { FILE_PATH_LITERAL("text/xml"), FILE_PATH_LITERAL("xml") }, | 1290 { FILE_PATH_LITERAL("text/xml"), FILE_PATH_LITERAL("xml") }, |
1291 { FILE_PATH_LITERAL("application/xhtml+xml"), FILE_PATH_LITERAL("xhtml") }, | 1291 { FILE_PATH_LITERAL("application/xhtml+xml"), FILE_PATH_LITERAL("xhtml") }, |
1292 { FILE_PATH_LITERAL("text/plain"), FILE_PATH_LITERAL("txt") }, | 1292 { FILE_PATH_LITERAL("text/plain"), FILE_PATH_LITERAL("txt") }, |
1293 { FILE_PATH_LITERAL("text/css"), FILE_PATH_LITERAL("css") }, | 1293 { FILE_PATH_LITERAL("text/css"), FILE_PATH_LITERAL("css") }, |
1294 }; | 1294 }; |
1295 #if defined(OS_POSIX) | 1295 #if defined(OS_POSIX) |
1296 base::FilePath::StringType mime_type(contents_mime_type); | 1296 base::FilePath::StringType mime_type(contents_mime_type); |
1297 #elif defined(OS_WIN) | 1297 #elif defined(OS_WIN) |
1298 base::FilePath::StringType mime_type(base::UTF8ToWide(contents_mime_type)); | 1298 base::FilePath::StringType mime_type(base::UTF8ToWide(contents_mime_type)); |
1299 #endif // OS_WIN | 1299 #endif // OS_WIN |
1300 for (uint32 i = 0; i < ARRAYSIZE_UNSAFE(extensions); ++i) { | 1300 for (uint32 i = 0; i < arraysize(extensions); ++i) { |
1301 if (mime_type == extensions[i].mime_type) | 1301 if (mime_type == extensions[i].mime_type) |
1302 return extensions[i].suggested_extension; | 1302 return extensions[i].suggested_extension; |
1303 } | 1303 } |
1304 return FILE_PATH_LITERAL(""); | 1304 return FILE_PATH_LITERAL(""); |
1305 } | 1305 } |
1306 | 1306 |
1307 void SavePackage::GetSaveInfo() { | 1307 void SavePackage::GetSaveInfo() { |
1308 // Can't use web_contents_ in the file thread, so get the data that we need | 1308 // Can't use web_contents_ in the file thread, so get the data that we need |
1309 // before calling to it. | 1309 // before calling to it. |
1310 base::FilePath website_save_dir, download_save_dir; | 1310 base::FilePath website_save_dir, download_save_dir; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1436 | 1436 |
1437 void SavePackage::FinalizeDownloadEntry() { | 1437 void SavePackage::FinalizeDownloadEntry() { |
1438 DCHECK(download_); | 1438 DCHECK(download_); |
1439 DCHECK(download_manager_); | 1439 DCHECK(download_manager_); |
1440 | 1440 |
1441 download_manager_->OnSavePackageSuccessfullyFinished(download_); | 1441 download_manager_->OnSavePackageSuccessfullyFinished(download_); |
1442 StopObservation(); | 1442 StopObservation(); |
1443 } | 1443 } |
1444 | 1444 |
1445 } // namespace content | 1445 } // namespace content |
OLD | NEW |