Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / profiles / profiles_state.h
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
11 class Browser;
12 class PrefRegistrySimple;
13 class Profile;
14 class SigninErrorController;
15 namespace base { class FilePath; }
16
17 namespace profiles {
18
19 // Checks if multiple profiles is enabled.
20 bool IsMultipleProfilesEnabled();
21
22 // Returns the path to the default profile directory, based on the given
23 // user data directory.
24 base::FilePath GetDefaultProfileDir(const base::FilePath& user_data_dir);
25
26 // Register multi-profile related preferences in Local State.
27 void 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.
35 base::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.
40 base::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.
47 void 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|.
53 std::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.
60 bool IsRegularOrGuestSession(Browser* browser);
61
62 // If the lock-enabled information for this profile is not up to date, starts
63 // an update for the Gaia profile info.
64 void UpdateIsProfileLockEnabledIfNeeded(Profile* profile);
65
66 // If the --google-profile-info flag is turned on, starts an update for a new
67 // version of the Gaia profile picture and other profile info.
68 void UpdateGaiaProfileInfoIfNeeded(Profile* profile);
69
70 // Returns the sign-in error controller for the given profile.  Some profiles,
71 // like guest profiles, may not have a controller so this function may return
72 // NULL.
73 SigninErrorController* GetSigninErrorController(Profile* profile);
74
75 // If the current active profile (given by prefs::kProfileLastUsed) is locked,
76 // changes the active profile to the Guest profile and returns it, otherwise
77 // returns NULL. This assumes that the Guest profile has been loaded.
78 Profile* SetActiveProfileToGuestIfLocked();
79
80 }  // namespace profiles
81
82 #endif  // CHROME_BROWSER_PROFILES_PROFILES_STATE_H_