Commit e034a2eb authored by grt@chromium.org's avatar grt@chromium.org

Remove stale code to delete the metro user data dir. It never shipped.

This more or less reverts r149968.

BUG=none
TBR=sky@chromium.org

Review URL: https://codereview.chromium.org/218683013

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261457 0039d316-1c4b-4281-b951-d872f2087c98
parent f7deb750
......@@ -244,8 +244,6 @@ const int kHighestRendererOomScore = 1000;
#endif
#if defined(OS_WIN)
// This is used by chrome in Windows 8 metro mode.
const wchar_t kMetroChromeUserDataSubDir[] = L"Metro";
const wchar_t kMetroNavigationAndSearchMessage[] =
L"CHROME_METRO_NAV_SEARCH_REQUEST";
const wchar_t kMetroGetCurrentTabInfoMessage[] =
......
......@@ -126,8 +126,6 @@ extern const int kHighestRendererOomScore;
#endif
#if defined(OS_WIN)
// Used by Metro Chrome to create the profile under a custom subdirectory.
extern const wchar_t kMetroChromeUserDataSubDir[];
// Used by Metro Chrome to initiate navigation and search requests.
extern const wchar_t kMetroNavigationAndSearchMessage[];
// Used by Metro Chrome to get information about the current tab.
......
This diff is collapsed.
......@@ -53,10 +53,7 @@ base::string16 ProfileToKeyName(const base::string16& profile_directory) {
BrowserDistribution::GetSpecificDistribution(
BrowserDistribution::CHROME_BROWSER);
installer::Product product(distribution);
std::vector<base::FilePath> data_dir_paths;
product.GetUserDataPaths(&data_dir_paths);
if (!data_dir_paths.empty())
path = data_dir_paths[0];
path = product.GetUserDataPath();
}
path = path.Append(profile_directory);
......
......@@ -7,8 +7,6 @@
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/win/windows_version.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/install_util.h"
#include "chrome/installer/util/installation_state.h"
......@@ -43,27 +41,8 @@ base::FilePath GetChromeInstallPath(bool system_install,
return GetChromeInstallBasePath(system_install, dist, kInstallBinaryDir);
}
// TODO(gab): Cleanup this method (kMetroChromeUserDataSubDir is deprecated).
void GetChromeUserDataPaths(BrowserDistribution* dist,
std::vector<base::FilePath>* paths) {
const bool has_metro_data =
base::win::GetVersion() >= base::win::VERSION_WIN8 &&
dist->GetDefaultBrowserControlPolicy() !=
BrowserDistribution::DEFAULT_BROWSER_UNSUPPORTED;
base::FilePath data_dir(GetChromeInstallBasePath(false, dist,
kInstallUserDataDir));
if (data_dir.empty()) {
paths->clear();
} else {
paths->resize(has_metro_data ? 2 : 1);
(*paths)[0] = data_dir;
if (has_metro_data) {
(*paths)[1] = data_dir.DirName().Append(
chrome::kMetroChromeUserDataSubDir);
}
}
DCHECK(!paths->empty());
base::FilePath GetChromeUserDataPath(BrowserDistribution* dist) {
return GetChromeInstallBasePath(false, dist, kInstallUserDataDir);
}
BrowserDistribution* GetBinariesDistribution(bool system_install) {
......
......@@ -8,7 +8,6 @@
#define CHROME_INSTALLER_UTIL_HELPER_H_
#include <string>
#include <vector>
class BrowserDistribution;
......@@ -25,16 +24,12 @@ namespace installer {
// location (Document And Settings\<user>\Local Settings...)
base::FilePath GetChromeInstallPath(bool system_install, BrowserDistribution* dist);
// Returns the path(s) to the directory that holds the user data (primary and,
// if applicable to |dist|, alternate). This is always inside a user's local
// application data folder (e.g., "AppData\Local or "Local Settings\Application
// Data" in %USERPROFILE%). Note that these are the defaults and do not take
// into account that they can be overriden with a command line parameter.
// |paths| may be empty on return, but is guaranteed not to contain empty paths
// otherwise. If more than one path is returned, they are guaranteed to be
// siblings.
void GetChromeUserDataPaths(BrowserDistribution* dist,
std::vector<base::FilePath>* paths);
// Returns the path to the directory that holds the user data. This is always
// inside a user's local application data folder (e.g., "AppData\Local" or
// "Local Settings\Application Data" in %USERPROFILE%). Note that this is the
// default user data directory and does not take into account that it can be
// overriden with a command line parameter.
base::FilePath GetChromeUserDataPath(BrowserDistribution* dist);
// Returns the distribution corresponding to the current process's binaries.
// In the case of a multi-install product, this will be the CHROME_BINARIES
......
......@@ -414,12 +414,11 @@ bool InstallUtil::GetSentinelFilePath(const base::FilePath::CharType* file,
BrowserDistribution* dist,
base::FilePath* path) {
// TODO(msw): Use PathService to obtain the correct DIR_USER_DATA.
std::vector<base::FilePath> user_data_dir_paths;
installer::GetChromeUserDataPaths(dist, &user_data_dir_paths);
base::FilePath user_data_dir(installer::GetChromeUserDataPath(dist));
if (user_data_dir_paths.empty())
if (user_data_dir.empty())
return false;
*path = user_data_dir_paths[0].Append(file);
*path = user_data_dir.Append(file);
return true;
}
......
......@@ -62,8 +62,8 @@ void Product::InitializeFromUninstallCommand(
operations_->ReadOptions(uninstall_command, &options_);
}
void Product::GetUserDataPaths(std::vector<base::FilePath>* paths) const {
GetChromeUserDataPaths(distribution_, paths);
base::FilePath Product::GetUserDataPath() const {
return GetChromeUserDataPath(distribution_);
}
bool Product::LaunchChrome(const base::FilePath& application_path) const {
......
......@@ -81,15 +81,12 @@ class Product {
return options_.erase(option) != 0;
}
// Returns the path(s) to the directory that holds the user data (primary
// and, if applicable to |dist|, alternate). This is always inside a user's
// local application data folder (e.g., "AppData\Local or "Local
// Settings\Application Data" in %USERPROFILE%). Note that these are the
// defaults and do not take into account that they can be overriden with a
// command line parameter. |paths| may be empty on return, but is guaranteed
// not to contain empty paths otherwise. If more than one path is returned,
// they are guaranteed to be siblings.
void GetUserDataPaths(std::vector<base::FilePath>* paths) const;
// Returns the path to the directory that holds the user data. This is always
// inside a user's local application data folder (e.g., "AppData\Local" or
// "Local Settings\Application Data" in %USERPROFILE%). Note that this is the
// default user data directory and does not take into account that it can be
// overriden with a command line parameter.
base::FilePath GetUserDataPath() const;
// Launches Chrome without waiting for it to exit.
bool LaunchChrome(const base::FilePath& application_path) const;
......
......@@ -7,7 +7,6 @@
#include "base/logging.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/test_reg_util_win.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/installer/util/chrome_frame_distribution.h"
#include "chrome/installer/util/google_update_constants.h"
#include "chrome/installer/util/installation_state.h"
......@@ -71,19 +70,10 @@ TEST_F(ProductTest, MAYBE_ProductInstallBasic) {
BrowserDistribution* distribution = product->distribution();
EXPECT_EQ(BrowserDistribution::CHROME_BROWSER, distribution->GetType());
std::vector<base::FilePath> user_data_paths;
product->GetUserDataPaths(&user_data_paths);
EXPECT_GE(user_data_paths.size(), static_cast<size_t>(1));
const base::FilePath& user_data = user_data_paths[0];
EXPECT_FALSE(user_data_paths[0].empty());
base::FilePath user_data(product->GetUserDataPath());
EXPECT_FALSE(user_data.empty());
EXPECT_NE(std::wstring::npos,
user_data_paths[0].value().find(installer::kInstallUserDataDir));
if (user_data_paths.size() > 1) {
EXPECT_FALSE(user_data_paths[1].empty());
EXPECT_NE(
std::wstring::npos,
user_data_paths[1].value().find(chrome::kMetroChromeUserDataSubDir));
}
user_data.value().find(installer::kInstallUserDataDir));
base::FilePath program_files;
PathService::Get(base::DIR_PROGRAM_FILES, &program_files);
......
......@@ -427,21 +427,15 @@ void LaunchBrowserUserExperiment(const CommandLine& base_cmd_line,
}
// Check browser usage inactivity by the age of the last-write time of the
// most recently-used chrome user data directory.
std::vector<base::FilePath> user_data_dirs;
BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution(
BrowserDistribution::CHROME_BROWSER);
GetChromeUserDataPaths(dist, &user_data_dirs);
int dir_age_hours = -1;
for (size_t i = 0; i < user_data_dirs.size(); ++i) {
int this_age = GetDirectoryWriteAgeInHours(
user_data_dirs[i].value().c_str());
if (this_age >= 0 && (dir_age_hours < 0 || this_age < dir_age_hours))
dir_age_hours = this_age;
}
base::FilePath user_data_dir(GetChromeUserDataPath(dist));
const bool experiment_enabled = false;
const int kThirtyDays = 30 * 24;
int dir_age_hours = GetDirectoryWriteAgeInHours(
user_data_dir.value().c_str());
if (!experiment_enabled) {
VLOG(1) << "Toast experiment is disabled.";
return;
......
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