diff options
-rw-r--r-- | chrome/browser/google/google_update.cc | 14 | ||||
-rw-r--r-- | chrome/installer/util/helper.cc | 13 | ||||
-rw-r--r-- | chrome/installer/util/helper.h | 8 | ||||
-rw-r--r-- | chrome/installer/util/package_properties.cc | 6 | ||||
-rw-r--r-- | chrome/installer/util/package_properties.h | 4 |
5 files changed, 36 insertions, 9 deletions
diff --git a/chrome/browser/google/google_update.cc b/chrome/browser/google/google_update.cc index 6ed8952..f12192d 100644 --- a/chrome/browser/google/google_update.cc +++ b/chrome/browser/google/google_update.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -231,7 +231,6 @@ void GoogleUpdate::CheckForUpdate(bool install_if_newer, Window* window) { bool GoogleUpdate::InitiateGoogleUpdateCheck(bool install_if_newer, Window* window, MessageLoop* main_loop) { - FilePath chrome_exe_path; if (!PathService::Get(base::DIR_EXE, &chrome_exe_path)) { NOTREACHED(); @@ -261,6 +260,8 @@ bool GoogleUpdate::InitiateGoogleUpdateCheck(bool install_if_newer, ScopedComPtr<IGoogleUpdate> on_demand; + bool system_level = false; + if (InstallUtil::IsPerUserInstall(chrome_exe.c_str())) { hr = on_demand.CreateInstance(CLSID_OnDemandUserAppsClass); } else { @@ -279,16 +280,19 @@ bool GoogleUpdate::InitiateGoogleUpdateCheck(bool install_if_newer, IID_IGoogleUpdate, foreground_hwnd, reinterpret_cast<void**>(on_demand.Receive())); } + system_level = true; } if (hr != S_OK) return ReportFailure(hr, GOOGLE_UPDATE_ONDEMAND_CLASS_NOT_FOUND, main_loop); - BrowserDistribution* dist = BrowserDistribution::GetDistribution(); + std::wstring app_guid = installer::GetAppGuidForUpdates(system_level); + DCHECK(!app_guid.empty()); + if (!install_if_newer) - hr = on_demand->CheckForUpdate(dist->GetAppGuid().c_str(), job_observer); + hr = on_demand->CheckForUpdate(app_guid.c_str(), job_observer); else - hr = on_demand->Update(dist->GetAppGuid().c_str(), job_observer); + hr = on_demand->Update(app_guid.c_str(), job_observer); if (hr != S_OK) return ReportFailure(hr, GOOGLE_UPDATE_ONDEMAND_CLASS_REPORTED_ERROR, diff --git a/chrome/installer/util/helper.cc b/chrome/installer/util/helper.cc index aa6a264..6cddf25 100644 --- a/chrome/installer/util/helper.cc +++ b/chrome/installer/util/helper.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,6 +12,7 @@ #include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/install_util.h" #include "chrome/installer/util/master_preferences.h" +#include "chrome/installer/util/package_properties.h" using base::win::RegKey; @@ -126,4 +127,14 @@ FilePath GetChromeFrameInstallPath(bool multi_install, bool system_install, return GetChromeInstallPath(system_install, chrome); } +std::wstring GetAppGuidForUpdates(bool system_install) { + BrowserDistribution* dist = BrowserDistribution::GetDistribution(); + + // If we're part of a multi-install, we need to poll using the multi-installer + // package's app guid rather than the browser's or Chrome Frame's app guid. + return IsInstalledAsMulti(system_install, dist) ? + ActivePackageProperties().GetAppGuid() : + dist->GetAppGuid(); +} + } // namespace installer. diff --git a/chrome/installer/util/helper.h b/chrome/installer/util/helper.h index e5f19ae..bcee4c6 100644 --- a/chrome/installer/util/helper.h +++ b/chrome/installer/util/helper.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -8,6 +8,8 @@ #define CHROME_INSTALLER_UTIL_HELPER_H_ #pragma once +#include <string> + class BrowserDistribution; class CommandLine; class FilePath; @@ -51,6 +53,10 @@ FilePath GetChromeUserDataPath(BrowserDistribution* dist); FilePath GetChromeFrameInstallPath(bool multi_install, bool system_install, BrowserDistribution* dist); +// Returns the app guid under which the current process receives updates from +// Google Update. +std::wstring GetAppGuidForUpdates(bool system_install); + } // namespace installer #endif // CHROME_INSTALLER_UTIL_HELPER_H_ diff --git a/chrome/installer/util/package_properties.cc b/chrome/installer/util/package_properties.cc index 2ab87cb..e33c2f9 100644 --- a/chrome/installer/util/package_properties.cc +++ b/chrome/installer/util/package_properties.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -42,6 +42,10 @@ PackagePropertiesImpl::PackagePropertiesImpl( PackagePropertiesImpl::~PackagePropertiesImpl() { } +const std::wstring& PackagePropertiesImpl::GetAppGuid() { + return guid_; +} + const std::wstring& PackagePropertiesImpl::GetStateKey() { return state_key_; } diff --git a/chrome/installer/util/package_properties.h b/chrome/installer/util/package_properties.h index a3f7714..5fd5e5f5 100644 --- a/chrome/installer/util/package_properties.h +++ b/chrome/installer/util/package_properties.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -36,6 +36,7 @@ class PackageProperties { virtual bool ReceivesUpdates() const = 0; // Equivalent to BrowserDistribution::GetAppGuid() + virtual const std::wstring& GetAppGuid() = 0; virtual const std::wstring& GetStateKey() = 0; virtual const std::wstring& GetStateMediumKey() = 0; virtual const std::wstring& GetVersionKey() = 0; @@ -54,6 +55,7 @@ class PackagePropertiesImpl : public PackageProperties { const std::wstring& version_key); virtual ~PackagePropertiesImpl(); + virtual const std::wstring& GetAppGuid(); virtual const std::wstring& GetStateKey(); virtual const std::wstring& GetStateMediumKey(); virtual const std::wstring& GetVersionKey(); |