| Index: win8/delegate_execute/chrome_util.cc
|
| diff --git a/win8/delegate_execute/chrome_util.cc b/win8/delegate_execute/chrome_util.cc
|
| index 6157dd3585049627702e340f7cafc0ae555ffe7d..1395076e239b82e8ca3568f93650c8229c3a27fc 100644
|
| --- a/win8/delegate_execute/chrome_util.cc
|
| +++ b/win8/delegate_execute/chrome_util.cc
|
| @@ -24,28 +24,22 @@
|
| #include "base/win/scoped_comptr.h"
|
| #include "base/win/scoped_handle.h"
|
| #include "base/win/win_util.h"
|
| +#include "chrome/installer/util/browser_distribution.h"
|
| +#include "chrome/installer/util/install_util.h"
|
| +#include "chrome/installer/util/util_constants.h"
|
| #include "google_update/google_update_idl.h"
|
|
|
| namespace {
|
|
|
| #if defined(GOOGLE_CHROME_BUILD)
|
| -const wchar_t kAppUserModelId[] = L"Chrome";
|
| -#else // GOOGLE_CHROME_BUILD
|
| -const wchar_t kAppUserModelId[] = L"Chromium";
|
| -#endif // GOOGLE_CHROME_BUILD
|
| -
|
| -#if defined(GOOGLE_CHROME_BUILD)
|
|
|
| // TODO(grt): These constants live in installer_util. Consider moving them
|
| // into common_constants to allow for reuse.
|
| const base::FilePath::CharType kNewChromeExe[] =
|
| FILE_PATH_LITERAL("new_chrome.exe");
|
| const wchar_t kRenameCommandValue[] = L"cmd";
|
| -const wchar_t kChromeAppGuid[] = L"{8A69D345-D564-463c-AFF1-A69D9E530F96}";
|
| -const wchar_t kRegPathChromeClient[] =
|
| - L"Software\\Google\\Update\\Clients\\"
|
| - L"{8A69D345-D564-463c-AFF1-A69D9E530F96}";
|
| -const int kExitCodeRenameSuccessful = 23;
|
| +const wchar_t kRegPathChromeClientBase[] =
|
| + L"Software\\Google\\Update\\Clients\\";
|
|
|
| // Returns the name of the global event used to detect if |chrome_exe| is in
|
| // use by a browser process.
|
| @@ -88,7 +82,10 @@ bool NewChromeExeExists(const base::FilePath& chrome_exe) {
|
|
|
| bool GetUpdateCommand(bool is_per_user, string16* update_command) {
|
| const HKEY root = is_per_user ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
|
| - base::win::RegKey key(root, kRegPathChromeClient, KEY_QUERY_VALUE);
|
| + BrowserDistribution* dist = BrowserDistribution::GetDistribution();
|
| + string16 reg_path_chrome_client = kRegPathChromeClientBase;
|
| + reg_path_chrome_client.append(dist->GetAppGuid());
|
| + base::win::RegKey key(root, reg_path_chrome_client.c_str(), KEY_QUERY_VALUE);
|
|
|
| return key.ReadValue(kRenameCommandValue, update_command) == ERROR_SUCCESS;
|
| }
|
| @@ -227,8 +224,10 @@ void UpdateChromeIfNeeded(const base::FilePath& chrome_exe) {
|
| __FUNCTION__, hr);
|
| } else {
|
| ULONG_PTR handle = 0;
|
| + BrowserDistribution* dist = BrowserDistribution::GetDistribution();
|
| hr = process_launcher->LaunchCmdElevated(
|
| - kChromeAppGuid, kRenameCommandValue, GetCurrentProcessId(), &handle);
|
| + dist->GetAppGuid().c_str(), kRenameCommandValue,
|
| + GetCurrentProcessId(), &handle);
|
| if (FAILED(hr)) {
|
| AtlTrace("%hs. Failed to launch command to finalize update; "
|
| "hr=0x%X.\n", __FUNCTION__, hr);
|
| @@ -245,7 +244,7 @@ void UpdateChromeIfNeeded(const base::FilePath& chrome_exe) {
|
| if (!base::WaitForExitCode(process_handle, &exit_code)) {
|
| AtlTrace("%hs. Failed to get result when finalizing update.\n",
|
| __FUNCTION__);
|
| - } else if (exit_code != kExitCodeRenameSuccessful) {
|
| + } else if (exit_code != installer::RENAME_SUCCESSFUL) {
|
| AtlTrace("%hs. Failed to finalize update with exit code %d.\n",
|
| __FUNCTION__, exit_code);
|
| } else {
|
| @@ -255,16 +254,4 @@ void UpdateChromeIfNeeded(const base::FilePath& chrome_exe) {
|
| #endif
|
| }
|
|
|
| -// TODO(gab): This code also lives in shell_util. Refactor for reuse.
|
| -string16 GetAppId(const base::FilePath& chrome_exe) {
|
| - string16 app_id(kAppUserModelId);
|
| - string16 suffix;
|
| - if (IsPerUserInstall(chrome_exe) &&
|
| - !GetUserSpecificRegistrySuffix(&suffix)) {
|
| - AtlTrace("%hs. GetUserSpecificRegistrySuffix failed.\n",
|
| - __FUNCTION__);
|
| - }
|
| - return app_id.append(suffix);
|
| -}
|
| -
|
| } // delegate_execute
|
|
|