| 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> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "ash/multi_profile_uma.h" | 13 #include "ash/multi_profile_uma.h" |
| 14 #include "base/bind.h" | 14 #include "base/bind.h" |
| 15 #include "base/bind_helpers.h" | 15 #include "base/bind_helpers.h" |
| 16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
| 18 #include "base/format_macros.h" | 18 #include "base/format_macros.h" |
| 19 #include "base/location.h" |
| 19 #include "base/logging.h" | 20 #include "base/logging.h" |
| 20 #include "base/memory/ptr_util.h" | 21 #include "base/memory/ptr_util.h" |
| 21 #include "base/metrics/histogram.h" | 22 #include "base/metrics/histogram.h" |
| 23 #include "base/single_thread_task_runner.h" |
| 22 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" |
| 23 #include "base/strings/stringprintf.h" | 25 #include "base/strings/stringprintf.h" |
| 24 #include "base/strings/utf_string_conversions.h" | 26 #include "base/strings/utf_string_conversions.h" |
| 25 #include "base/sys_info.h" | 27 #include "base/sys_info.h" |
| 26 #include "base/task_runner.h" | 28 #include "base/task_runner.h" |
| 27 #include "base/threading/thread_task_runner_handle.h" | 29 #include "base/threading/thread_task_runner_handle.h" |
| 28 #include "base/values.h" | 30 #include "base/values.h" |
| 29 #include "chrome/browser/browser_process.h" | 31 #include "chrome/browser/browser_process.h" |
| 30 #include "chrome/browser/chrome_notification_types.h" | 32 #include "chrome/browser/chrome_notification_types.h" |
| 31 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" | 33 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 content::NotificationService::AllSources()); | 183 content::NotificationService::AllSources()); |
| 182 registrar_.Add(this, | 184 registrar_.Add(this, |
| 183 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 185 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
| 184 content::NotificationService::AllSources()); | 186 content::NotificationService::AllSources()); |
| 185 registrar_.Add(this, | 187 registrar_.Add(this, |
| 186 chrome::NOTIFICATION_PROFILE_CREATED, | 188 chrome::NOTIFICATION_PROFILE_CREATED, |
| 187 content::NotificationService::AllSources()); | 189 content::NotificationService::AllSources()); |
| 188 | 190 |
| 189 // Since we're in ctor postpone any actions till this is fully created. | 191 // Since we're in ctor postpone any actions till this is fully created. |
| 190 if (base::MessageLoop::current()) { | 192 if (base::MessageLoop::current()) { |
| 191 base::MessageLoop::current()->PostTask( | 193 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 192 FROM_HERE, | 194 FROM_HERE, |
| 193 base::Bind(&ChromeUserManagerImpl::RetrieveTrustedDevicePolicies, | 195 base::Bind(&ChromeUserManagerImpl::RetrieveTrustedDevicePolicies, |
| 194 weak_factory_.GetWeakPtr())); | 196 weak_factory_.GetWeakPtr())); |
| 195 } | 197 } |
| 196 | 198 |
| 197 local_accounts_subscription_ = cros_settings_->AddSettingsObserver( | 199 local_accounts_subscription_ = cros_settings_->AddSettingsObserver( |
| 198 kAccountsPrefDeviceLocalAccounts, | 200 kAccountsPrefDeviceLocalAccounts, |
| 199 base::Bind(&ChromeUserManagerImpl::RetrieveTrustedDevicePolicies, | 201 base::Bind(&ChromeUserManagerImpl::RetrieveTrustedDevicePolicies, |
| 200 weak_factory_.GetWeakPtr())); | 202 weak_factory_.GetWeakPtr())); |
| 201 multi_profile_user_controller_.reset( | 203 multi_profile_user_controller_.reset( |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 if (user->HasGaiaAccount()) | 468 if (user->HasGaiaAccount()) |
| 467 GetUserImageManager(user->GetAccountId())->UserProfileCreated(); | 469 GetUserImageManager(user->GetAccountId())->UserProfileCreated(); |
| 468 } | 470 } |
| 469 | 471 |
| 470 // If there is pending user switch, do it now. | 472 // If there is pending user switch, do it now. |
| 471 if (GetPendingUserSwitchID().is_valid()) { | 473 if (GetPendingUserSwitchID().is_valid()) { |
| 472 // Call SwitchActiveUser async because otherwise it may cause | 474 // Call SwitchActiveUser async because otherwise it may cause |
| 473 // ProfileManager::GetProfile before the profile gets registered | 475 // ProfileManager::GetProfile before the profile gets registered |
| 474 // in ProfileManager. It happens in case of sync profile load when | 476 // in ProfileManager. It happens in case of sync profile load when |
| 475 // NOTIFICATION_PROFILE_CREATED is called synchronously. | 477 // NOTIFICATION_PROFILE_CREATED is called synchronously. |
| 476 base::MessageLoop::current()->PostTask( | 478 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 477 FROM_HERE, | 479 FROM_HERE, |
| 478 base::Bind(&ChromeUserManagerImpl::SwitchActiveUser, | 480 base::Bind(&ChromeUserManagerImpl::SwitchActiveUser, |
| 479 weak_factory_.GetWeakPtr(), | 481 weak_factory_.GetWeakPtr(), GetPendingUserSwitchID())); |
| 480 GetPendingUserSwitchID())); | |
| 481 SetPendingUserSwitchId(EmptyAccountId()); | 482 SetPendingUserSwitchId(EmptyAccountId()); |
| 482 } | 483 } |
| 483 break; | 484 break; |
| 484 } | 485 } |
| 485 default: | 486 default: |
| 486 NOTREACHED(); | 487 NOTREACHED(); |
| 487 } | 488 } |
| 488 } | 489 } |
| 489 | 490 |
| 490 void ChromeUserManagerImpl::OnExternalDataSet(const std::string& policy, | 491 void ChromeUserManagerImpl::OnExternalDataSet(const std::string& policy, |
| (...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1322 break; | 1323 break; |
| 1323 default: | 1324 default: |
| 1324 NOTREACHED(); | 1325 NOTREACHED(); |
| 1325 break; | 1326 break; |
| 1326 } | 1327 } |
| 1327 | 1328 |
| 1328 return user; | 1329 return user; |
| 1329 } | 1330 } |
| 1330 | 1331 |
| 1331 } // namespace chromeos | 1332 } // namespace chromeos |
| OLD | NEW |