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 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1380 break; | 1385 break; |
1381 default: | 1386 default: |
1382 NOTREACHED(); | 1387 NOTREACHED(); |
1383 break; | 1388 break; |
1384 } | 1389 } |
1385 | 1390 |
1386 return user; | 1391 return user; |
1387 } | 1392 } |
1388 | 1393 |
1389 } // namespace chromeos | 1394 } // namespace chromeos |
OLD | NEW |