chromium/chrome/browser/profiles/profiles_state.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/profiles/profiles_state.h"

#include "base/check.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_attributes_entry.h"
#include "chrome/browser/profiles/profile_attributes_storage.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_selections.h"
#include "chrome/browser/ui/profiles/profile_picker.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h"
#include "chromeos/ash/components/browser_context_helper/browser_context_types.h"
#include "components/browsing_data/content/browsing_data_helper.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
#include "components/signin/public/identity_manager/account_info.h"
#include "components/supervised_user/core/common/features.h"
#include "components/user_manager/user_manager.h"
#include "content/public/browser/browsing_data_remover.h"
#include "ui/base/l10n/l10n_util.h"

#if !BUILDFLAG(IS_ANDROID)
#include "chrome/browser/ui/browser.h"
#endif

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/constants/ash_switches.h"
#include "chrome/browser/ash/login/demo_mode/demo_session.h"
#include "chromeos/ash/components/login/login_state/login_state.h"
#else
#include <algorithm>
#include "chrome/browser/profiles/gaia_info_update_service.h"
#include "chrome/browser/profiles/gaia_info_update_service_factory.h"
#include "components/signin/public/base/signin_pref_names.h"
#endif

#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "chromeos/startup/browser_params_proxy.h"
#endif

namespace profiles {

bool IsMultipleProfilesEnabled() {}

base::FilePath GetDefaultProfileDir(const base::FilePath& user_data_dir) {}

void RegisterPrefs(PrefRegistrySimple* registry) {}

void SetLastUsedProfile(const base::FilePath& profile_dir) {}

bool IsRegularUserProfile(Profile* profile) {}

#if !BUILDFLAG(IS_ANDROID)
std::u16string GetAvatarNameForProfile(const base::FilePath& profile_path) {}

#if !BUILDFLAG(IS_CHROMEOS_ASH)
void UpdateProfileName(Profile* profile,
                       const std::u16string& new_profile_name) {}

#endif  // !BUILDFLAG(IS_CHROMEOS_ASH)

bool IsRegularOrGuestSession(Browser* browser) {}

bool IsGuestModeRequested(const base::CommandLine& command_line,
                          PrefService* local_state,
                          bool show_warning) {}

bool IsProfileCreationAllowed() {}

// Whether guest mode is globally disabled (for all entry points and users).
bool IsGuestModeGloballyDisabledInternal() {}

bool IsGuestModeEnabled() {}

bool IsGuestModeEnabled(const Profile& profile) {}

#if BUILDFLAG(IS_CHROMEOS)
bool AreSecondaryProfilesAllowed() {
  const PrefService* const pref_service = g_browser_process->local_state();
  DCHECK(pref_service);
  // This Lacros policy is used on Ash, as it impacts the Ash UI where the user
  // can launch Lacros Guest mode window.
  return pref_service->GetBoolean(prefs::kLacrosSecondaryProfilesAllowed);
}
#endif  // BUILDFLAG(IS_CHROMEOS)

bool IsProfileLocked(const base::FilePath& profile_path) {}

#if !BUILDFLAG(IS_CHROMEOS_ASH)
void UpdateGaiaProfileInfoIfNeeded(Profile* profile) {}

#endif  // !BUILDFLAG(IS_CHROMEOS_ASH)

void RemoveBrowsingDataForProfile(const base::FilePath& profile_path) {}

bool IsDemoSession() {}

bool IsChromeAppKioskSession() {}

#if BUILDFLAG(IS_CHROMEOS_LACROS)
bool IsWebKioskSession() {
  crosapi::mojom::SessionType session_type =
      chromeos::BrowserParamsProxy::Get()->SessionType();
  return session_type == crosapi::mojom::SessionType::kWebKioskSession;
}
#endif  // BUILDFLAG(IS_CHROMEOS_LACROS)

#if BUILDFLAG(IS_CHROMEOS_LACROS)
// Implemented to have the same logic as user_manager::User::HasGaiaAccount()
bool SessionHasGaiaAccount() {
  crosapi::mojom::SessionType session_type =
      chromeos::BrowserParamsProxy::Get()->SessionType();
  return session_type == crosapi::mojom::SessionType::kRegularSession ||
         session_type == crosapi::mojom::SessionType::kChildSession;
}
#endif  // BUILDFLAG(IS_CHROMEOS_LACROS)

#if !BUILDFLAG(IS_CHROMEOS_ASH)
std::u16string GetDefaultNameForNewEnterpriseProfile(
    const std::string& hosted_domain) {}

std::u16string GetDefaultNameForNewSignedInProfile(
    const AccountInfo& account_info) {}

std::u16string GetDefaultNameForNewSignedInProfileWithIncompleteInfo(
    const CoreAccountInfo& account_info) {}
#endif  // !BUILDFLAG(IS_CHROMEOS_ASH)

#endif  // !BUILDFLAG(IS_ANDROID)

}  // namespace profiles