| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/installer/util/self_cleaning_temp_dir.h" | 5 #include "chrome/installer/util/self_cleaning_temp_dir.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 bool SelfCleaningTempDir::Delete() { | 69 bool SelfCleaningTempDir::Delete() { |
| 70 if (path().empty()) { | 70 if (path().empty()) { |
| 71 LOG(DFATAL) << "Attempting to Delete an uninitialized SelfCleaningTempDir."; | 71 LOG(DFATAL) << "Attempting to Delete an uninitialized SelfCleaningTempDir."; |
| 72 return false; | 72 return false; |
| 73 } | 73 } |
| 74 | 74 |
| 75 FilePath next_dir(path().DirName()); | 75 FilePath next_dir(path().DirName()); |
| 76 bool schedule_deletes = false; | 76 bool schedule_deletes = false; |
| 77 | 77 |
| 78 // First try to recursively delete the leaf directory managed by our | 78 // First try to recursively delete the leaf directory managed by our |
| 79 // ScopedTempDir. | 79 // base::ScopedTempDir. |
| 80 if (!file_util::Delete(path(), true)) { | 80 if (!file_util::Delete(path(), true)) { |
| 81 // That failed, so schedule the temp dir and its contents for deletion after | 81 // That failed, so schedule the temp dir and its contents for deletion after |
| 82 // reboot. | 82 // reboot. |
| 83 LOG(WARNING) << "Failed to delete temporary directory " << path().value() | 83 LOG(WARNING) << "Failed to delete temporary directory " << path().value() |
| 84 << ". Scheduling for deletion at reboot."; | 84 << ". Scheduling for deletion at reboot."; |
| 85 schedule_deletes = true; | 85 schedule_deletes = true; |
| 86 if (!ScheduleDirectoryForDeletion(path().value().c_str())) | 86 if (!ScheduleDirectoryForDeletion(path().value().c_str())) |
| 87 return false; // Entirely unexpected failure (Schedule logs the reason). | 87 return false; // Entirely unexpected failure (Schedule logs the reason). |
| 88 } | 88 } |
| 89 | 89 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 108 } while (true); | 108 } while (true); |
| 109 } | 109 } |
| 110 | 110 |
| 111 base_dir_.clear(); | 111 base_dir_.clear(); |
| 112 temp_dir_.clear(); | 112 temp_dir_.clear(); |
| 113 | 113 |
| 114 return true; | 114 return true; |
| 115 } | 115 } |
| 116 | 116 |
| 117 } // namespace installer | 117 } // namespace installer |
| OLD | NEW |