OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/profile_impl.h" | 5 #include "chrome/browser/profiles/profile_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 Profile* ProfileImpl::GetOriginalProfile() { | 770 Profile* ProfileImpl::GetOriginalProfile() { |
771 return this; | 771 return this; |
772 } | 772 } |
773 | 773 |
774 bool ProfileImpl::IsSupervised() { | 774 bool ProfileImpl::IsSupervised() { |
775 return !GetPrefs()->GetString(prefs::kSupervisedUserId).empty(); | 775 return !GetPrefs()->GetString(prefs::kSupervisedUserId).empty(); |
776 } | 776 } |
777 | 777 |
778 bool ProfileImpl::IsChild() { | 778 bool ProfileImpl::IsChild() { |
779 #if defined(ENABLE_SUPERVISED_USERS) | 779 #if defined(ENABLE_SUPERVISED_USERS) |
780 return GetPrefs()->GetString(prefs::kSupervisedUserId) == | 780 return user_manager::UserID::FromUserEmail(GetPrefs()->GetString(prefs::kSuper
visedUserId)) == |
781 supervised_users::kChildAccountSUID; | 781 supervised_users::GetChildAccountSUID(); |
782 #else | 782 #else |
783 return false; | 783 return false; |
784 #endif | 784 #endif |
785 } | 785 } |
786 | 786 |
787 bool ProfileImpl::IsLegacySupervised() { | 787 bool ProfileImpl::IsLegacySupervised() { |
788 return IsSupervised() && !IsChild(); | 788 return IsSupervised() && !IsChild(); |
789 } | 789 } |
790 | 790 |
791 ExtensionSpecialStoragePolicy* | 791 ExtensionSpecialStoragePolicy* |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 default: { | 1152 default: { |
1153 NOTREACHED(); | 1153 NOTREACHED(); |
1154 break; | 1154 break; |
1155 } | 1155 } |
1156 } | 1156 } |
1157 if (do_update_pref) | 1157 if (do_update_pref) |
1158 GetPrefs()->SetString(prefs::kApplicationLocale, new_locale); | 1158 GetPrefs()->SetString(prefs::kApplicationLocale, new_locale); |
1159 if (via != APP_LOCALE_CHANGED_VIA_PUBLIC_SESSION_LOGIN) | 1159 if (via != APP_LOCALE_CHANGED_VIA_PUBLIC_SESSION_LOGIN) |
1160 local_state->SetString(prefs::kApplicationLocale, new_locale); | 1160 local_state->SetString(prefs::kApplicationLocale, new_locale); |
1161 | 1161 |
1162 if (user_manager::UserManager::Get()->GetOwnerEmail() == | 1162 if (user_manager::UserManager::Get()->GetOwnerID() == |
1163 chromeos::ProfileHelper::Get()->GetUserByProfile(this)->email()) | 1163 chromeos::ProfileHelper::Get()->GetUserByProfile(this)->GetUserID()) |
1164 local_state->SetString(prefs::kOwnerLocale, new_locale); | 1164 local_state->SetString(prefs::kOwnerLocale, new_locale); |
1165 } | 1165 } |
1166 | 1166 |
1167 void ProfileImpl::OnLogin() { | 1167 void ProfileImpl::OnLogin() { |
1168 if (locale_change_guard_ == NULL) | 1168 if (locale_change_guard_ == NULL) |
1169 locale_change_guard_.reset(new chromeos::LocaleChangeGuard(this)); | 1169 locale_change_guard_.reset(new chromeos::LocaleChangeGuard(this)); |
1170 locale_change_guard_->OnLogin(); | 1170 locale_change_guard_->OnLogin(); |
1171 } | 1171 } |
1172 | 1172 |
1173 void ProfileImpl::InitChromeOSPreferences() { | 1173 void ProfileImpl::InitChromeOSPreferences() { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 if (!home_page.is_valid()) | 1224 if (!home_page.is_valid()) |
1225 return GURL(chrome::kChromeUINewTabURL); | 1225 return GURL(chrome::kChromeUINewTabURL); |
1226 return home_page; | 1226 return home_page; |
1227 } | 1227 } |
1228 | 1228 |
1229 void ProfileImpl::UpdateProfileSupervisedUserIdCache() { | 1229 void ProfileImpl::UpdateProfileSupervisedUserIdCache() { |
1230 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 1230 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
1231 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); | 1231 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |
1232 size_t index = cache.GetIndexOfProfileWithPath(GetPath()); | 1232 size_t index = cache.GetIndexOfProfileWithPath(GetPath()); |
1233 if (index != std::string::npos) { | 1233 if (index != std::string::npos) { |
1234 std::string supervised_user_id = | 1234 const user_manager::UserID supervised_user_id( |
1235 GetPrefs()->GetString(prefs::kSupervisedUserId); | 1235 user_manager::UserID::FromUserEmail(GetPrefs()->GetString(prefs::kSuperv
isedUserId))); |
1236 cache.SetSupervisedUserIdOfProfileAtIndex(index, supervised_user_id); | 1236 cache.SetSupervisedUserIdOfProfileAtIndex(index, supervised_user_id); |
1237 ProfileMetrics::UpdateReportedProfilesStatistics(profile_manager); | 1237 ProfileMetrics::UpdateReportedProfilesStatistics(profile_manager); |
1238 } | 1238 } |
1239 } | 1239 } |
1240 | 1240 |
1241 void ProfileImpl::UpdateProfileNameCache() { | 1241 void ProfileImpl::UpdateProfileNameCache() { |
1242 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 1242 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
1243 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); | 1243 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |
1244 size_t index = cache.GetIndexOfProfileWithPath(GetPath()); | 1244 size_t index = cache.GetIndexOfProfileWithPath(GetPath()); |
1245 if (index != std::string::npos) { | 1245 if (index != std::string::npos) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1311 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { | 1311 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { |
1312 domain_reliability::DomainReliabilityService* service = | 1312 domain_reliability::DomainReliabilityService* service = |
1313 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> | 1313 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> |
1314 GetForBrowserContext(this); | 1314 GetForBrowserContext(this); |
1315 if (!service) | 1315 if (!service) |
1316 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); | 1316 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); |
1317 | 1317 |
1318 return service->CreateMonitor( | 1318 return service->CreateMonitor( |
1319 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 1319 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
1320 } | 1320 } |
OLD | NEW |