#include "chrome/browser/web_applications/preinstalled_web_apps/preinstalled_web_apps.h"
#include <optional>
#include <string>
#include <utility>
#include "base/check_op.h"
#include "base/command_line.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "build/buildflag.h"
#include "chrome/browser/web_applications/preinstalled_app_install_features.h"
#include "chrome/common/chrome_switches.h"
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
#include "chrome/browser/web_applications/preinstalled_web_apps/gmail.h"
#include "chrome/browser/web_applications/preinstalled_web_apps/google_docs.h"
#include "chrome/browser/web_applications/preinstalled_web_apps/google_drive.h"
#include "chrome/browser/web_applications/preinstalled_web_apps/google_sheets.h"
#include "chrome/browser/web_applications/preinstalled_web_apps/google_slides.h"
#include "chrome/browser/web_applications/preinstalled_web_apps/youtube.h"
#if BUILDFLAG(IS_CHROMEOS)
#include "base/feature_list.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/web_applications/preinstalled_web_apps/app_mall.h"
#include "chrome/browser/web_applications/preinstalled_web_apps/calculator.h"
#include "chrome/browser/web_applications/preinstalled_web_apps/container.h"
#include "chrome/browser/web_applications/preinstalled_web_apps/google_calendar.h"
#include "chrome/browser/web_applications/preinstalled_web_apps/google_chat.h"
#include "chrome/browser/web_applications/preinstalled_web_apps/google_meet.h"
#include "chrome/browser/web_applications/preinstalled_web_apps/messages_dogfood.h"
#include "chrome/browser/web_applications/web_app_id_constants.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chromeos/constants/chromeos_features.h"
#include "extensions/common/constants.h"
#include "google_apis/gaia/gaia_auth_util.h"
#endif
#endif
namespace web_app {
namespace {
std::vector<ExternalInstallOptions>* g_preinstalled_app_data_for_testing = …;
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
#if BUILDFLAG(IS_CHROMEOS)
bool IsGoogleInternalAccount() {
Profile* profile = ProfileManager::GetActiveUserProfile();
if (!profile)
return false;
return gaia::IsGoogleInternalAccountEmail(profile->GetProfileUserName());
}
#endif
std::vector<ExternalInstallOptions> GetChromeBrandedApps(
Profile& profile,
const std::optional<DeviceInfo>& device_info) {
bool is_standalone_tabbed =
IsPreinstalledDocsSheetsSlidesDriveStandaloneTabbed(profile);
std::vector<ExternalInstallOptions> apps = {
GetConfigForGmail(),
GetConfigForGoogleDocs(is_standalone_tabbed),
GetConfigForGoogleDrive(is_standalone_tabbed),
GetConfigForGoogleSheets(is_standalone_tabbed),
GetConfigForGoogleSlides(is_standalone_tabbed),
GetConfigForYouTube(),
};
#if BUILDFLAG(IS_CHROMEOS)
if (!base::FeatureList::IsEnabled(
chromeos::features::kPreinstalledWebAppsCoreOnly)) {
apps.insert(apps.end(), {
GetConfigForAppMall(),
GetConfigForCalculator(),
GetConfigForContainer(device_info),
GetConfigForGoogleCalendar(),
GetConfigForGoogleChat(),
GetConfigForGoogleMeet(),
});
}
#endif
return apps;
}
#endif
}
DeviceInfo::DeviceInfo() = default;
DeviceInfo::DeviceInfo(const DeviceInfo&) = default;
DeviceInfo::DeviceInfo(DeviceInfo&&) = default;
DeviceInfo& DeviceInfo::operator=(const DeviceInfo&) = default;
DeviceInfo& DeviceInfo::operator=(DeviceInfo&&) = default;
DeviceInfo::~DeviceInfo() = default;
bool PreinstalledWebAppsDisabled() { … }
std::vector<ExternalInstallOptions> GetPreinstalledWebApps(
Profile& profile,
const std::optional<DeviceInfo>& device_info) { … }
ScopedTestingPreinstalledAppData::ScopedTestingPreinstalledAppData() { … }
ScopedTestingPreinstalledAppData::~ScopedTestingPreinstalledAppData() { … }
PreinstalledWebAppMigration::PreinstalledWebAppMigration() = default;
PreinstalledWebAppMigration::PreinstalledWebAppMigration(
PreinstalledWebAppMigration&&) noexcept = default;
PreinstalledWebAppMigration::~PreinstalledWebAppMigration() = default;
std::vector<PreinstalledWebAppMigration> GetPreinstalledWebAppMigrations(
Profile& profile) { … }
}