| Index: chrome/installer/setup/install_worker.cc
|
| diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc
|
| index 7164d5032219a4ce284d8ddacfc94e5e2959f836..51b23be4121d6f0712acb584c0d6a59844548022 100644
|
| --- a/chrome/installer/setup/install_worker.cc
|
| +++ b/chrome/installer/setup/install_worker.cc
|
| @@ -606,6 +606,9 @@ bool AppendPostInstallTasks(const InstallerState& installer_state,
|
| // update upgrade_utils::SwapNewChromeExeIfPresent.
|
| }
|
|
|
| + MaybeAddCopyIELowRightsPolicyWorkItems(installer_state,
|
| + in_use_update_work_items.get());
|
| +
|
| post_install_task_list->AddWorkItem(in_use_update_work_items.release());
|
| }
|
|
|
| @@ -626,6 +629,9 @@ bool AppendPostInstallTasks(const InstallerState& installer_state,
|
| google_update::kRegRenameCmdField);
|
| }
|
|
|
| + MaybeAddDeleteOldIELowRightsPolicyWorkItems(
|
| + installer_state, regular_update_work_items.get());
|
| +
|
| post_install_task_list->AddWorkItem(regular_update_work_items.release());
|
| }
|
|
|
| @@ -969,62 +975,84 @@ void AddChromeFrameWorkItems(const InstallationState& original_state,
|
| }
|
| }
|
|
|
| -void AddElevationPolicyWorkItems(const InstallationState& original_state,
|
| - const InstallerState& installer_state,
|
| - const Version& new_version,
|
| - WorkItemList* install_list) {
|
| - if (!installer_state.is_multi_install()) {
|
| - VLOG(1) << "Not adding elevation policy for single installs";
|
| - return;
|
| +namespace {
|
| +
|
| +enum ElevationPolicyId {
|
| + CURRENT_ELEVATION_POLICY,
|
| + OLD_ELEVATION_POLICY,
|
| +};
|
| +
|
| +// Although the UUID of the ChromeFrame class is used for the "current" value,
|
| +// this is done only as a convenience; there is no need for the GUID of the Low
|
| +// Rights policies to match the ChromeFrame class's GUID. Hence, it is safe to
|
| +// use this completely unrelated GUID for the "old" policies.
|
| +const wchar_t kIELowRightsPolicyOldGuid[] =
|
| + L"{6C288DD7-76FB-4721-B628-56FAC252E199}";
|
| +
|
| +const wchar_t kElevationPolicyKeyPath[] =
|
| + L"SOFTWARE\\Microsoft\\Internet Explorer\\Low Rights\\ElevationPolicy\\";
|
| +
|
| +void GetIELowRightsElevationPolicyKeyPath(ElevationPolicyId policy,
|
| + std::wstring* key_path) {
|
| + DCHECK(policy == CURRENT_ELEVATION_POLICY || policy == OLD_ELEVATION_POLICY);
|
| +
|
| + key_path->assign(kElevationPolicyKeyPath,
|
| + arraysize(kElevationPolicyKeyPath) - 1);
|
| + if (policy == CURRENT_ELEVATION_POLICY) {
|
| + wchar_t cf_clsid[64];
|
| + int len = StringFromGUID2(__uuidof(ChromeFrame), &cf_clsid[0],
|
| + arraysize(cf_clsid));
|
| + key_path->append(&cf_clsid[0], len - 1);
|
| } else {
|
| - const ProductState* cf_state =
|
| - original_state.GetProductState(installer_state.system_install(),
|
| - BrowserDistribution::CHROME_FRAME);
|
| - if (cf_state && !cf_state->is_multi_install()) {
|
| - LOG(WARNING) << "Not adding elevation policy since a single install "
|
| - "of CF exists";
|
| - return;
|
| - }
|
| + key_path->append(kIELowRightsPolicyOldGuid,
|
| + arraysize(kIELowRightsPolicyOldGuid)- 1);
|
| }
|
| +}
|
|
|
| - FilePath binary_dir(
|
| - GetChromeInstallPath(installer_state.system_install(),
|
| - BrowserDistribution::GetSpecificDistribution(
|
| - BrowserDistribution::CHROME_BINARIES)));
|
| -
|
| - struct {
|
| - const wchar_t* sub_key;
|
| - const wchar_t* executable;
|
| - const FilePath exe_dir;
|
| - } low_rights_entries[] = {
|
| - { L"ElevationPolicy\\", kChromeLauncherExe,
|
| - binary_dir.Append(ASCIIToWide(new_version.GetString())) },
|
| - { L"DragDrop\\", chrome::kBrowserProcessExecutableName, binary_dir },
|
| - };
|
| -
|
| - bool uninstall = (installer_state.operation() == InstallerState::UNINSTALL);
|
| - HKEY root = installer_state.root_key();
|
| - const wchar_t kLowRightsKeyPath[] =
|
| - L"SOFTWARE\\Microsoft\\Internet Explorer\\Low Rights\\";
|
| - std::wstring key_path(kLowRightsKeyPath);
|
| +// Returns true if this installation run owns the old IE low rights policies.
|
| +bool InstallerOwnsOldLowRightsPolicies(const InstallerState& installer_state) {
|
| + // The installer owns the old policies only when GCF is being operated on.
|
| + return installer_state.FindProduct(BrowserDistribution::CHROME_FRAME) != NULL;
|
| +}
|
|
|
| - wchar_t cf_classid[64] = {0};
|
| - StringFromGUID2(__uuidof(ChromeFrame), cf_classid, arraysize(cf_classid));
|
| +} // namespace
|
|
|
| - for (size_t i = 0; i < arraysize(low_rights_entries); ++i) {
|
| - key_path.append(low_rights_entries[i].sub_key).append(cf_classid);
|
| - if (uninstall) {
|
| - install_list->AddDeleteRegKeyWorkItem(root, key_path);
|
| - } else {
|
| - install_list->AddCreateRegKeyWorkItem(root, key_path);
|
| - install_list->AddSetRegValueWorkItem(root, key_path, L"Policy",
|
| - static_cast<DWORD>(3), true);
|
| - install_list->AddSetRegValueWorkItem(root, key_path, L"AppName",
|
| - low_rights_entries[i].executable, true);
|
| - install_list->AddSetRegValueWorkItem(root, key_path, L"AppPath",
|
| - low_rights_entries[i].exe_dir.value(), true);
|
| +void MaybeAddDeleteOldIELowRightsPolicyWorkItems(
|
| + const InstallerState& installer_state,
|
| + WorkItemList* install_list) {
|
| + DCHECK(install_list);
|
| +
|
| + if (InstallerOwnsOldLowRightsPolicies(installer_state)) {
|
| + std::wstring key_path;
|
| + GetIELowRightsElevationPolicyKeyPath(OLD_ELEVATION_POLICY, &key_path);
|
| + install_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), key_path);
|
| + }
|
| +}
|
| +
|
| +// Conditionally adds work items to copy the chrome_launcher IE low rights
|
| +// elevation policy from the primary policy GUID to the "old" policy GUID. Take
|
| +// care not to perform the copy if there is already an old policy present, as
|
| +// the ones under the main kElevationPolicyGuid would then correspond to an
|
| +// intermediate version (current_version < pv < new_version).
|
| +void MaybeAddCopyIELowRightsPolicyWorkItems(
|
| + const InstallerState& installer_state,
|
| + WorkItemList* install_list) {
|
| + DCHECK(install_list);
|
| +
|
| + // Proceed if we own the old policies and if old policies are not already
|
| + // present (we don't want to clobber them).
|
| + if (InstallerOwnsOldLowRightsPolicies(installer_state)) {
|
| + const HKEY root = installer_state.root_key();
|
| + std::wstring old_key_path;
|
| +
|
| + GetIELowRightsElevationPolicyKeyPath(OLD_ELEVATION_POLICY, &old_key_path);
|
| + if (!RegKey(root, old_key_path.c_str(), KEY_QUERY_VALUE).Valid()) {
|
| + std::wstring current_key_path;
|
| +
|
| + GetIELowRightsElevationPolicyKeyPath(CURRENT_ELEVATION_POLICY,
|
| + ¤t_key_path);
|
| + install_list->AddCopyRegKeyWorkItem(root, current_key_path, old_key_path);
|
| }
|
| - key_path.resize(arraysize(kLowRightsKeyPath) - 1);
|
| }
|
| }
|
|
|
|
|