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 #include "chrome/browser/profiles/profiles_state.h" | 5 #include "chrome/browser/profiles/profiles_state.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/prefs/pref_registry_simple.h" | 8 #include "base/prefs/pref_registry_simple.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 accounts.erase(primary_index); | 131 accounts.erase(primary_index); |
132 | 132 |
133 return accounts; | 133 return accounts; |
134 } | 134 } |
135 | 135 |
136 bool IsRegularOrGuestSession(Browser* browser) { | 136 bool IsRegularOrGuestSession(Browser* browser) { |
137 Profile* profile = browser->profile(); | 137 Profile* profile = browser->profile(); |
138 return profile->IsGuestSession() || !profile->IsOffTheRecord(); | 138 return profile->IsGuestSession() || !profile->IsOffTheRecord(); |
139 } | 139 } |
140 | 140 |
141 void UpdateGaiaProfilePhotoIfNeeded(Profile* profile) { | 141 void UpdateIsProfileLockEnabledIfNeeded(Profile* profile) { |
| 142 DCHECK(switches::IsNewProfileManagement()); |
| 143 |
| 144 PrefService* pref_service = profile->GetPrefs(); |
| 145 int lock_status_version = |
| 146 pref_service->GetInteger(prefs::kProfileIsLockableVersion); |
| 147 if (lock_status_version == profiles::kCurrentLockAlgorithmVersion) |
| 148 return; |
| 149 |
| 150 UpdateGaiaProfileInfoIfNeeded(profile); |
| 151 } |
| 152 |
| 153 void UpdateGaiaProfileInfoIfNeeded(Profile* profile) { |
142 // If the --google-profile-info flag isn't used, then the | 154 // If the --google-profile-info flag isn't used, then the |
143 // GAIAInfoUpdateService isn't initialized, and we can't download the picture. | 155 // GAIAInfoUpdateService isn't initialized, and we can't download the profile |
| 156 // info. |
144 if (!switches::IsGoogleProfileInfo()) | 157 if (!switches::IsGoogleProfileInfo()) |
145 return; | 158 return; |
146 | 159 |
147 DCHECK(profile); | 160 DCHECK(profile); |
148 GAIAInfoUpdateServiceFactory::GetInstance()->GetForProfile(profile)->Update(); | 161 GAIAInfoUpdateServiceFactory::GetInstance()->GetForProfile(profile)->Update(); |
149 } | 162 } |
150 | 163 |
151 SigninErrorController* GetSigninErrorController(Profile* profile) { | 164 SigninErrorController* GetSigninErrorController(Profile* profile) { |
152 ProfileOAuth2TokenService* token_service = | 165 ProfileOAuth2TokenService* token_service = |
153 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); | 166 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); |
154 return token_service ? token_service->signin_error_controller() : NULL; | 167 return token_service ? token_service->signin_error_controller() : NULL; |
155 } | 168 } |
156 | 169 |
157 } // namespace profiles | 170 } // namespace profiles |
OLD | NEW |