| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/save_package.h" | 5 #include "chrome/browser/download/save_package.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 wait_state_ = FAILED; | 553 wait_state_ = FAILED; |
| 554 | 554 |
| 555 // Inform the DownloadItem we have canceled whole save page job. | 555 // Inform the DownloadItem we have canceled whole save page job. |
| 556 download_->Cancel(false); | 556 download_->Cancel(false); |
| 557 } | 557 } |
| 558 | 558 |
| 559 void SavePackage::CheckFinish() { | 559 void SavePackage::CheckFinish() { |
| 560 if (in_process_count() || finished_) | 560 if (in_process_count() || finished_) |
| 561 return; | 561 return; |
| 562 | 562 |
| 563 FilePath dir = save_type_ == SAVE_AS_COMPLETE_HTML ? | 563 FilePath dir = (save_type_ == SAVE_AS_COMPLETE_HTML && |
| 564 saved_main_directory_path_ : | 564 saved_success_items_.size() > 1) ? |
| 565 FilePath(); | 565 saved_main_directory_path_ : FilePath(); |
| 566 | 566 |
| 567 // This vector contains the final names of all the successfully saved files | 567 // This vector contains the final names of all the successfully saved files |
| 568 // along with their save ids. It will be passed to SaveFileManager to do the | 568 // along with their save ids. It will be passed to SaveFileManager to do the |
| 569 // renaming job. | 569 // renaming job. |
| 570 FinalNameList final_names; | 570 FinalNameList final_names; |
| 571 for (SavedItemMap::iterator it = saved_success_items_.begin(); | 571 for (SavedItemMap::iterator it = saved_success_items_.begin(); |
| 572 it != saved_success_items_.end(); ++it) | 572 it != saved_success_items_.end(); ++it) |
| 573 final_names.push_back(std::make_pair(it->first, | 573 final_names.push_back(std::make_pair(it->first, |
| 574 it->second->full_path())); | 574 it->second->full_path())); |
| 575 | 575 |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 if (available_length > 0) { | 1112 if (available_length > 0) { |
| 1113 *pure_file_name = | 1113 *pure_file_name = |
| 1114 pure_file_name->substr(0, available_length); | 1114 pure_file_name->substr(0, available_length); |
| 1115 return true; | 1115 return true; |
| 1116 } | 1116 } |
| 1117 | 1117 |
| 1118 // Not enough room to even use a shortened |pure_file_name|. | 1118 // Not enough room to even use a shortened |pure_file_name|. |
| 1119 pure_file_name->clear(); | 1119 pure_file_name->clear(); |
| 1120 return false; | 1120 return false; |
| 1121 } | 1121 } |
| OLD | NEW |