Update V8 to version 4.7.21.
[chromium-blink-merge.git] / chrome / browser / profiles / profile_attributes_entry.cc
blob8c9757615c933feaeb5279174789b98d6d7d6b2e
1 // Copyright 2015 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 #include "chrome/browser/profiles/profile_attributes_entry.h"
6 #include "chrome/browser/profiles/profile_info_cache.h"
8 ProfileAttributesEntry::ProfileAttributesEntry()
9 : profile_info_cache_(nullptr),
10 profile_path_(base::FilePath()) {}
12 void ProfileAttributesEntry::Initialize(
13 ProfileInfoCache* cache, const base::FilePath& path) {
14 DCHECK(!profile_info_cache_);
15 DCHECK(cache);
16 profile_info_cache_ = cache;
17 DCHECK(profile_path_.empty());
18 DCHECK(!path.empty());
19 profile_path_ = path;
22 base::string16 ProfileAttributesEntry::GetName() const {
23 return profile_info_cache_->GetNameOfProfileAtIndex(profile_index());
26 base::string16 ProfileAttributesEntry::GetShortcutName() const {
27 return profile_info_cache_->GetShortcutNameOfProfileAtIndex(profile_index());
30 base::FilePath ProfileAttributesEntry::GetPath() const {
31 return profile_info_cache_->GetPathOfProfileAtIndex(profile_index());
34 base::Time ProfileAttributesEntry::GetActiveTime() const {
35 return profile_info_cache_->GetProfileActiveTimeAtIndex(profile_index());
38 base::string16 ProfileAttributesEntry::GetUserName() const {
39 return profile_info_cache_->GetUserNameOfProfileAtIndex(profile_index());
42 const gfx::Image& ProfileAttributesEntry::GetAvatarIcon() {
43 return profile_info_cache_->GetAvatarIconOfProfileAtIndex(profile_index());
46 std::string ProfileAttributesEntry::GetLocalAuthCredentials() const {
47 return profile_info_cache_->GetLocalAuthCredentialsOfProfileAtIndex(
48 profile_index());
51 std::string ProfileAttributesEntry::GetPasswordChangeDetectionToken() const {
52 return profile_info_cache_->GetPasswordChangeDetectionTokenAtIndex(
53 profile_index());
56 bool ProfileAttributesEntry::GetBackgroundStatus() const {
57 return profile_info_cache_->GetBackgroundStatusOfProfileAtIndex(
58 profile_index());
61 base::string16 ProfileAttributesEntry::GetGAIAName() const {
62 return profile_info_cache_->GetGAIANameOfProfileAtIndex(profile_index());
65 base::string16 ProfileAttributesEntry::GetGAIAGivenName() const {
66 return profile_info_cache_->GetGAIAGivenNameOfProfileAtIndex(profile_index());
69 std::string ProfileAttributesEntry::GetGAIAId() const {
70 return profile_info_cache_->GetGAIAIdOfProfileAtIndex(profile_index());
73 const gfx::Image* ProfileAttributesEntry::GetGAIAPicture() const {
74 return profile_info_cache_->GetGAIAPictureOfProfileAtIndex(profile_index());
77 bool ProfileAttributesEntry::IsUsingGAIAPicture() const {
78 return profile_info_cache_->IsUsingGAIAPictureOfProfileAtIndex(
79 profile_index());
82 bool ProfileAttributesEntry::IsSupervised() const {
83 return profile_info_cache_->ProfileIsSupervisedAtIndex(profile_index());
86 bool ProfileAttributesEntry::IsChild() const {
87 return profile_info_cache_->ProfileIsChildAtIndex(profile_index());
90 bool ProfileAttributesEntry::IsLegacySupervised() const {
91 return profile_info_cache_->ProfileIsLegacySupervisedAtIndex(profile_index());
94 bool ProfileAttributesEntry::IsOmitted() const {
95 return profile_info_cache_->IsOmittedProfileAtIndex(profile_index());
98 bool ProfileAttributesEntry::IsSigninRequired() const {
99 return profile_info_cache_->ProfileIsSigninRequiredAtIndex(profile_index());
102 std::string ProfileAttributesEntry::GetSupervisedUserId() const {
103 return profile_info_cache_->GetSupervisedUserIdOfProfileAtIndex(
104 profile_index());
107 bool ProfileAttributesEntry::IsEphemeral() const {
108 return profile_info_cache_->ProfileIsEphemeralAtIndex(profile_index());
111 bool ProfileAttributesEntry::IsUsingDefaultName() const {
112 return profile_info_cache_->ProfileIsUsingDefaultNameAtIndex(profile_index());
115 bool ProfileAttributesEntry::IsAuthenticated() const {
116 return profile_info_cache_->ProfileIsAuthenticatedAtIndex(profile_index());
119 bool ProfileAttributesEntry::IsUsingDefaultAvatar() const {
120 return profile_info_cache_->ProfileIsUsingDefaultAvatarAtIndex(
121 profile_index());
124 bool ProfileAttributesEntry::IsAuthError() const {
125 return profile_info_cache_->ProfileIsAuthErrorAtIndex(profile_index());
128 size_t ProfileAttributesEntry::GetAvatarIconIndex() const {
129 return profile_info_cache_->GetAvatarIconIndexOfProfileAtIndex(
130 profile_index());
133 void ProfileAttributesEntry::SetName(const base::string16& name) {
134 profile_info_cache_->SetNameOfProfileAtIndex(profile_index(), name);
137 void ProfileAttributesEntry::SetShortcutName(const base::string16& name) {
138 profile_info_cache_->SetShortcutNameOfProfileAtIndex(profile_index(), name);
141 void ProfileAttributesEntry::SetIsOmitted(bool is_omitted) {
142 profile_info_cache_->SetIsOmittedProfileAtIndex(profile_index(), is_omitted);
145 void ProfileAttributesEntry::SetSupervisedUserId(const std::string& id) {
146 profile_info_cache_->SetSupervisedUserIdOfProfileAtIndex(profile_index(), id);
149 void ProfileAttributesEntry::SetLocalAuthCredentials(const std::string& auth) {
150 profile_info_cache_->SetLocalAuthCredentialsOfProfileAtIndex(
151 profile_index(), auth);
154 void ProfileAttributesEntry::SetPasswordChangeDetectionToken(
155 const std::string& token) {
156 profile_info_cache_->SetPasswordChangeDetectionTokenAtIndex(
157 profile_index(), token);
160 void ProfileAttributesEntry::SetBackgroundStatus(bool running_background_apps) {
161 profile_info_cache_->SetBackgroundStatusOfProfileAtIndex(
162 profile_index(), running_background_apps);
165 void ProfileAttributesEntry::SetGAIAName(const base::string16& name) {
166 profile_info_cache_->SetGAIANameOfProfileAtIndex(profile_index(), name);
169 void ProfileAttributesEntry::SetGAIAGivenName(const base::string16& name) {
170 profile_info_cache_->SetGAIAGivenNameOfProfileAtIndex(profile_index(), name);
173 void ProfileAttributesEntry::SetGAIAPicture(const gfx::Image* image) {
174 profile_info_cache_->SetGAIAPictureOfProfileAtIndex(profile_index(), image);
177 void ProfileAttributesEntry::SetIsUsingGAIAPicture(bool value) {
178 profile_info_cache_->SetIsUsingGAIAPictureOfProfileAtIndex(
179 profile_index(), value);
182 void ProfileAttributesEntry::SetIsSigninRequired(bool value) {
183 profile_info_cache_->SetProfileSigninRequiredAtIndex(profile_index(), value);
186 void ProfileAttributesEntry::SetIsEphemeral(bool value) {
187 profile_info_cache_->SetProfileIsEphemeralAtIndex(profile_index(), value);
190 void ProfileAttributesEntry::SetIsUsingDefaultName(bool value) {
191 profile_info_cache_->SetProfileIsUsingDefaultNameAtIndex(
192 profile_index(), value);
195 void ProfileAttributesEntry::SetIsUsingDefaultAvatar(bool value) {
196 profile_info_cache_->SetProfileIsUsingDefaultAvatarAtIndex(
197 profile_index(), value);
200 void ProfileAttributesEntry::SetIsAuthError(bool value) {
201 profile_info_cache_->SetProfileIsAuthErrorAtIndex(profile_index(), value);
204 void ProfileAttributesEntry::SetAvatarIconIndex(size_t icon_index) {
205 profile_info_cache_->SetAvatarIconOfProfileAtIndex(
206 profile_index(), icon_index);
209 void ProfileAttributesEntry::SetAuthInfo(
210 const std::string& gaia_id, const base::string16& user_name) {
211 profile_info_cache_->SetAuthInfoOfProfileAtIndex(
212 profile_index(), gaia_id, user_name);
215 size_t ProfileAttributesEntry::profile_index() const {
216 size_t index = profile_info_cache_->GetIndexOfProfileWithPath(profile_path_);
217 DCHECK(index < profile_info_cache_->GetNumberOfProfiles());
218 return index;