OLD | NEW |
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 Loading... |
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 |
OLD | NEW |