| 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/screens/chrome_user_selection_screen.h" | 5 #include "chrome/browser/chromeos/login/screens/chrome_user_selection_screen.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/location.h" | 11 #include "base/location.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/message_loop/message_loop.h" | 13 #include "base/single_thread_task_runner.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/threading/thread_task_runner_handle.h" |
| 15 #include "base/values.h" | 16 #include "base/values.h" |
| 16 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/browser_process_platform_part.h" | 18 #include "chrome/browser/browser_process_platform_part.h" |
| 18 #include "chrome/browser/chromeos/login/ui/views/user_board_view.h" | 19 #include "chrome/browser/chromeos/login/ui/views/user_board_view.h" |
| 19 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 20 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 20 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" | 21 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" |
| 21 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 22 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
| 22 #include "components/policy/core/common/cloud/cloud_policy_core.h" | 23 #include "components/policy/core/common/cloud/cloud_policy_core.h" |
| 23 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 24 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
| 24 #include "components/policy/core/common/policy_map.h" | 25 #include "components/policy/core/common/policy_map.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // If a new display name was set by policy, notify the UI about it. | 97 // If a new display name was set by policy, notify the UI about it. |
| 97 view_->SetPublicSessionDisplayName(account_id, display_name); | 98 view_->SetPublicSessionDisplayName(account_id, display_name); |
| 98 return; | 99 return; |
| 99 } | 100 } |
| 100 | 101 |
| 101 // When no display name is set by policy, the |User|, owned by |UserManager|, | 102 // When no display name is set by policy, the |User|, owned by |UserManager|, |
| 102 // decides what display name to use. However, the order in which |UserManager| | 103 // decides what display name to use. However, the order in which |UserManager| |
| 103 // and |this| are informed of the display name change is undefined. Post a | 104 // and |this| are informed of the display name change is undefined. Post a |
| 104 // task that will update the UI after the UserManager is guaranteed to have | 105 // task that will update the UI after the UserManager is guaranteed to have |
| 105 // been informed of the change. | 106 // been informed of the change. |
| 106 base::MessageLoop::current()->PostTask( | 107 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 107 FROM_HERE, | 108 FROM_HERE, |
| 108 base::Bind(&ChromeUserSelectionScreen::SetPublicSessionDisplayName, | 109 base::Bind(&ChromeUserSelectionScreen::SetPublicSessionDisplayName, |
| 109 weak_factory_.GetWeakPtr(), account_id)); | 110 weak_factory_.GetWeakPtr(), account_id)); |
| 110 } | 111 } |
| 111 | 112 |
| 112 void ChromeUserSelectionScreen::CheckForPublicSessionLocalePolicyChange( | 113 void ChromeUserSelectionScreen::CheckForPublicSessionLocalePolicyChange( |
| 113 policy::DeviceLocalAccountPolicyBroker* broker) { | 114 policy::DeviceLocalAccountPolicyBroker* broker) { |
| 114 const AccountId& account_id = | 115 const AccountId& account_id = |
| 115 user_manager::known_user::GetAccountId(broker->user_id(), std::string()); | 116 user_manager::known_user::GetAccountId(broker->user_id(), std::string()); |
| 116 DCHECK(account_id.is_valid()); | 117 DCHECK(account_id.is_valid()); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 // advanced form (two or more recommended locales). | 184 // advanced form (two or more recommended locales). |
| 184 const bool two_or_more_recommended_locales = recommended_locales.size() >= 2; | 185 const bool two_or_more_recommended_locales = recommended_locales.size() >= 2; |
| 185 | 186 |
| 186 // Notify the UI. | 187 // Notify the UI. |
| 187 view_->SetPublicSessionLocales(account_id, std::move(available_locales), | 188 view_->SetPublicSessionLocales(account_id, std::move(available_locales), |
| 188 default_locale, | 189 default_locale, |
| 189 two_or_more_recommended_locales); | 190 two_or_more_recommended_locales); |
| 190 } | 191 } |
| 191 | 192 |
| 192 } // namespace chromeos | 193 } // namespace chromeos |
| OLD | NEW |