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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 if (path().empty()) { | 71 if (path().empty()) { |
72 LOG(DFATAL) << "Attempting to Delete an uninitialized SelfCleaningTempDir."; | 72 LOG(DFATAL) << "Attempting to Delete an uninitialized SelfCleaningTempDir."; |
73 return false; | 73 return false; |
74 } | 74 } |
75 | 75 |
76 base::FilePath next_dir(path().DirName()); | 76 base::FilePath next_dir(path().DirName()); |
77 bool schedule_deletes = false; | 77 bool schedule_deletes = false; |
78 | 78 |
79 // First try to recursively delete the leaf directory managed by our | 79 // First try to recursively delete the leaf directory managed by our |
80 // base::ScopedTempDir. | 80 // base::ScopedTempDir. |
81 if (!base::Delete(path(), true)) { | 81 if (!base::DeleteFile(path(), true)) { |
82 // That failed, so schedule the temp dir and its contents for deletion after | 82 // That failed, so schedule the temp dir and its contents for deletion after |
83 // reboot. | 83 // reboot. |
84 LOG(WARNING) << "Failed to delete temporary directory " << path().value() | 84 LOG(WARNING) << "Failed to delete temporary directory " << path().value() |
85 << ". Scheduling for deletion at reboot."; | 85 << ". Scheduling for deletion at reboot."; |
86 schedule_deletes = true; | 86 schedule_deletes = true; |
87 if (!ScheduleDirectoryForDeletion(path().value().c_str())) | 87 if (!ScheduleDirectoryForDeletion(path().value().c_str())) |
88 return false; // Entirely unexpected failure (Schedule logs the reason). | 88 return false; // Entirely unexpected failure (Schedule logs the reason). |
89 } | 89 } |
90 | 90 |
91 // Now delete or schedule all empty directories up to and including our | 91 // Now delete or schedule all empty directories up to and including our |
(...skipping 17 matching lines...) Expand all Loading... |
109 } while (true); | 109 } while (true); |
110 } | 110 } |
111 | 111 |
112 base_dir_.clear(); | 112 base_dir_.clear(); |
113 temp_dir_.clear(); | 113 temp_dir_.clear(); |
114 | 114 |
115 return true; | 115 return true; |
116 } | 116 } |
117 | 117 |
118 } // namespace installer | 118 } // namespace installer |
OLD | NEW |