Commit 5f0bdf0b authored by Greg Thompson's avatar Greg Thompson Committed by Commit Bot

Enable User Data wipe on downgrade for all Windows installs.

BUG=607592
R=zmin@chromium.org

Change-Id: I1c1c346c39cfeed164e1a3a56513356a2a142a5e
Reviewed-on: https://chromium-review.googlesource.com/c/1337491Reviewed-by: default avatarOwen Min <zmin@chromium.org>
Commit-Queue: Greg Thompson <grt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609944}
parent 807b6f92
......@@ -805,12 +805,11 @@ void ChromeMainDelegate::PreSandboxStartup() {
if (chrome::ProcessNeedsProfileDir(process_type)) {
InitializeUserDataDir(base::CommandLine::ForCurrentProcess());
#if defined(OS_WIN) && !defined(CHROME_MULTIPLE_DLL_CHILD)
if (downgrade::IsMSIInstall()) {
downgrade::MoveUserDataForFirstRunAfterDowngrade();
base::FilePath user_data_dir;
if (base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir))
downgrade::UpdateLastVersion(user_data_dir);
}
// TODO(grt): Enable this codepath for all desktop platforms.
downgrade::MoveUserDataForFirstRunAfterDowngrade();
base::FilePath user_data_dir;
if (base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir))
downgrade::UpdateLastVersion(user_data_dir);
#endif
}
......
......@@ -9,23 +9,17 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/files/file_enumerator.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/post_task.h"
#include "base/time/time.h"
#include "base/version.h"
#include "base/win/registry.h"
#include "chrome/browser/policy/policy_path_parser.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version.h"
#include "chrome/install_static/install_util.h"
#include "chrome/installer/util/google_update_constants.h"
#include "chrome/installer/util/install_util.h"
#include "content/public/browser/browser_thread.h"
......@@ -164,16 +158,4 @@ void DeleteMovedUserDataSoon() {
base::Bind(&DeleteMovedUserData, user_data_dir, GetDiskCacheDir()));
}
bool IsMSIInstall() {
base::win::RegKey key;
DWORD is_msi = 3;
return key.Open(install_static::IsSystemInstall() ? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER,
install_static::GetClientStateKeyPath().c_str(),
KEY_QUERY_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS &&
key.ReadValueDW(google_update::kRegMSIField, &is_msi) ==
ERROR_SUCCESS &&
is_msi != 0;
}
} // namespace downgrade
......@@ -35,9 +35,6 @@ base::Version GetLastVersion(const base::FilePath& user_data_dir);
// and may be safely called when no such directories exist.
void DeleteMovedUserDataSoon();
// Returns true if Chrome is installed by MSI.
bool IsMSIInstall();
} // namespace downgrade
#endif // CHROME_BROWSER_DOWNGRADE_USER_DATA_DOWNGRADE_H_
......@@ -15,7 +15,6 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/install_static/install_util.h"
#include "chrome/installer/util/google_update_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "content/public/browser/browser_thread.h"
......@@ -79,7 +78,6 @@ class UserDataDowngradeBrowserCopyAndCleanTest
UserDataDowngradeBrowserTestBase::SetUpInProcessBrowserTestFixture();
key_.WriteValue(L"DowngradeVersion",
base::ASCIIToUTF16(GetNextChromeVersion()).c_str());
key_.WriteValue(google_update::kRegMSIField, 1);
}
// InProcessBrowserTest:
......@@ -96,21 +94,6 @@ class UserDataDowngradeBrowserCopyAndCleanTest
class UserDataDowngradeBrowserNoResetTest
: public UserDataDowngradeBrowserTestBase {
protected:
// content::BrowserTestBase:
void SetUpInProcessBrowserTestFixture() override {
UserDataDowngradeBrowserTestBase::SetUpInProcessBrowserTestFixture();
key_.WriteValue(google_update::kRegMSIField, 1);
}
};
class UserDataDowngradeBrowserNoMSITest
: public UserDataDowngradeBrowserTestBase {
protected:
// InProcessBrowserTest:
bool SetUpUserDataDirectory() override {
return CreateTemporaryFileInDir(user_data_dir_, &other_file_);
}
};
// Verify the user data directory has been renamed and created again after
......@@ -129,11 +112,4 @@ IN_PROC_BROWSER_TEST_F(UserDataDowngradeBrowserNoResetTest, Test) {
ASSERT_TRUE(base::PathExists(other_file_));
}
// Verify the "Last Version" file won't be created for non-msi install.
IN_PROC_BROWSER_TEST_F(UserDataDowngradeBrowserNoMSITest, Test) {
base::ScopedAllowBlockingForTesting allow_blocking;
ASSERT_FALSE(base::PathExists(last_version_file_path_));
ASSERT_TRUE(base::PathExists(other_file_));
}
} // namespace downgrade
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment