| 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 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1339 | 1339 |
| 1340 void SavePackage::CreateDirectoryOnFileThread( | 1340 void SavePackage::CreateDirectoryOnFileThread( |
| 1341 const base::FilePath& website_save_dir, | 1341 const base::FilePath& website_save_dir, |
| 1342 const base::FilePath& download_save_dir, | 1342 const base::FilePath& download_save_dir, |
| 1343 bool skip_dir_check, | 1343 bool skip_dir_check, |
| 1344 const std::string& mime_type, | 1344 const std::string& mime_type, |
| 1345 const std::string& accept_langs) { | 1345 const std::string& accept_langs) { |
| 1346 base::FilePath save_dir; | 1346 base::FilePath save_dir; |
| 1347 // If the default html/websites save folder doesn't exist... | 1347 // If the default html/websites save folder doesn't exist... |
| 1348 // We skip the directory check for gdata directories on ChromeOS. | 1348 // We skip the directory check for gdata directories on ChromeOS. |
| 1349 if (!skip_dir_check && !file_util::DirectoryExists(website_save_dir)) { | 1349 if (!skip_dir_check && !base::DirectoryExists(website_save_dir)) { |
| 1350 // If the default download dir doesn't exist, create it. | 1350 // If the default download dir doesn't exist, create it. |
| 1351 if (!file_util::DirectoryExists(download_save_dir)) { | 1351 if (!base::DirectoryExists(download_save_dir)) { |
| 1352 bool res = file_util::CreateDirectory(download_save_dir); | 1352 bool res = file_util::CreateDirectory(download_save_dir); |
| 1353 DCHECK(res); | 1353 DCHECK(res); |
| 1354 } | 1354 } |
| 1355 save_dir = download_save_dir; | 1355 save_dir = download_save_dir; |
| 1356 } else { | 1356 } else { |
| 1357 // If it does exist, use the default save dir param. | 1357 // If it does exist, use the default save dir param. |
| 1358 save_dir = website_save_dir; | 1358 save_dir = website_save_dir; |
| 1359 } | 1359 } |
| 1360 | 1360 |
| 1361 bool can_save_as_complete = CanSaveAsComplete(mime_type); | 1361 bool can_save_as_complete = CanSaveAsComplete(mime_type); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1446 | 1446 |
| 1447 void SavePackage::FinalizeDownloadEntry() { | 1447 void SavePackage::FinalizeDownloadEntry() { |
| 1448 DCHECK(download_); | 1448 DCHECK(download_); |
| 1449 DCHECK(download_manager_); | 1449 DCHECK(download_manager_); |
| 1450 | 1450 |
| 1451 download_manager_->OnSavePackageSuccessfullyFinished(download_); | 1451 download_manager_->OnSavePackageSuccessfullyFinished(download_); |
| 1452 StopObservation(); | 1452 StopObservation(); |
| 1453 } | 1453 } |
| 1454 | 1454 |
| 1455 } // namespace content | 1455 } // namespace content |
| OLD | NEW |