| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 21 matching lines...) Expand all Loading... |
| 32 #include "chrome/installer/util/util_constants.h" | 32 #include "chrome/installer/util/util_constants.h" |
| 33 #include "chrome/installer/util/work_item_list.h" | 33 #include "chrome/installer/util/work_item_list.h" |
| 34 | 34 |
| 35 using base::win::RegKey; | 35 using base::win::RegKey; |
| 36 using installer::ProductState; | 36 using installer::ProductState; |
| 37 | 37 |
| 38 namespace { | 38 namespace { |
| 39 | 39 |
| 40 const wchar_t kStageBinaryPatching[] = L"binary_patching"; | 40 const wchar_t kStageBinaryPatching[] = L"binary_patching"; |
| 41 const wchar_t kStageBuilding[] = L"building"; | 41 const wchar_t kStageBuilding[] = L"building"; |
| 42 const wchar_t kStageConfiguringAutoLaunch[] = L"configuring_auto_launch"; |
| 42 const wchar_t kStageCopyingPreferencesFile[] = L"copying_prefs"; | 43 const wchar_t kStageCopyingPreferencesFile[] = L"copying_prefs"; |
| 43 const wchar_t kStageCreatingShortcuts[] = L"creating_shortcuts"; | 44 const wchar_t kStageCreatingShortcuts[] = L"creating_shortcuts"; |
| 44 const wchar_t kStageEnsemblePatching[] = L"ensemble_patching"; | 45 const wchar_t kStageEnsemblePatching[] = L"ensemble_patching"; |
| 45 const wchar_t kStageExecuting[] = L"executing"; | 46 const wchar_t kStageExecuting[] = L"executing"; |
| 46 const wchar_t kStageFinishing[] = L"finishing"; | 47 const wchar_t kStageFinishing[] = L"finishing"; |
| 47 const wchar_t kStagePreconditions[] = L"preconditions"; | 48 const wchar_t kStagePreconditions[] = L"preconditions"; |
| 48 const wchar_t kStageRefreshingPolicy[] = L"refreshing_policy"; | 49 const wchar_t kStageRefreshingPolicy[] = L"refreshing_policy"; |
| 49 const wchar_t kStageRegisteringChrome[] = L"registering_chrome"; | 50 const wchar_t kStageRegisteringChrome[] = L"registering_chrome"; |
| 50 const wchar_t kStageRemovingOldVersions[] = L"removing_old_ver"; | 51 const wchar_t kStageRemovingOldVersions[] = L"removing_old_ver"; |
| 51 const wchar_t kStageRollingback[] = L"rollingback"; | 52 const wchar_t kStageRollingback[] = L"rollingback"; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 62 kStageUnpacking, | 63 kStageUnpacking, |
| 63 kStageBuilding, | 64 kStageBuilding, |
| 64 kStageExecuting, | 65 kStageExecuting, |
| 65 kStageRollingback, | 66 kStageRollingback, |
| 66 kStageRefreshingPolicy, | 67 kStageRefreshingPolicy, |
| 67 kStageUpdatingChannels, | 68 kStageUpdatingChannels, |
| 68 kStageCopyingPreferencesFile, | 69 kStageCopyingPreferencesFile, |
| 69 kStageCreatingShortcuts, | 70 kStageCreatingShortcuts, |
| 70 kStageRegisteringChrome, | 71 kStageRegisteringChrome, |
| 71 kStageRemovingOldVersions, | 72 kStageRemovingOldVersions, |
| 72 kStageFinishing | 73 kStageFinishing, |
| 74 kStageConfiguringAutoLaunch, |
| 73 }; | 75 }; |
| 74 | 76 |
| 75 COMPILE_ASSERT(installer::NUM_STAGES == arraysize(kStages), | 77 COMPILE_ASSERT(installer::NUM_STAGES == arraysize(kStages), |
| 76 kStages_disagrees_with_Stage_comma_they_must_match_bang); | 78 kStages_disagrees_with_Stage_comma_they_must_match_bang); |
| 77 | 79 |
| 78 // Creates a zero-sized non-decorated foreground window that doesn't appear | 80 // Creates a zero-sized non-decorated foreground window that doesn't appear |
| 79 // in the taskbar. This is used as a parent window for calls to ShellExecuteEx | 81 // in the taskbar. This is used as a parent window for calls to ShellExecuteEx |
| 80 // in order for the UAC dialog to appear in the foreground and for focus | 82 // in order for the UAC dialog to appear in the foreground and for focus |
| 81 // to be returned to this process once the UAC task is dismissed. Returns | 83 // to be returned to this process once the UAC task is dismissed. Returns |
| 82 // NULL on failure, a handle to the UAC window on success. | 84 // NULL on failure, a handle to the UAC window on success. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 return state.uninstall_command(); | 168 return state.uninstall_command(); |
| 167 } | 169 } |
| 168 return CommandLine(CommandLine::NO_PROGRAM); | 170 return CommandLine(CommandLine::NO_PROGRAM); |
| 169 } | 171 } |
| 170 | 172 |
| 171 Version* InstallUtil::GetChromeVersion(BrowserDistribution* dist, | 173 Version* InstallUtil::GetChromeVersion(BrowserDistribution* dist, |
| 172 bool system_install) { | 174 bool system_install) { |
| 173 DCHECK(dist); | 175 DCHECK(dist); |
| 174 RegKey key; | 176 RegKey key; |
| 175 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; | 177 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; |
| 176 LONG result = key.Open(reg_root, dist->GetVersionKey().c_str(), KEY_READ); | 178 LONG result = key.Open(reg_root, dist->GetVersionKey().c_str(), |
| 179 KEY_QUERY_VALUE); |
| 177 | 180 |
| 178 std::wstring version_str; | 181 std::wstring version_str; |
| 179 if (result == ERROR_SUCCESS) | 182 if (result == ERROR_SUCCESS) |
| 180 result = key.ReadValue(google_update::kRegVersionField, &version_str); | 183 result = key.ReadValue(google_update::kRegVersionField, &version_str); |
| 181 | 184 |
| 182 Version* ret = NULL; | 185 Version* ret = NULL; |
| 183 if (result == ERROR_SUCCESS && !version_str.empty()) { | 186 if (result == ERROR_SUCCESS && !version_str.empty()) { |
| 184 VLOG(1) << "Existing " << dist->GetApplicationName() | 187 VLOG(1) << "Existing " << dist->GetApplicationName() |
| 185 << " version found " << version_str; | 188 << " version found " << version_str; |
| 186 ret = Version::GetVersionFromString(WideToASCII(version_str)); | 189 ret = Version::GetVersionFromString(WideToASCII(version_str)); |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 int len = GetDateFormatW(LOCALE_INVARIANT, 0, NULL, kDateFormat, | 471 int len = GetDateFormatW(LOCALE_INVARIANT, 0, NULL, kDateFormat, |
| 469 date_str, arraysize(date_str)); | 472 date_str, arraysize(date_str)); |
| 470 if (len) { | 473 if (len) { |
| 471 --len; // Subtract terminating \0. | 474 --len; // Subtract terminating \0. |
| 472 } else { | 475 } else { |
| 473 PLOG(DFATAL) << "GetDateFormat"; | 476 PLOG(DFATAL) << "GetDateFormat"; |
| 474 } | 477 } |
| 475 | 478 |
| 476 return std::wstring(date_str, len); | 479 return std::wstring(date_str, len); |
| 477 } | 480 } |
| OLD | NEW |