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

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

Issue 151101: Fixit: Remove bunch of coverity warnings from chrome/installer/*. (Closed)
Patch Set: Created 11 years, 5 months 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
« no previous file with comments | « chrome/installer/setup/install.cc ('k') | chrome/installer/util/copy_tree_work_item.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } else { 129 } else {
130 LOG(INFO) << "install destination path: " << install_path; 130 LOG(INFO) << "install destination path: " << install_path;
131 } 131 }
132 132
133 // Move setup.exe to the temp path. 133 // Move setup.exe to the temp path.
134 std::wstring setup_exe(installer::GetInstallerPathUnderChrome( 134 std::wstring setup_exe(installer::GetInstallerPathUnderChrome(
135 install_path, installed_version.GetString())); 135 install_path, installed_version.GetString()));
136 file_util::AppendToPath(&setup_exe, file_util::GetFilenameFromPath(exe_path)); 136 file_util::AppendToPath(&setup_exe, file_util::GetFilenameFromPath(exe_path));
137 137
138 std::wstring temp_file; 138 std::wstring temp_file;
139 file_util::CreateTemporaryFileName(&temp_file); 139 if (!file_util::CreateTemporaryFileName(&temp_file))
140 file_util::Move(setup_exe, temp_file); 140 LOG(ERROR) << "Failed to create temporary file for setup.exe.";
141 else
142 file_util::Move(setup_exe, temp_file);
141 143
142 // Move the browser's persisted local state 144 // Move the browser's persisted local state
143 FilePath user_local_state; 145 FilePath user_local_state;
144 if (chrome::GetDefaultUserDataDirectory(&user_local_state)) { 146 if (chrome::GetDefaultUserDataDirectory(&user_local_state)) {
145 std::wstring user_local_file( 147 std::wstring user_local_file(
146 user_local_state.Append(chrome::kLocalStateFilename).value()); 148 user_local_state.Append(chrome::kLocalStateFilename).value());
147 149
148 file_util::CreateTemporaryFileName(local_state_path); 150 if (!file_util::CreateTemporaryFileName(local_state_path))
149 file_util::CopyFile(user_local_file, *local_state_path); 151 LOG(ERROR) << "Failed to create temporary file for Local State.";
152 else
153 file_util::CopyFile(user_local_file, *local_state_path);
150 } 154 }
151 155
152 LOG(INFO) << "Deleting install path " << install_path; 156 LOG(INFO) << "Deleting install path " << install_path;
153 if (!file_util::Delete(install_path, true)) { 157 if (!file_util::Delete(install_path, true)) {
154 LOG(ERROR) << "Failed to delete folder (1st try): " << install_path; 158 LOG(ERROR) << "Failed to delete folder (1st try): " << install_path;
155 // Try closing any running chrome processes and deleting files once again. 159 // Try closing any running chrome processes and deleting files once again.
156 CloseAllChromeProcesses(); 160 CloseAllChromeProcesses();
157 if (!file_util::Delete(install_path, true)) 161 if (!file_util::Delete(install_path, true))
158 LOG(ERROR) << "Failed to delete folder (2nd try): " << install_path; 162 LOG(ERROR) << "Failed to delete folder (2nd try): " << install_path;
159 } 163 }
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 distribution_data); 416 distribution_data);
413 } 417 }
414 418
415 // Try and delete the preserved local state once the post-install 419 // Try and delete the preserved local state once the post-install
416 // operations are complete. 420 // operations are complete.
417 if (!local_state_path.empty()) 421 if (!local_state_path.empty())
418 file_util::Delete(local_state_path, false); 422 file_util::Delete(local_state_path, false);
419 423
420 return ret; 424 return ret;
421 } 425 }
OLDNEW
« no previous file with comments | « chrome/installer/setup/install.cc ('k') | chrome/installer/util/copy_tree_work_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698