1// Copyright 2013 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#ifndef CHROME_BROWSER_PROFILES_PROFILES_STATE_H_ 6#define CHROME_BROWSER_PROFILES_PROFILES_STATE_H_ 7 8#include <vector> 9#include "base/strings/string16.h" 10 11class Browser; 12class PrefRegistrySimple; 13class Profile; 14class SigninErrorController; 15namespace base { class FilePath; } 16 17namespace profiles { 18 19// Checks if multiple profiles is enabled. 20bool IsMultipleProfilesEnabled(); 21 22// Returns the path to the default profile directory, based on the given 23// user data directory. 24base::FilePath GetDefaultProfileDir(const base::FilePath& user_data_dir); 25 26// Register multi-profile related preferences in Local State. 27void RegisterPrefs(PrefRegistrySimple* registry); 28 29// Returns the display name of the specified on-the-record profile (or guest), 30// specified by |profile_path|, used in the avatar button or user manager. If 31// |profile_path| is the guest path, it will return IDS_GUEST_PROFILE_NAME. If 32// there is only one local profile present, it will return 33// IDS_SINGLE_PROFILE_DISPLAY_NAME, unless the profile has a user entered 34// custom name. 35base::string16 GetAvatarNameForProfile(const base::FilePath& profile_path); 36 37// Returns the string to use in the avatar button for the specified profile. 38// This is essentially the name returned by GetAvatarNameForProfile, but it 39// may be elided and contain an indicator for supervised users. 40base::string16 GetAvatarButtonTextForProfile(Profile* profile); 41 42// Update the name of |profile| to |new_profile_name|. This updates the 43// profile preferences, which triggers an update in the ProfileInfoCache. 44// This method should be called when the user is explicitely changing 45// the profile name, as it will always set |prefs::kProfileUsingDefaultName| 46// to false. 47void UpdateProfileName(Profile* profile, 48 const base::string16& new_profile_name); 49 50// Returns the list of secondary accounts for a specific |profile|, which is 51// all the email addresses associated with the profile that are not equal to 52// the |primary_account|. 53std::vector<std::string> GetSecondaryAccountsForProfile( 54 Profile* profile, 55 const std::string& primary_account); 56 57// Returns whether the |browser|'s profile is a non-incognito or guest profile. 58// The distinction is needed because guest profiles are implemented as 59// incognito profiles. 60bool IsRegularOrGuestSession(Browser* browser); 61 62// If the --google-profile-info flag is turned on, starts an update for a new 63// version of the Gaia profile picture. 64void UpdateGaiaProfilePhotoIfNeeded(Profile* profile); 65 66// Returns the sign-in error controller for the given profile. Some profiles, 67// like guest profiles, may not have a controller so this function may return 68// NULL. 69SigninErrorController* GetSigninErrorController(Profile* profile); 70 71// If the current active profile (given by prefs::kProfileLastUsed) is locked, 72// changes the active profile to the Guest profile and returns it, otherwise 73// returns NULL. This assumes that the Guest profile has been loaded. 74Profile* SetActiveProfileToGuestIfLocked(); 75 76} // namespace profiles 77 78#endif // CHROME_BROWSER_PROFILES_PROFILES_STATE_H_ 79