#include "chrome/common/chrome_paths.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/no_destructor.h"
#include "base/path_service.h"
#include "base/system/sys_info.h"
#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/common/buildflags.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths_internal.h"
#include "media/media_buildflags.h"
#include "ppapi/buildflags/buildflags.h"
#if BUILDFLAG(IS_ANDROID)
#include "base/android/path_utils.h"
#include "base/base_paths_android.h"
#include "ui/base/ui_base_paths.h"
#endif
#if BUILDFLAG(IS_MAC)
#include "base/apple/bundle_locations.h"
#include "base/apple/foundation_util.h"
#endif
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_OPENBSD)
#include "components/policy/core/common/policy_paths.h"
#endif
#if BUILDFLAG(IS_WIN)
#include "base/win/registry.h"
#endif
#if BUILDFLAG(ENABLE_WIDEVINE)
#include "third_party/widevine/cdm/widevine_cdm_common.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "base/command_line.h"
#include "chrome/common/chrome_switches.h"
#include "chromeos/crosapi/cpp/crosapi_constants.h"
#include "chromeos/lacros/lacros_paths.h"
#include "chromeos/startup/startup.h"
#endif
namespace {
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
const base::FilePath::CharType kFilepathSinglePrefExtensions[] = …FILE_PATH_LITERAL("/usr/share/google-chrome/extensions");
#else
FILE_PATH_LITERAL("/usr/share/chromium/extensions");
#endif
#endif
#if BUILDFLAG(ENABLE_WIDEVINE)
const base::FilePath::CharType kComponentUpdatedWidevineCdmHint[] =
FILE_PATH_LITERAL("latest-component-updated-widevine-cdm");
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
const base::FilePath::CharType kChromeOSTPMFirmwareUpdateLocation[] =
FILE_PATH_LITERAL("/run/tpm_firmware_update_location");
const base::FilePath::CharType kChromeOSTPMFirmwareUpdateSRKVulnerableROCA[] =
FILE_PATH_LITERAL("/run/tpm_firmware_update_srk_vulnerable_roca");
#if BUILDFLAG(IS_CHROMEOS_DEVICE)
const base::FilePath::CharType kChromeOSCryptohomeMountRoot[] =
FILE_PATH_LITERAL("/home/user");
#else
const base::FilePath::CharType kFakeCryptohomeMountRootDirname[] =
FILE_PATH_LITERAL(".home_user");
#endif
bool GetChromeOsCrdDataDirInternal(base::FilePath* result,
bool* should_be_created) {
#if BUILDFLAG(IS_CHROMEOS_DEVICE)
*result = base::FilePath::FromASCII("/run/crd");
*should_be_created = false;
return true;
#else
base::FilePath temp_directory;
if (!base::PathService::Get(base::DIR_TEMP, &temp_directory)) {
return false;
}
*result = temp_directory.Append(FILE_PATH_LITERAL("crd"));
*should_be_created = true;
return true;
#endif
}
#endif
#if BUILDFLAG(IS_CHROMEOS_LACROS)
const base::FilePath::CharType kLacrosLogDirectory[] =
FILE_PATH_LITERAL("/var/log/lacros");
#endif
base::FilePath& GetInvalidSpecifiedUserDataDirInternal() { … }
bool GetInternalPluginsDirectory(base::FilePath* result) { … }
bool GetComponentDirectory(base::FilePath* result) { … }
}
namespace chrome {
bool PathProvider(int key, base::FilePath* result) { … }
void RegisterPathProvider() { … }
void SetInvalidSpecifiedUserDataDir(const base::FilePath& user_data_dir) { … }
const base::FilePath& GetInvalidSpecifiedUserDataDir() { … }
}