This source file includes following definitions.
- GetChromeInstallBasePath
- GetChromeInstallPath
- GetChromeUserDataPath
- GetBinariesDistribution
- GetAppGuidForUpdates
#include "chrome/installer/util/helper.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/install_util.h"
#include "chrome/installer/util/installation_state.h"
#include "chrome/installer/util/util_constants.h"
namespace {
base::FilePath GetChromeInstallBasePath(bool system,
BrowserDistribution* distribution,
const wchar_t* sub_path) {
base::FilePath install_path;
if (system) {
PathService::Get(base::DIR_PROGRAM_FILES, &install_path);
} else {
PathService::Get(base::DIR_LOCAL_APP_DATA, &install_path);
}
if (!install_path.empty()) {
install_path = install_path.Append(distribution->GetInstallSubDir());
install_path = install_path.Append(sub_path);
}
return install_path;
}
}
namespace installer {
base::FilePath GetChromeInstallPath(bool system_install,
BrowserDistribution* dist) {
return GetChromeInstallBasePath(system_install, dist, kInstallBinaryDir);
}
base::FilePath GetChromeUserDataPath(BrowserDistribution* dist) {
return GetChromeInstallBasePath(false, dist, kInstallUserDataDir);
}
BrowserDistribution* GetBinariesDistribution(bool system_install) {
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
ProductState state;
if (state.Initialize(system_install, dist) && state.is_multi_install()) {
return BrowserDistribution::GetSpecificDistribution(
BrowserDistribution::CHROME_BINARIES);
} else {
return dist;
}
}
std::wstring GetAppGuidForUpdates(bool system_install) {
return GetBinariesDistribution(system_install)->GetAppGuid();
}
}