#include "chrome/browser/web_applications/preinstalled_web_app_config_utils.h"
#include "base/command_line.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/constants/ash_switches.h"
#include "chrome/browser/ash/profiles/profile_helper.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "chrome/common/chrome_paths_lacros.h"
#endif
namespace web_app {
namespace {
const base::FilePath* g_config_dir_for_testing = …;
#if BUILDFLAG(IS_CHROMEOS_ASH)
const base::FilePath::CharType kWebAppsSubDirectory[] =
FILE_PATH_LITERAL("web_apps");
#endif
#if BUILDFLAG(IS_CHROMEOS_LACROS)
base::FilePath GetPreinstalledWebAppConfigDirFromDefaultPaths(
Profile* profile) {
if (g_config_dir_for_testing) {
return *g_config_dir_for_testing;
}
base::FilePath web_apps_dir;
if (chrome::GetPreinstalledWebAppConfigPath(&web_apps_dir))
return web_apps_dir;
return base::FilePath();
}
base::FilePath GetPreinstalledWebAppExtraConfigDirFromDefaultPaths(
Profile* profile) {
base::FilePath extra_web_apps_dir;
if (chrome::GetPreinstalledWebAppExtraConfigPath(&extra_web_apps_dir))
return extra_web_apps_dir;
return base::FilePath();
}
#endif
}
const base::FilePath* GetPreinstalledWebAppConfigDirForTesting() { … }
void SetPreinstalledWebAppConfigDirForTesting(
const base::FilePath* config_dir) { … }
#if !BUILDFLAG(IS_CHROMEOS_LACROS)
base::FilePath GetPreinstalledWebAppConfigDirFromCommandLine(Profile* profile) { … }
base::FilePath GetPreinstalledWebAppExtraConfigDirFromCommandLine(
Profile* profile) { … }
#endif
base::FilePath GetPreinstalledWebAppConfigDir(Profile* profile) { … }
base::FilePath GetPreinstalledWebAppExtraConfigDir(Profile* profile) { … }
}