| 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/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1292 } extensions[] = { | 1292 } extensions[] = { |
| 1293 { FILE_PATH_LITERAL("text/html"), kDefaultHtmlExtension }, | 1293 { FILE_PATH_LITERAL("text/html"), kDefaultHtmlExtension }, |
| 1294 { FILE_PATH_LITERAL("text/xml"), FILE_PATH_LITERAL("xml") }, | 1294 { FILE_PATH_LITERAL("text/xml"), FILE_PATH_LITERAL("xml") }, |
| 1295 { FILE_PATH_LITERAL("application/xhtml+xml"), FILE_PATH_LITERAL("xhtml") }, | 1295 { FILE_PATH_LITERAL("application/xhtml+xml"), FILE_PATH_LITERAL("xhtml") }, |
| 1296 { FILE_PATH_LITERAL("text/plain"), FILE_PATH_LITERAL("txt") }, | 1296 { FILE_PATH_LITERAL("text/plain"), FILE_PATH_LITERAL("txt") }, |
| 1297 { FILE_PATH_LITERAL("text/css"), FILE_PATH_LITERAL("css") }, | 1297 { FILE_PATH_LITERAL("text/css"), FILE_PATH_LITERAL("css") }, |
| 1298 }; | 1298 }; |
| 1299 #if defined(OS_POSIX) | 1299 #if defined(OS_POSIX) |
| 1300 base::FilePath::StringType mime_type(contents_mime_type); | 1300 base::FilePath::StringType mime_type(contents_mime_type); |
| 1301 #elif defined(OS_WIN) | 1301 #elif defined(OS_WIN) |
| 1302 base::FilePath::StringType mime_type(UTF8ToWide(contents_mime_type)); | 1302 base::FilePath::StringType mime_type(base::UTF8ToWide(contents_mime_type)); |
| 1303 #endif // OS_WIN | 1303 #endif // OS_WIN |
| 1304 for (uint32 i = 0; i < ARRAYSIZE_UNSAFE(extensions); ++i) { | 1304 for (uint32 i = 0; i < ARRAYSIZE_UNSAFE(extensions); ++i) { |
| 1305 if (mime_type == extensions[i].mime_type) | 1305 if (mime_type == extensions[i].mime_type) |
| 1306 return extensions[i].suggested_extension; | 1306 return extensions[i].suggested_extension; |
| 1307 } | 1307 } |
| 1308 return FILE_PATH_LITERAL(""); | 1308 return FILE_PATH_LITERAL(""); |
| 1309 } | 1309 } |
| 1310 | 1310 |
| 1311 WebContents* SavePackage::web_contents() const { | 1311 WebContents* SavePackage::web_contents() const { |
| 1312 return WebContentsObserver::web_contents(); | 1312 return WebContentsObserver::web_contents(); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1444 | 1444 |
| 1445 void SavePackage::FinalizeDownloadEntry() { | 1445 void SavePackage::FinalizeDownloadEntry() { |
| 1446 DCHECK(download_); | 1446 DCHECK(download_); |
| 1447 DCHECK(download_manager_); | 1447 DCHECK(download_manager_); |
| 1448 | 1448 |
| 1449 download_manager_->OnSavePackageSuccessfullyFinished(download_); | 1449 download_manager_->OnSavePackageSuccessfullyFinished(download_); |
| 1450 StopObservation(); | 1450 StopObservation(); |
| 1451 } | 1451 } |
| 1452 | 1452 |
| 1453 } // namespace content | 1453 } // namespace content |
| OLD | NEW |