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