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

Side by Side Diff: cloud_print/common/win/install_utils.cc

Issue 18383003: Move DeleteAfterReboot and Move to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "cloud_print/common/win/install_utils.h" 5 #include "cloud_print/common/win/install_utils.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 base::FilePath installer_source; 168 base::FilePath installer_source;
169 if (!PathService::Get(base::FILE_EXE, &installer_source)) 169 if (!PathService::Get(base::FILE_EXE, &installer_source))
170 return; 170 return;
171 // Deletes only subdirs of program files. 171 // Deletes only subdirs of program files.
172 if (!IsProgramsFilesParent(installer_source)) 172 if (!IsProgramsFilesParent(installer_source))
173 return; 173 return;
174 base::FilePath temp_path; 174 base::FilePath temp_path;
175 if (!file_util::CreateTemporaryFile(&temp_path)) 175 if (!file_util::CreateTemporaryFile(&temp_path))
176 return; 176 return;
177 file_util::CopyFile(installer_source, temp_path); 177 file_util::CopyFile(installer_source, temp_path);
178 file_util::DeleteAfterReboot(temp_path); 178 base::DeleteAfterReboot(temp_path);
179 CommandLine command_line(temp_path); 179 CommandLine command_line(temp_path);
180 command_line.AppendSwitchPath(delete_switch, installer_source.DirName()); 180 command_line.AppendSwitchPath(delete_switch, installer_source.DirName());
181 base::LaunchOptions options; 181 base::LaunchOptions options;
182 base::ProcessHandle process_handle; 182 base::ProcessHandle process_handle;
183 if (!base::LaunchProcess(command_line, options, &process_handle)) { 183 if (!base::LaunchProcess(command_line, options, &process_handle)) {
184 LOG(ERROR) << "Unable to launch child uninstall."; 184 LOG(ERROR) << "Unable to launch child uninstall.";
185 } 185 }
186 } 186 }
187 187
188 bool IsProgramsFilesParent(const base::FilePath& path) { 188 bool IsProgramsFilesParent(const base::FilePath& path) {
189 base::FilePath program_files; 189 base::FilePath program_files;
190 if (!PathService::Get(base::DIR_PROGRAM_FILESX86, &program_files)) 190 if (!PathService::Get(base::DIR_PROGRAM_FILESX86, &program_files))
191 return false; 191 return false;
192 return program_files.IsParent(path); 192 return program_files.IsParent(path);
193 } 193 }
194 194
195 } // namespace cloud_print 195 } // namespace cloud_print
196 196
OLDNEW
« no previous file with comments | « chrome_frame/test/reliability/page_load_test.cc ('k') | content/browser/download/base_file_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698