Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(562)

Side by Side Diff: chrome/installer/setup/uninstall.cc

Issue 338025: Remove the Chrome Frame preprocessor define in chrome_constants.cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 file_util::AppendToPath(&setup_exe, file_util::GetFilenameFromPath(exe_path)); 169 file_util::AppendToPath(&setup_exe, file_util::GetFilenameFromPath(exe_path));
170 170
171 FilePath temp_file; 171 FilePath temp_file;
172 if (!file_util::CreateTemporaryFile(&temp_file)) { 172 if (!file_util::CreateTemporaryFile(&temp_file)) {
173 LOG(ERROR) << "Failed to create temporary file for setup.exe."; 173 LOG(ERROR) << "Failed to create temporary file for setup.exe.";
174 } else { 174 } else {
175 FilePath setup_exe_path = FilePath::FromWStringHack(setup_exe); 175 FilePath setup_exe_path = FilePath::FromWStringHack(setup_exe);
176 file_util::Move(setup_exe_path, temp_file); 176 file_util::Move(setup_exe_path, temp_file);
177 } 177 }
178 178
179 // Obtain the location of the user profile data. Chrome Frame needs to
180 // build this path manually since it doesn't use the Chrome default dir.
181 FilePath user_local_state;
182 #if defined(CHROME_FRAME_BUILD)
183 bool got_local_state =
184 chrome::GetChromeFrameUserDataDirectory(&user_local_state);
185 #else // if !defined(CHROME_FRAME_BUILD)
186 bool got_local_state = chrome::GetDefaultUserDataDirectory(&user_local_state);
187 #endif
188
179 // Move the browser's persisted local state 189 // Move the browser's persisted local state
180 FilePath user_local_state; 190 if (got_local_state) {
181 if (chrome::GetDefaultUserDataDirectory(&user_local_state)) {
182 FilePath user_local_file( 191 FilePath user_local_file(
183 user_local_state.Append(chrome::kLocalStateFilename)); 192 user_local_state.Append(chrome::kLocalStateFilename));
184
185 FilePath path = FilePath::FromWStringHack(*local_state_path); 193 FilePath path = FilePath::FromWStringHack(*local_state_path);
186 if (!file_util::CreateTemporaryFile(&path)) 194 if (!file_util::CreateTemporaryFile(&path))
187 LOG(ERROR) << "Failed to create temporary file for Local State."; 195 LOG(ERROR) << "Failed to create temporary file for Local State.";
188 else 196 else
189 file_util::CopyFile(user_local_file, path); 197 file_util::CopyFile(user_local_file, path);
198 } else {
199 LOG(ERROR) << "Could not retrieve user's profile directory.";
190 } 200 }
191 201
192 DeleteResult result = DELETE_SUCCEEDED; 202 DeleteResult result = DELETE_SUCCEEDED;
193 203
194 LOG(INFO) << "Deleting install path " << install_path; 204 LOG(INFO) << "Deleting install path " << install_path;
195 if (!file_util::Delete(install_path, true)) { 205 if (!file_util::Delete(install_path, true)) {
196 LOG(ERROR) << "Failed to delete folder (1st try): " << install_path; 206 LOG(ERROR) << "Failed to delete folder (1st try): " << install_path;
197 #if defined(CHROME_FRAME_BUILD) 207 #if defined(CHROME_FRAME_BUILD)
198 // We don't try killing Chrome processes for Chrome Frame builds since 208 // We don't try killing Chrome processes for Chrome Frame builds since
199 // that is unlikely to help. Instead, schedule files for deletion and 209 // that is unlikely to help. Instead, schedule files for deletion and
200 // return a value that will trigger a reboot prompt. 210 // return a value that will trigger a reboot prompt.
201 ScheduleDirectoryForDeletion(install_path.c_str()); 211 ScheduleDirectoryForDeletion(install_path.c_str());
202 result = DELETE_REQUIRES_REBOOT; 212 result = DELETE_REQUIRES_REBOOT;
203 #else 213 #else
204 // Try closing any running chrome processes and deleting files once again. 214 // Try closing any running chrome processes and deleting files once again.
205 CloseAllChromeProcesses(); 215 CloseAllChromeProcesses();
206 if (!file_util::Delete(install_path, true)) { 216 if (!file_util::Delete(install_path, true)) {
207 LOG(ERROR) << "Failed to delete folder (2nd try): " << install_path; 217 LOG(ERROR) << "Failed to delete folder (2nd try): " << install_path;
208 result = DELETE_FAILED; 218 result = DELETE_FAILED;
209 } 219 }
210 #endif 220 #endif
211 } 221 }
212 222
213 if (delete_profile) { 223 if (delete_profile && got_local_state) {
214 LOG(INFO) << "Deleting user profile" << user_local_state.value(); 224 LOG(INFO) << "Deleting user profile" << user_local_state.value();
215 if (!file_util::Delete(user_local_state, true)) { 225 if (!file_util::Delete(user_local_state, true)) {
216 LOG(ERROR) << "Failed to delete user profile dir: " 226 LOG(ERROR) << "Failed to delete user profile dir: "
217 << user_local_state.value(); 227 << user_local_state.value();
218 #if defined(CHROME_FRAME_BUILD) 228 #if defined(CHROME_FRAME_BUILD)
219 ScheduleDirectoryForDeletion(user_local_state.value().c_str()); 229 ScheduleDirectoryForDeletion(user_local_state.value().c_str());
220 result = DELETE_REQUIRES_REBOOT; 230 result = DELETE_REQUIRES_REBOOT;
221 #else 231 #else
222 result = DELETE_FAILED; 232 result = DELETE_FAILED;
223 #endif 233 #endif
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 dist->DoPostUninstallOperations(*installed_version, local_state_path, 524 dist->DoPostUninstallOperations(*installed_version, local_state_path,
515 distribution_data); 525 distribution_data);
516 } 526 }
517 527
518 // Try and delete the preserved local state once the post-install 528 // Try and delete the preserved local state once the post-install
519 // operations are complete. 529 // operations are complete.
520 if (!local_state_path.empty()) 530 if (!local_state_path.empty())
521 file_util::Delete(local_state_path, false); 531 file_util::Delete(local_state_path, false);
522 532
523 return ret; 533 return ret;
524 } 534 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698