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

Side by Side Diff: chrome/installer/util/install_util.cc

Issue 10446111: Abstract suffixing logic away from GetApplicationName (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase on suffix@r142211 Created 8 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // See the corresponding header file for description of the functions in this 5 // See the corresponding header file for description of the functions in this
6 // file. 6 // file.
7 7
8 #include "chrome/installer/util/install_util.h" 8 #include "chrome/installer/util/install_util.h"
9 9
10 #include <shellapi.h> 10 #include <shellapi.h>
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; 178 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
179 LONG result = key.Open(reg_root, dist->GetVersionKey().c_str(), 179 LONG result = key.Open(reg_root, dist->GetVersionKey().c_str(),
180 KEY_QUERY_VALUE); 180 KEY_QUERY_VALUE);
181 181
182 string16 version_str; 182 string16 version_str;
183 if (result == ERROR_SUCCESS) 183 if (result == ERROR_SUCCESS)
184 result = key.ReadValue(google_update::kRegVersionField, &version_str); 184 result = key.ReadValue(google_update::kRegVersionField, &version_str);
185 185
186 Version* ret = NULL; 186 Version* ret = NULL;
187 if (result == ERROR_SUCCESS && !version_str.empty()) { 187 if (result == ERROR_SUCCESS && !version_str.empty()) {
188 VLOG(1) << "Existing " << dist->GetApplicationName() 188 VLOG(1) << "Existing " << dist->GetAppShortCutName() << " version found "
189 << " version found " << version_str; 189 << version_str;
190 ret = Version::GetVersionFromString(WideToASCII(version_str)); 190 ret = Version::GetVersionFromString(WideToASCII(version_str));
191 } else { 191 } else {
192 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); 192 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result);
193 VLOG(1) << "No existing " << dist->GetApplicationName() 193 VLOG(1) << "No existing " << dist->GetAppShortCutName()
194 << " install found."; 194 << " install found.";
195 } 195 }
196 196
197 return ret; 197 return ret;
198 } 198 }
199 199
200 Version* InstallUtil::GetCriticalUpdateVersion(BrowserDistribution* dist, 200 Version* InstallUtil::GetCriticalUpdateVersion(BrowserDistribution* dist,
201 bool system_install) { 201 bool system_install) {
202 DCHECK(dist); 202 DCHECK(dist);
203 RegKey key; 203 RegKey key;
204 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; 204 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
205 LONG result = 205 LONG result =
206 key.Open(reg_root, dist->GetVersionKey().c_str(), KEY_QUERY_VALUE); 206 key.Open(reg_root, dist->GetVersionKey().c_str(), KEY_QUERY_VALUE);
207 207
208 string16 version_str; 208 string16 version_str;
209 if (result == ERROR_SUCCESS) 209 if (result == ERROR_SUCCESS)
210 result = key.ReadValue(google_update::kRegCriticalVersionField, 210 result = key.ReadValue(google_update::kRegCriticalVersionField,
211 &version_str); 211 &version_str);
212 212
213 Version* ret = NULL; 213 Version* ret = NULL;
214 if (result == ERROR_SUCCESS && !version_str.empty()) { 214 if (result == ERROR_SUCCESS && !version_str.empty()) {
215 VLOG(1) << "Critical Update version for " << dist->GetApplicationName() 215 VLOG(1) << "Critical Update version for " << dist->GetAppShortCutName()
216 << " found " << version_str; 216 << " found " << version_str;
217 ret = Version::GetVersionFromString(WideToASCII(version_str)); 217 ret = Version::GetVersionFromString(WideToASCII(version_str));
218 } else { 218 } else {
219 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); 219 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result);
220 VLOG(1) << "No existing " << dist->GetApplicationName() 220 VLOG(1) << "No existing " << dist->GetAppShortCutName()
221 << " install found."; 221 << " install found.";
222 } 222 }
223 223
224 return ret; 224 return ret;
225 } 225 }
226 226
227 bool InstallUtil::IsOSSupported() { 227 bool InstallUtil::IsOSSupported() {
228 // We do not support Win2K or older, or XP without service pack 2. 228 // We do not support Win2K or older, or XP without service pack 2.
229 VLOG(1) << base::SysInfo::OperatingSystemName() << ' ' 229 VLOG(1) << base::SysInfo::OperatingSystemName() << ' '
230 << base::SysInfo::OperatingSystemVersion(); 230 << base::SysInfo::OperatingSystemVersion();
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 // Open the program and see if it references the expected file. 542 // Open the program and see if it references the expected file.
543 base::win::ScopedHandle handle; 543 base::win::ScopedHandle handle;
544 BY_HANDLE_FILE_INFORMATION info = {}; 544 BY_HANDLE_FILE_INFORMATION info = {};
545 545
546 return (OpenForInfo(program, &handle) && 546 return (OpenForInfo(program, &handle) &&
547 GetInfo(handle, &info) && 547 GetInfo(handle, &info) &&
548 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && 548 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber &&
549 info.nFileIndexHigh == file_info_.nFileIndexHigh && 549 info.nFileIndexHigh == file_info_.nFileIndexHigh &&
550 info.nFileIndexLow == file_info_.nFileIndexLow); 550 info.nFileIndexLow == file_info_.nFileIndexLow);
551 } 551 }
OLDNEW
« no previous file with comments | « chrome/installer/util/google_chrome_sxs_distribution.cc ('k') | chrome/installer/util/installer_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698