| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/login/users/chrome_user_manager_impl.h" | 5 #include "chrome/browser/chromeos/login/users/chrome_user_manager_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cstddef> | 9 #include <cstddef> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 enterprise_user_session_metrics::RegisterPrefs(registry); | 171 enterprise_user_session_metrics::RegisterPrefs(registry); |
| 172 } | 172 } |
| 173 | 173 |
| 174 // static | 174 // static |
| 175 std::unique_ptr<ChromeUserManager> | 175 std::unique_ptr<ChromeUserManager> |
| 176 ChromeUserManagerImpl::CreateChromeUserManager() { | 176 ChromeUserManagerImpl::CreateChromeUserManager() { |
| 177 return std::unique_ptr<ChromeUserManager>(new ChromeUserManagerImpl()); | 177 return std::unique_ptr<ChromeUserManager>(new ChromeUserManagerImpl()); |
| 178 } | 178 } |
| 179 | 179 |
| 180 ChromeUserManagerImpl::ChromeUserManagerImpl() | 180 ChromeUserManagerImpl::ChromeUserManagerImpl() |
| 181 : ChromeUserManager(base::ThreadTaskRunnerHandle::Get()), | 181 : ChromeUserManager(base::ThreadTaskRunnerHandle::IsSet() |
| 182 ? base::ThreadTaskRunnerHandle::Get() |
| 183 : scoped_refptr<base::TaskRunner>()), |
| 182 cros_settings_(CrosSettings::Get()), | 184 cros_settings_(CrosSettings::Get()), |
| 183 device_local_account_policy_service_(NULL), | 185 device_local_account_policy_service_(NULL), |
| 184 supervised_user_manager_(new SupervisedUserManagerImpl(this)), | 186 supervised_user_manager_(new SupervisedUserManagerImpl(this)), |
| 185 bootstrap_manager_(new BootstrapManager(this)), | 187 bootstrap_manager_(new BootstrapManager(this)), |
| 186 weak_factory_(this) { | 188 weak_factory_(this) { |
| 187 UpdateNumberOfUsers(); | 189 UpdateNumberOfUsers(); |
| 188 | 190 |
| 189 // UserManager instance should be used only on UI thread. | 191 // UserManager instance should be used only on UI thread. |
| 190 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 192 // (or in unit tests) |
| 193 if (base::ThreadTaskRunnerHandle::IsSet()) |
| 194 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 195 |
| 191 registrar_.Add(this, | 196 registrar_.Add(this, |
| 192 chrome::NOTIFICATION_OWNERSHIP_STATUS_CHANGED, | 197 chrome::NOTIFICATION_OWNERSHIP_STATUS_CHANGED, |
| 193 content::NotificationService::AllSources()); | 198 content::NotificationService::AllSources()); |
| 194 registrar_.Add(this, | 199 registrar_.Add(this, |
| 195 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 200 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
| 196 content::NotificationService::AllSources()); | 201 content::NotificationService::AllSources()); |
| 197 registrar_.Add(this, | 202 registrar_.Add(this, |
| 198 chrome::NOTIFICATION_PROFILE_CREATED, | 203 chrome::NOTIFICATION_PROFILE_CREATED, |
| 199 content::NotificationService::AllSources()); | 204 content::NotificationService::AllSources()); |
| 200 | 205 |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 if (IsLoggedInAsUserWithGaiaAccount()) | 477 if (IsLoggedInAsUserWithGaiaAccount()) |
| 473 ManagerPasswordServiceFactory::GetForProfile(profile); | 478 ManagerPasswordServiceFactory::GetForProfile(profile); |
| 474 | 479 |
| 475 if (!profile->IsOffTheRecord()) { | 480 if (!profile->IsOffTheRecord()) { |
| 476 AuthSyncObserver* sync_observer = | 481 AuthSyncObserver* sync_observer = |
| 477 AuthSyncObserverFactory::GetInstance()->GetForProfile(profile); | 482 AuthSyncObserverFactory::GetInstance()->GetForProfile(profile); |
| 478 sync_observer->StartObserving(); | 483 sync_observer->StartObserving(); |
| 479 multi_profile_user_controller_->StartObserving(profile); | 484 multi_profile_user_controller_->StartObserving(profile); |
| 480 } | 485 } |
| 481 } | 486 } |
| 487 system::UpdateSystemTimezone(profile); |
| 482 UpdateUserTimeZoneRefresher(profile); | 488 UpdateUserTimeZoneRefresher(profile); |
| 483 break; | 489 break; |
| 484 } | 490 } |
| 485 case chrome::NOTIFICATION_PROFILE_CREATED: { | 491 case chrome::NOTIFICATION_PROFILE_CREATED: { |
| 486 Profile* profile = content::Source<Profile>(source).ptr(); | 492 Profile* profile = content::Source<Profile>(source).ptr(); |
| 487 user_manager::User* user = | 493 user_manager::User* user = |
| 488 ProfileHelper::Get()->GetUserByProfile(profile); | 494 ProfileHelper::Get()->GetUserByProfile(profile); |
| 489 if (user != NULL) { | 495 if (user != NULL) { |
| 490 user->set_profile_is_created(); | 496 user->set_profile_is_created(); |
| 491 | 497 |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1380 break; | 1386 break; |
| 1381 default: | 1387 default: |
| 1382 NOTREACHED(); | 1388 NOTREACHED(); |
| 1383 break; | 1389 break; |
| 1384 } | 1390 } |
| 1385 | 1391 |
| 1386 return user; | 1392 return user; |
| 1387 } | 1393 } |
| 1388 | 1394 |
| 1389 } // namespace chromeos | 1395 } // namespace chromeos |
| OLD | NEW |