OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This file defines the methods useful for uninstalling Chrome. | 5 // This file defines the methods useful for uninstalling Chrome. |
6 | 6 |
7 #include "chrome/installer/setup/uninstall.h" | 7 #include "chrome/installer/setup/uninstall.h" |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 << grandparent_dir.value(); | 135 << grandparent_dir.value(); |
136 } | 136 } |
137 } | 137 } |
138 return ret; | 138 return ret; |
139 } | 139 } |
140 | 140 |
141 // Deletes empty parent & empty grandparent dir of given path. | 141 // Deletes empty parent & empty grandparent dir of given path. |
142 bool DeleteEmptyParentDir(const FilePath& path) { | 142 bool DeleteEmptyParentDir(const FilePath& path) { |
143 bool ret = true; | 143 bool ret = true; |
144 FilePath parent_dir = path.DirName(); | 144 FilePath parent_dir = path.DirName(); |
145 if (!parent_dir.empty() && file_util::IsDirectoryEmpty(parent_dir.value())) { | 145 if (!parent_dir.empty() && file_util::IsDirectoryEmpty(parent_dir)) { |
146 if (!file_util::Delete(parent_dir, true)) { | 146 if (!file_util::Delete(parent_dir, true)) { |
147 ret = false; | 147 ret = false; |
148 LOG(ERROR) << "Failed to delete folder: " << parent_dir.value(); | 148 LOG(ERROR) << "Failed to delete folder: " << parent_dir.value(); |
149 } | 149 } |
150 | 150 |
151 parent_dir = parent_dir.DirName(); | 151 parent_dir = parent_dir.DirName(); |
152 if (!parent_dir.empty() && | 152 if (!parent_dir.empty() && file_util::IsDirectoryEmpty(parent_dir)) { |
153 file_util::IsDirectoryEmpty(parent_dir.value())) { | |
154 if (!file_util::Delete(parent_dir, true)) { | 153 if (!file_util::Delete(parent_dir, true)) { |
155 ret = false; | 154 ret = false; |
156 LOG(ERROR) << "Failed to delete folder: " << parent_dir.value(); | 155 LOG(ERROR) << "Failed to delete folder: " << parent_dir.value(); |
157 } | 156 } |
158 } | 157 } |
159 } | 158 } |
160 return ret; | 159 return ret; |
161 } | 160 } |
162 | 161 |
163 enum DeleteResult { | 162 enum DeleteResult { |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 distribution_data); | 589 distribution_data); |
591 } | 590 } |
592 | 591 |
593 // Try and delete the preserved local state once the post-install | 592 // Try and delete the preserved local state once the post-install |
594 // operations are complete. | 593 // operations are complete. |
595 if (!local_state_path.empty()) | 594 if (!local_state_path.empty()) |
596 file_util::Delete(local_state_path, false); | 595 file_util::Delete(local_state_path, false); |
597 | 596 |
598 return ret; | 597 return ret; |
599 } | 598 } |
OLD | NEW |