| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 accounts.erase(primary_index); | 133 accounts.erase(primary_index); |
| 134 | 134 |
| 135 return accounts; | 135 return accounts; |
| 136 } | 136 } |
| 137 | 137 |
| 138 bool IsRegularOrGuestSession(Browser* browser) { | 138 bool IsRegularOrGuestSession(Browser* browser) { |
| 139 Profile* profile = browser->profile(); | 139 Profile* profile = browser->profile(); |
| 140 return profile->IsGuestSession() || !profile->IsOffTheRecord(); | 140 return profile->IsGuestSession() || !profile->IsOffTheRecord(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 void UpdateGaiaProfilePhotoIfNeeded(Profile* profile) { | 143 void UpdateIsProfileLockEnabledIfNeeded(Profile* profile) { |
| 144 DCHECK(switches::IsNewProfileManagement()); |
| 145 |
| 146 if (!profile->GetPrefs()->GetString(prefs::kGoogleServicesHostedDomain). |
| 147 empty()) |
| 148 return; |
| 149 |
| 150 UpdateGaiaProfileInfoIfNeeded(profile); |
| 151 } |
| 152 |
| 153 void UpdateGaiaProfileInfoIfNeeded(Profile* profile) { |
| 144 // If the --google-profile-info flag isn't used, then the | 154 // If the --google-profile-info flag isn't used, then the |
| 145 // 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. |
| 146 if (!switches::IsGoogleProfileInfo()) | 157 if (!switches::IsGoogleProfileInfo()) |
| 147 return; | 158 return; |
| 148 | 159 |
| 149 DCHECK(profile); | 160 DCHECK(profile); |
| 150 GAIAInfoUpdateServiceFactory::GetInstance()->GetForProfile(profile)->Update(); | 161 |
| 162 GAIAInfoUpdateService* service = |
| 163 GAIAInfoUpdateServiceFactory::GetInstance()->GetForProfile(profile); |
| 164 // The service may be null, for example during unit tests. |
| 165 if (service) |
| 166 service->Update(); |
| 151 } | 167 } |
| 152 | 168 |
| 153 SigninErrorController* GetSigninErrorController(Profile* profile) { | 169 SigninErrorController* GetSigninErrorController(Profile* profile) { |
| 154 ProfileOAuth2TokenService* token_service = | 170 ProfileOAuth2TokenService* token_service = |
| 155 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); | 171 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); |
| 156 return token_service ? token_service->signin_error_controller() : NULL; | 172 return token_service ? token_service->signin_error_controller() : NULL; |
| 157 } | 173 } |
| 158 | 174 |
| 159 } // namespace profiles | 175 } // namespace profiles |
| OLD | NEW |