OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/install_static/install_util.h" | 5 #include "chrome/install_static/install_util.h" |
6 | 6 |
7 #include <assert.h> | 7 #include <assert.h> |
8 #include <shlobj.h> | |
9 #include <stddef.h> | |
10 #include <memory> | |
8 #include <windows.h> | 11 #include <windows.h> |
9 #include <stddef.h> | |
10 | 12 |
13 #include "base/files/file_util.h" | |
11 #include "base/macros.h" | 14 #include "base/macros.h" |
12 #include "base/strings/string16.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/strings/pattern.h" | |
17 #include "base/strings/utf_string_conversions.h" | |
18 #include "base/win/scoped_co_mem.h" | |
19 #include "build/build_config.h" | |
20 | |
21 namespace install_static { | |
13 | 22 |
14 ProcessType g_process_type = ProcessType::UNINITIALIZED; | 23 ProcessType g_process_type = ProcessType::UNINITIALIZED; |
15 | 24 |
25 // Chrome channel display names. | |
26 // TODO(ananta) | |
27 // These constants are defined in the chrome/installer directory as well. We | |
28 // need to unify them. | |
29 const wchar_t kChromeChannelUnknown[] = L"unknown"; | |
30 const wchar_t kChromeChannelCanary[] = L"canary"; | |
31 const wchar_t kChromeChannelDev[] = L"dev"; | |
32 const wchar_t kChromeChannelBeta[] = L"beta"; | |
33 const wchar_t kChromeChannelStable[] = L""; | |
34 const wchar_t kChromeChannelStableExplicit[] = L"stable"; | |
35 | |
16 namespace { | 36 namespace { |
17 | 37 |
18 const wchar_t kRegPathClientState[] = L"Software\\Google\\Update\\ClientState"; | 38 const wchar_t kRegPathClientState[] = L"Software\\Google\\Update\\ClientState"; |
19 const wchar_t kRegPathClientStateMedium[] = | 39 const wchar_t kRegPathClientStateMedium[] = |
20 L"Software\\Google\\Update\\ClientStateMedium"; | 40 L"Software\\Google\\Update\\ClientStateMedium"; |
21 #if defined(GOOGLE_CHROME_BUILD) | 41 #if defined(GOOGLE_CHROME_BUILD) |
22 const wchar_t kRegPathChromePolicy[] = L"SOFTWARE\\Policies\\Google\\Chrome"; | 42 const wchar_t kRegPathChromePolicy[] = L"SOFTWARE\\Policies\\Google\\Chrome"; |
23 #else | 43 #else |
24 const wchar_t kRegPathChromePolicy[] = L"SOFTWARE\\Policies\\Chromium"; | 44 const wchar_t kRegPathChromePolicy[] = L"SOFTWARE\\Policies\\Chromium"; |
25 #endif // defined(GOOGLE_CHROME_BUILD) | 45 #endif // defined(GOOGLE_CHROME_BUILD) |
26 | 46 |
27 const wchar_t kRegValueUsageStats[] = L"usagestats"; | 47 const wchar_t kRegValueUsageStats[] = L"usagestats"; |
28 const wchar_t kUninstallArgumentsField[] = L"UninstallArguments"; | 48 const wchar_t kUninstallArgumentsField[] = L"UninstallArguments"; |
29 const wchar_t kMetricsReportingEnabled[] = L"MetricsReportingEnabled"; | 49 const wchar_t kMetricsReportingEnabled[] = L"MetricsReportingEnabled"; |
30 | 50 |
51 const wchar_t kRegPathGoogleUpdate[] = L"Software\\Google\\Update"; | |
52 const wchar_t kRegGoogleUpdateVersion[] = L"version"; | |
53 | |
31 const wchar_t kAppGuidCanary[] = | 54 const wchar_t kAppGuidCanary[] = |
32 L"{4ea16ac7-fd5a-47c3-875b-dbf4a2008c20}"; | 55 L"{4ea16ac7-fd5a-47c3-875b-dbf4a2008c20}"; |
33 const wchar_t kAppGuidGoogleChrome[] = | 56 const wchar_t kAppGuidGoogleChrome[] = |
34 L"{8A69D345-D564-463c-AFF1-A69D9E530F96}"; | 57 L"{8A69D345-D564-463c-AFF1-A69D9E530F96}"; |
35 const wchar_t kAppGuidGoogleBinaries[] = | 58 const wchar_t kAppGuidGoogleBinaries[] = |
36 L"{4DC8B4CA-1BDA-483e-B5FA-D3C12E15B62D}"; | 59 L"{4DC8B4CA-1BDA-483e-B5FA-D3C12E15B62D}"; |
37 | 60 |
61 // TODO(ananta) | |
62 // These constants are defined in the chrome/installer directory as well. We | |
63 // need to unify them. | |
64 const wchar_t kSxSSuffix[] = L" SxS"; | |
65 const wchar_t kGoogleChromeInstallSubDir1[] = L"Google"; | |
66 const wchar_t kGoogleChromeInstallSubDir2[] = L"Chrome"; | |
67 const wchar_t kChromiumInstallSubDir[] = L"Chromium"; | |
68 const wchar_t kUserDataDirname[] = L"User Data"; | |
69 const wchar_t kRegApField[] = L"ap"; | |
70 const wchar_t kBrowserCrashDumpMetricsSubKey[] = L"\\BrowserCrashDumpAttempts"; | |
71 | |
38 bool ReadKeyValueString(bool system_install, const wchar_t* key_path, | 72 bool ReadKeyValueString(bool system_install, const wchar_t* key_path, |
39 const wchar_t* guid, const wchar_t* value_to_read, | 73 const wchar_t* guid, const wchar_t* value_to_read, |
40 base::string16* value_out) { | 74 base::string16* value_out) { |
41 HKEY key = NULL; | 75 HKEY key = NULL; |
42 value_out->clear(); | 76 value_out->clear(); |
43 | 77 |
44 base::string16 full_key_path(key_path); | 78 base::string16 full_key_path(key_path); |
45 full_key_path.append(1, L'\\'); | 79 if (wcslen(guid) > 0) { |
46 full_key_path.append(guid); | 80 full_key_path.append(1, L'\\'); |
81 full_key_path.append(guid); | |
82 } | |
47 | 83 |
48 if (::RegOpenKeyEx(system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, | 84 if (::RegOpenKeyEx(system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, |
49 full_key_path.c_str(), 0, | 85 full_key_path.c_str(), 0, |
50 KEY_QUERY_VALUE | KEY_WOW64_32KEY, &key) != | 86 KEY_QUERY_VALUE | KEY_WOW64_32KEY, &key) != |
51 ERROR_SUCCESS) { | 87 ERROR_SUCCESS) { |
52 return false; | 88 return false; |
53 } | 89 } |
54 | 90 |
55 const size_t kMaxStringLength = 1024; | 91 const size_t kMaxStringLength = 1024; |
56 wchar_t raw_value[kMaxStringLength] = {}; | 92 wchar_t raw_value[kMaxStringLength] = {}; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 DWORD size = sizeof(*value_out); | 136 DWORD size = sizeof(*value_out); |
101 DWORD type = REG_DWORD; | 137 DWORD type = REG_DWORD; |
102 LONG result = ::RegQueryValueEx(key, value_to_read, 0, &type, | 138 LONG result = ::RegQueryValueEx(key, value_to_read, 0, &type, |
103 reinterpret_cast<BYTE*>(value_out), &size); | 139 reinterpret_cast<BYTE*>(value_out), &size); |
104 | 140 |
105 ::RegCloseKey(key); | 141 ::RegCloseKey(key); |
106 | 142 |
107 return result == ERROR_SUCCESS && size == sizeof(*value_out); | 143 return result == ERROR_SUCCESS && size == sizeof(*value_out); |
108 } | 144 } |
109 | 145 |
146 struct LanguageAndCodePage { | |
147 WORD language; | |
148 WORD code_page; | |
149 }; | |
150 | |
151 bool GetLanguageAndCodePageFromVersionResource(const char* version_resource, | |
152 WORD* language, | |
153 WORD* code_page) { | |
154 if (!version_resource) | |
155 return false; | |
156 | |
157 LanguageAndCodePage* translation_info = nullptr; | |
158 uint32_t page_count = 0; | |
159 BOOL query_result = VerQueryValue(version_resource, | |
160 L"\\VarFileInfo\\Translation", | |
161 reinterpret_cast<void**>(&translation_info), | |
162 &page_count); | |
163 if (!query_result) | |
164 return false; | |
165 | |
166 *language = translation_info->language; | |
167 *code_page = translation_info->code_page; | |
168 return true; | |
169 } | |
170 | |
171 bool GetValueFromVersionResource(const char* version_resource, | |
172 const base::string16& name, | |
173 base::string16* value_str) { | |
robertshield
2016/04/26 18:56:33
DCHECK or return on value_str == nullptr
ananta
2016/04/26 20:23:16
Added DCHECK
| |
174 WORD language = 0; | |
175 WORD code_page = 0; | |
176 if (!GetLanguageAndCodePageFromVersionResource(version_resource, | |
177 &language, | |
178 &code_page)) { | |
179 return false; | |
180 } | |
181 | |
182 WORD lang_codepage[8]; | |
robertshield
2016/04/26 18:56:33
= {}
ananta
2016/04/26 20:23:15
Done.
| |
183 size_t i = 0; | |
184 // Use the language and codepage | |
185 lang_codepage[i++] = language; | |
186 lang_codepage[i++] = code_page; | |
187 // Use the default language and codepage from the resource. | |
188 lang_codepage[i++] = ::GetUserDefaultLangID(); | |
189 lang_codepage[i++] = code_page; | |
190 // Use the language from the resource and Latin codepage (most common). | |
191 lang_codepage[i++] = language; | |
192 lang_codepage[i++] = 1252; | |
193 // Use the default language and Latin codepage (most common). | |
194 lang_codepage[i++] = ::GetUserDefaultLangID(); | |
195 lang_codepage[i++] = 1252; | |
196 | |
197 i = 0; | |
198 while (i < arraysize(lang_codepage)) { | |
199 wchar_t sub_block[MAX_PATH] = {}; | |
200 WORD language = lang_codepage[i++]; | |
201 WORD code_page = lang_codepage[i++]; | |
robertshield
2016/04/26 18:56:33
might want to COMPILE_ASSERT that arraysize(lang_c
| |
202 _snwprintf_s(sub_block, MAX_PATH, MAX_PATH, | |
203 L"\\StringFileInfo\\%04x%04x\\%ls", language, code_page, name.c_str()); | |
204 LPVOID value = NULL; | |
robertshield
2016/04/26 18:56:33
void*?
ananta
2016/04/26 20:23:15
Done.
| |
205 uint32_t size; | |
robertshield
2016/04/26 18:56:33
= 0
ananta
2016/04/26 20:23:16
Done.
| |
206 BOOL r = ::VerQueryValue(version_resource, sub_block, &value, &size); | |
207 if (r && value) { | |
208 value_str->assign(static_cast<wchar_t*>(value)); | |
209 return true; | |
210 } | |
211 } | |
212 return false; | |
213 } | |
214 | |
215 // Returns the executable path for the current process. | |
216 base::string16 GetCurrentProcessExePath() { | |
217 wchar_t exe_path[MAX_PATH] = {}; | |
218 if (GetModuleFileName(NULL, exe_path, arraysize(exe_path)) == 0) | |
219 return base::string16(); | |
220 return exe_path; | |
221 } | |
222 | |
110 } // namespace | 223 } // namespace |
111 | 224 |
112 bool IsCanary(const wchar_t* exe_path) { | 225 bool IsCanary(const wchar_t* exe_path) { |
113 return wcsstr(exe_path, L"Chrome SxS\\Application") != NULL; | 226 return wcsstr(exe_path, L"Chrome SxS\\Application") != NULL; |
114 } | 227 } |
115 | 228 |
116 bool IsSystemInstall(const wchar_t* exe_path) { | 229 bool IsSystemInstall(const wchar_t* exe_path) { |
117 wchar_t program_dir[MAX_PATH] = {}; | 230 wchar_t program_dir[MAX_PATH] = {}; |
118 DWORD ret = ::GetEnvironmentVariable(L"PROGRAMFILES", program_dir, | 231 DWORD ret = ::GetEnvironmentVariable(L"PROGRAMFILES", program_dir, |
119 arraysize(program_dir)); | 232 arraysize(program_dir)); |
(...skipping 11 matching lines...) Expand all Loading... | |
131 bool IsMultiInstall(bool is_system_install) { | 244 bool IsMultiInstall(bool is_system_install) { |
132 base::string16 args; | 245 base::string16 args; |
133 if (!ReadKeyValueString(is_system_install, kRegPathClientState, | 246 if (!ReadKeyValueString(is_system_install, kRegPathClientState, |
134 kAppGuidGoogleChrome, kUninstallArgumentsField, | 247 kAppGuidGoogleChrome, kUninstallArgumentsField, |
135 &args)) { | 248 &args)) { |
136 return false; | 249 return false; |
137 } | 250 } |
138 return args.find(L"--multi-install") != base::string16::npos; | 251 return args.find(L"--multi-install") != base::string16::npos; |
139 } | 252 } |
140 | 253 |
141 bool AreUsageStatsEnabled(const wchar_t* exe_path) { | 254 bool AreUsageStatsEnabled() { |
scottmg
2016/04/26 18:38:02
"UsageStats" sounds a bit vague, I think it'd be g
ananta
2016/04/26 20:23:16
Done.
| |
142 bool enabled = true; | 255 bool enabled = true; |
143 bool controlled_by_policy = ReportingIsEnforcedByPolicy(&enabled); | 256 bool controlled_by_policy = ReportingIsEnforcedByPolicy(&enabled); |
144 | 257 |
145 if (controlled_by_policy && !enabled) | 258 if (controlled_by_policy && !enabled) |
146 return false; | 259 return false; |
147 | 260 |
148 bool system_install = IsSystemInstall(exe_path); | 261 base::string16 exe_path = GetCurrentProcessExePath(); |
262 | |
263 bool system_install = IsSystemInstall(exe_path.c_str()); | |
149 base::string16 app_guid; | 264 base::string16 app_guid; |
150 | 265 |
151 if (IsCanary(exe_path)) { | 266 if (IsCanary(exe_path.c_str())) { |
152 app_guid = kAppGuidCanary; | 267 app_guid = kAppGuidCanary; |
153 } else { | 268 } else { |
154 app_guid = IsMultiInstall(system_install) ? kAppGuidGoogleBinaries : | 269 app_guid = IsMultiInstall(system_install) ? kAppGuidGoogleBinaries : |
155 kAppGuidGoogleChrome; | 270 kAppGuidGoogleChrome; |
156 } | 271 } |
157 | 272 |
158 DWORD out_value = 0; | 273 DWORD out_value = 0; |
159 if (system_install && | 274 if (system_install && |
160 ReadKeyValueDW(system_install, kRegPathClientStateMedium, app_guid, | 275 ReadKeyValueDW(system_install, kRegPathClientStateMedium, app_guid, |
161 kRegValueUsageStats, &out_value)) { | 276 kRegValueUsageStats, &out_value)) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
215 return; | 330 return; |
216 } | 331 } |
217 | 332 |
218 g_process_type = ProcessType::BROWSER_PROCESS; | 333 g_process_type = ProcessType::BROWSER_PROCESS; |
219 } | 334 } |
220 | 335 |
221 bool IsNonBrowserProcess() { | 336 bool IsNonBrowserProcess() { |
222 assert(g_process_type != ProcessType::UNINITIALIZED); | 337 assert(g_process_type != ProcessType::UNINITIALIZED); |
223 return g_process_type == ProcessType::NON_BROWSER_PROCESS; | 338 return g_process_type == ProcessType::NON_BROWSER_PROCESS; |
224 } | 339 } |
340 | |
341 bool GetDefaultUserDataDirectory(base::FilePath* result) { | |
342 base::win::ScopedCoMem<wchar_t> app_data_path; | |
343 | |
344 if (FAILED(SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, NULL, | |
scottmg
2016/04/26 18:38:02
Isn't shell32 going to pull in user32?
robertshield
2016/04/26 18:56:33
indeed, this *should* cause this test to fail: htt
ananta
2016/04/26 20:23:15
Yeah. My bad. Changed to use ExpandEnvironmentStri
| |
345 &app_data_path))) { | |
346 return false; | |
347 } | |
348 | |
349 base::string16 install_sub_directory = GetChromeInstallSubDirectory(); | |
350 | |
351 *result = base::FilePath(app_data_path.get()); | |
352 *result = result->Append(install_sub_directory); | |
353 *result = result->Append(kUserDataDirname); | |
robertshield
2016/04/26 18:56:33
wouldn't *result = base::FilePath(...).Append().Ap
ananta
2016/04/26 20:23:15
Done.
ananta
2016/04/26 20:23:16
Done.
| |
354 return true; | |
355 } | |
356 | |
357 bool GetDefaultCrashDumpLocation(base::FilePath* crash_dir) { | |
358 // In order to be able to start crash handling very early, we do not rely on | |
359 // chrome's PathService entries (for DIR_CRASH_DUMPS) being available on | |
360 // Windows. See https://crbug.com/564398. | |
361 if (!GetDefaultUserDataDirectory(crash_dir)) | |
362 return false; | |
363 // We have to make sure the user data dir exists on first run. See | |
364 // http://crbug.com/591504. | |
365 // TODO(ananta) | |
366 // Avoid using base file helpers here. | |
367 if (!base::PathExists(*crash_dir) && !base::CreateDirectory(*crash_dir)) | |
368 return false; | |
369 *crash_dir = crash_dir->Append(FILE_PATH_LITERAL("Crashpad")); | |
370 return true; | |
371 } | |
372 | |
373 | |
374 std::string GetEnvironmentString(const std::string& variable_name) { | |
375 DWORD value_length = ::GetEnvironmentVariable( | |
376 base::UTF8ToWide(variable_name).c_str(), NULL, 0); | |
377 if (value_length == 0) | |
378 return std::string(); | |
379 std::unique_ptr<wchar_t[]> value(new wchar_t[value_length]); | |
380 ::GetEnvironmentVariable(base::UTF8ToWide(variable_name).c_str(), | |
381 value.get(), value_length); | |
382 return base::WideToUTF8(value.get()); | |
383 } | |
384 | |
385 bool SetEnvironmentString(const std::string& variable_name, | |
386 const std::string& new_value) { | |
387 return !!SetEnvironmentVariable(base::UTF8ToWide(variable_name).c_str(), | |
388 base::UTF8ToWide(new_value).c_str()); | |
389 } | |
390 | |
391 bool HasEnvironmentVariable(const std::string& variable_name) { | |
392 return !!::GetEnvironmentVariable(base::UTF8ToWide(variable_name).c_str(), | |
393 NULL, 0); | |
394 } | |
395 | |
396 bool GetExecutableVersionDetails(const base::string16& exe_path, | |
397 base::string16* product_name, | |
398 base::string16* version, | |
399 base::string16* special_build, | |
400 base::string16* channel_name) { | |
401 DCHECK(product_name); | |
402 DCHECK(version); | |
403 DCHECK(special_build); | |
404 DCHECK(channel_name); | |
405 | |
406 // Default values in case we don't find a version resource. | |
407 *product_name = L"Chrome"; | |
408 *version = L"0.0.0.0-devel"; | |
409 | |
410 DWORD dummy = 0; | |
411 DWORD length = ::GetFileVersionInfoSize(exe_path.c_str(), &dummy); | |
412 if (length) { | |
413 scoped_ptr<char> data(new char[length]); | |
414 if (!::GetFileVersionInfo(exe_path.c_str(), dummy, length, | |
415 data.get())) { | |
416 return false; | |
scottmg
2016/04/26 18:51:30
If this returns false, then special_build and chan
ananta
2016/04/26 20:23:15
Fixed. The special_build parameter was uninitializ
| |
417 } | |
418 GetValueFromVersionResource(data.get(), L"ProductVersion", version); | |
419 base::string16 official_build; | |
420 GetValueFromVersionResource(data.get(), L"Official Build", | |
421 &official_build); | |
422 bool is_official_build = (official_build.compare(L"1") == 0); | |
scottmg
2016/04/26 18:51:30
nit; remove unnecessary () around the expression o
scottmg
2016/04/26 18:51:30
Or how about just official_build == "1"?
ananta
2016/04/26 20:23:16
Ignore this. Changed to == 1
ananta
2016/04/26 20:23:16
Done.
| |
423 if (!is_official_build) | |
424 version->append(L"-devel"); | |
425 GetValueFromVersionResource(data.get(), L"ProductShortName", product_name); | |
426 GetValueFromVersionResource(data.get(), L"SpecialBuild", special_build); | |
427 } | |
428 GetChromeChannelName(!IsSystemInstall(exe_path.c_str()), channel_name); | |
429 return true; | |
430 } | |
431 | |
432 void GetChromeChannelName(bool is_per_user_install, | |
433 base::string16* channel_name) { | |
434 #if !defined(GOOGLE_CHROME_BUILD) | |
435 *channel_name = kChromeChannelUnknown; | |
436 return; | |
437 #else | |
438 // TODO(ananta) | |
439 // Unify this with the chrome/installer/util/channel_info.h/.cc" | |
scottmg
2016/04/26 18:38:02
nit; . not " at end of line.
ananta
2016/04/26 20:23:16
Done.
| |
440 if (IsCanary(GetCurrentProcessExePath().c_str())) { | |
441 *channel_name = L"canary"; | |
442 } else { | |
443 base::string16 value; | |
444 if (ReadKeyValueString(!is_per_user_install, | |
445 kRegPathClientState, | |
446 kAppGuidGoogleChrome, | |
447 kRegApField, | |
448 &value)) { | |
449 static const wchar_t kChromeChannelBetaPattern[] = L"1.1-"; | |
450 static const wchar_t kChromeChannelBetaX64Pattern[] = L"x64-beta"; | |
451 static const wchar_t kChromeChannelDevPattern[] = L"2.0-d"; | |
452 static const wchar_t kChromeChannelDevX64Pattern[] = L"x64-dev"; | |
453 static const wchar_t kChromeStableMultiInstallPattern[] = L"*multi*"; | |
454 | |
455 // Channel names containing stable should be reported as an empty string. | |
456 if (value.find(kChromeChannelStableExplicit) != | |
457 base::string16::npos) { | |
458 return; | |
scottmg
2016/04/26 18:51:30
channel_name->erase() here at the top of the funct
ananta
2016/04/26 20:23:15
Done.
| |
459 } | |
460 | |
461 if (base::MatchPattern(value, kChromeChannelDevPattern) || | |
scottmg
2016/04/26 18:51:30
Looks like channel_info is case-insensitive too, i
scottmg
2016/04/26 18:51:30
In channel_info.cc, the 2.0-d has to be at the beg
ananta
2016/04/26 20:23:15
Its not. Thanks for finding that. Changed value to
ananta
2016/04/26 20:23:15
The FindSubstringMatch function just does a patter
| |
462 base::MatchPattern(value, kChromeChannelDevX64Pattern)) { | |
scottmg
2016/04/26 18:51:30
Do the patterns need to be "*x64-dev*", i.e. with
ananta
2016/04/26 20:23:15
Yeah. Done.
| |
463 channel_name->assign(kChromeChannelDev); | |
464 } | |
465 | |
466 if (base::MatchPattern(value, kChromeChannelBetaPattern) || | |
scottmg
2016/04/26 18:51:30
Same here as for dev above.
| |
467 base::MatchPattern(value, kChromeChannelBetaPattern)) { | |
468 channel_name->assign(kChromeChannelBeta); | |
469 } | |
470 | |
471 if (value.find(kChromeStableMultiInstallPattern) != | |
472 base::string16::npos) { | |
473 *channel_name = L"-m"; | |
474 } | |
475 *channel_name = value; | |
scottmg
2016/04/26 18:51:30
It looks like channel_info does some stuff with st
ananta
2016/04/26 20:23:16
Added a comment for investigation. At the moment w
| |
476 } else { | |
477 *channel_name = kChromeChannelUnknown; | |
478 } | |
479 } | |
480 #endif // GOOGLE_CHROME_BUILD | |
481 } | |
482 | |
483 base::Version GetGoogleUpdateVersion() { | |
484 base::string16 update_version; | |
485 if (ReadKeyValueString(IsSystemInstall(GetCurrentProcessExePath().c_str()), | |
486 kRegPathGoogleUpdate, | |
487 L"", | |
488 kRegGoogleUpdateVersion, | |
489 &update_version)) { | |
490 return base::Version(base::UTF16ToUTF8(update_version)); | |
491 } | |
492 return base::Version(); | |
493 } | |
494 | |
495 base::string16 GetChromeInstallSubDirectory() { | |
496 base::FilePath result; | |
497 #if defined(GOOGLE_CHROME_BUILD) | |
498 base::string16 sub_directory = kGoogleChromeInstallSubDir1; | |
499 sub_directory += L"\\"; | |
500 sub_directory += kGoogleChromeInstallSubDir2; | |
501 if (IsCanary(GetCurrentProcessExePath().c_str())) | |
502 sub_directory += kSxSSuffix; | |
503 result = result.Append(sub_directory); | |
504 #else | |
505 result = result.Append(kChromiumInstallSubDir); | |
506 #endif | |
507 return result.value(); | |
508 } | |
509 | |
510 base::string16 GetBrowserCrashDumpAttemptsRegistryPath() { | |
511 base::string16 registry_path = L"Software"; | |
512 base::string16 install_sub_directory = GetChromeInstallSubDirectory(); | |
513 registry_path += install_sub_directory; | |
514 registry_path += kBrowserCrashDumpMetricsSubKey; | |
515 return registry_path; | |
516 } | |
517 | |
518 | |
scottmg
2016/04/26 18:38:02
extra \n
ananta
2016/04/26 20:23:16
Done.
| |
519 } // namespace install_static | |
OLD | NEW |