Roll src/third_party/WebKit f298044:aa8346d (svn 202628:202629)
[chromium-blink-merge.git] / chrome / browser / profiles / profiles_state.h
blob3b5f8b065601d1b744a27ca4bdb4fd51c709395d
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.
5 #ifndef CHROME_BROWSER_PROFILES_PROFILES_STATE_H_
6 #define CHROME_BROWSER_PROFILES_PROFILES_STATE_H_
8 #include <vector>
9 #include "base/strings/string16.h"
10 #include "chrome/browser/profiles/avatar_menu.h"
12 class Browser;
13 class PrefRegistrySimple;
14 class Profile;
15 class SigninErrorController;
16 namespace base { class FilePath; }
18 namespace profiles {
20 // Checks if multiple profiles is enabled.
21 bool IsMultipleProfilesEnabled();
23 // Returns the path to the default profile directory, based on the given
24 // user data directory.
25 base::FilePath GetDefaultProfileDir(const base::FilePath& user_data_dir);
27 // Register multi-profile related preferences in Local State.
28 void RegisterPrefs(PrefRegistrySimple* registry);
30 // Returns the display name of the specified on-the-record profile (or guest),
31 // specified by |profile_path|, used in the avatar button or user manager. If
32 // |profile_path| is the guest path, it will return IDS_GUEST_PROFILE_NAME. If
33 // there is only one local profile present, it will return
34 // IDS_SINGLE_PROFILE_DISPLAY_NAME, unless the profile has a user entered
35 // custom name.
36 base::string16 GetAvatarNameForProfile(const base::FilePath& profile_path);
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);
43 // Returns the string to use in the fast user switcher menu for the specified
44 // menu item. Adds a supervision indicator to the profile name if appropriate.
45 base::string16 GetProfileSwitcherTextForItem(const AvatarMenu::Item& item);
47 // Update the name of |profile| to |new_profile_name|. This updates the
48 // profile preferences, which triggers an update in the ProfileInfoCache.
49 // This method should be called when the user is explicitely changing
50 // the profile name, as it will always set |prefs::kProfileUsingDefaultName|
51 // to false.
52 void UpdateProfileName(Profile* profile,
53 const base::string16& new_profile_name);
55 // Returns the list of secondary accounts for a specific |profile|, which is
56 // all the email addresses associated with the profile that are not equal to
57 // the |primary_account|.
58 std::vector<std::string> GetSecondaryAccountsForProfile(
59 Profile* profile,
60 const std::string& primary_account);
62 // Returns whether the |browser|'s profile is a non-incognito or guest profile.
63 // The distinction is needed because guest profiles are implemented as
64 // incognito profiles.
65 bool IsRegularOrGuestSession(Browser* browser);
67 // Returns true if sign in is required to browse as this profile. Call with
68 // profile->GetPath() if you have a profile pointer.
69 // TODO(mlerman): Refactor appropriate calls to
70 // ProfileInfoCache::ProfileIsSigninRequiredAtIndex to call here instead.
71 bool IsProfileLocked(const base::FilePath& path);
73 // If the lock-enabled information for this profile is not up to date, starts
74 // an update for the Gaia profile info.
75 void UpdateIsProfileLockEnabledIfNeeded(Profile* profile);
77 // If the --google-profile-info flag is turned on, starts an update for a new
78 // version of the Gaia profile picture and other profile info.
79 void UpdateGaiaProfileInfoIfNeeded(Profile* profile);
81 // Returns the sign-in error controller for the given profile. Some profiles,
82 // like guest profiles, may not have a controller so this function may return
83 // NULL.
84 SigninErrorController* GetSigninErrorController(Profile* profile);
86 // If the current active profile (given by prefs::kProfileLastUsed) is locked,
87 // changes the active profile to the Guest profile. Returns true if the active
88 // profile had been Guest before calling or became Guest as a result of this
89 // method.
90 bool SetActiveProfileToGuestIfLocked();
92 // If the profile given by |profile_path| is loaded in the ProfileManager, use
93 // a BrowsingDataRemover to delete all the Profile's data.
94 void RemoveBrowsingDataForProfile(const base::FilePath& profile_path);
96 // Marks the right-click user switching tutorial dismissed state as |dismissed|.
97 void SetFastUserSwitchingTutorialDismissedState(bool dismissed);
99 // Returns true if the right-click user switching tutorial was previously
100 // dismissed by a user, false otherwise.
101 bool GetFastUserSwitchingTutorialDismissedState();
103 // Sets the last used profile pref to |profile_dir|, unless |profile_dir| is the
104 // System Profile directory, which is an invalid last used profile.
105 void SetLastUsedProfile(const std::string& profile_dir);
107 } // namespace profiles
109 #endif // CHROME_BROWSER_PROFILES_PROFILES_STATE_H_