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 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1340 const base::FilePath& download_save_dir, | 1340 const base::FilePath& download_save_dir, |
1341 bool skip_dir_check, | 1341 bool skip_dir_check, |
1342 const std::string& mime_type, | 1342 const std::string& mime_type, |
1343 const std::string& accept_langs) { | 1343 const std::string& accept_langs) { |
1344 base::FilePath save_dir; | 1344 base::FilePath save_dir; |
1345 // If the default html/websites save folder doesn't exist... | 1345 // If the default html/websites save folder doesn't exist... |
1346 // We skip the directory check for gdata directories on ChromeOS. | 1346 // We skip the directory check for gdata directories on ChromeOS. |
1347 if (!skip_dir_check && !base::DirectoryExists(website_save_dir)) { | 1347 if (!skip_dir_check && !base::DirectoryExists(website_save_dir)) { |
1348 // If the default download dir doesn't exist, create it. | 1348 // If the default download dir doesn't exist, create it. |
1349 if (!base::DirectoryExists(download_save_dir)) { | 1349 if (!base::DirectoryExists(download_save_dir)) { |
1350 bool res = file_util::CreateDirectory(download_save_dir); | 1350 bool res = base::CreateDirectory(download_save_dir); |
1351 DCHECK(res); | 1351 DCHECK(res); |
1352 } | 1352 } |
1353 save_dir = download_save_dir; | 1353 save_dir = download_save_dir; |
1354 } else { | 1354 } else { |
1355 // If it does exist, use the default save dir param. | 1355 // If it does exist, use the default save dir param. |
1356 save_dir = website_save_dir; | 1356 save_dir = website_save_dir; |
1357 } | 1357 } |
1358 | 1358 |
1359 bool can_save_as_complete = CanSaveAsComplete(mime_type); | 1359 bool can_save_as_complete = CanSaveAsComplete(mime_type); |
1360 base::FilePath suggested_filename = GetSuggestedNameForSaveAs( | 1360 base::FilePath suggested_filename = GetSuggestedNameForSaveAs( |
(...skipping 83 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 |