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 if (!profile->GetPrefs()->GetString(prefs::kGoogleServicesHostedDomain). |
| 145 empty()) |
| 146 return; |
| 147 |
| 148 UpdateGaiaProfileInfoIfNeeded(profile); |
| 149 } |
| 150 |
| 151 void UpdateGaiaProfileInfoIfNeeded(Profile* profile) { |
142 // If the --google-profile-info flag isn't used, then the | 152 // If the --google-profile-info flag isn't used, then the |
143 // GAIAInfoUpdateService isn't initialized, and we can't download the picture. | 153 // GAIAInfoUpdateService isn't initialized, and we can't download the profile |
| 154 // info. |
144 if (!switches::IsGoogleProfileInfo()) | 155 if (!switches::IsGoogleProfileInfo()) |
145 return; | 156 return; |
146 | 157 |
147 DCHECK(profile); | 158 DCHECK(profile); |
148 GAIAInfoUpdateServiceFactory::GetInstance()->GetForProfile(profile)->Update(); | 159 |
| 160 GAIAInfoUpdateService* service = |
| 161 GAIAInfoUpdateServiceFactory::GetInstance()->GetForProfile(profile); |
| 162 // The service may be null, for example during unit tests. |
| 163 if (service) |
| 164 service->Update(); |
149 } | 165 } |
150 | 166 |
151 SigninErrorController* GetSigninErrorController(Profile* profile) { | 167 SigninErrorController* GetSigninErrorController(Profile* profile) { |
152 ProfileOAuth2TokenService* token_service = | 168 ProfileOAuth2TokenService* token_service = |
153 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); | 169 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); |
154 return token_service ? token_service->signin_error_controller() : NULL; | 170 return token_service ? token_service->signin_error_controller() : NULL; |
155 } | 171 } |
156 | 172 |
157 } // namespace profiles | 173 } // namespace profiles |
OLD | NEW |