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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/browser_process_platform_part.h" | 15 #include "chrome/browser/browser_process_platform_part.h" |
16 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
17 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 16 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
18 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" | 17 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" |
19 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 18 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
20 #include "components/policy/core/common/cloud/cloud_policy_core.h" | 19 #include "components/policy/core/common/cloud/cloud_policy_core.h" |
21 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 20 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
22 #include "components/policy/core/common/policy_map.h" | 21 #include "components/policy/core/common/policy_map.h" |
23 #include "components/policy/core/common/policy_types.h" | 22 #include "components/policy/core/common/policy_types.h" |
24 #include "components/user_manager/user.h" | 23 #include "components/user_manager/user.h" |
| 24 #include "components/user_manager/user_manager.h" |
25 #include "components/user_manager/user_type.h" | 25 #include "components/user_manager/user_type.h" |
26 #include "policy/policy_constants.h" | 26 #include "policy/policy_constants.h" |
27 | 27 |
28 namespace chromeos { | 28 namespace chromeos { |
29 | 29 |
30 ChromeUserSelectionScreen::ChromeUserSelectionScreen() | 30 ChromeUserSelectionScreen::ChromeUserSelectionScreen() |
31 : handler_initialized_(false), | 31 : handler_initialized_(false), |
32 weak_factory_(this) { | 32 weak_factory_(this) { |
33 device_local_account_policy_service_ = g_browser_process->platform_part()-> | 33 device_local_account_policy_service_ = g_browser_process->platform_part()-> |
34 browser_policy_connector_chromeos()->GetDeviceLocalAccountPolicyService(); | 34 browser_policy_connector_chromeos()->GetDeviceLocalAccountPolicyService(); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 if (new_recommended_locales != recommended_locales) { | 145 if (new_recommended_locales != recommended_locales) { |
146 // If the list of recommended locales has changed, update | 146 // If the list of recommended locales has changed, update |
147 // |public_session_recommended_locales_| and notify the UI. | 147 // |public_session_recommended_locales_| and notify the UI. |
148 recommended_locales = new_recommended_locales; | 148 recommended_locales = new_recommended_locales; |
149 SetPublicSessionLocales(user_id, &new_recommended_locales); | 149 SetPublicSessionLocales(user_id, &new_recommended_locales); |
150 } | 150 } |
151 } | 151 } |
152 | 152 |
153 void ChromeUserSelectionScreen::SetPublicSessionDisplayName( | 153 void ChromeUserSelectionScreen::SetPublicSessionDisplayName( |
154 const std::string& user_id) { | 154 const std::string& user_id) { |
155 const user_manager::User* user = UserManager::Get()->FindUser(user_id); | 155 const user_manager::User* user = |
| 156 user_manager::UserManager::Get()->FindUser(user_id); |
156 if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) | 157 if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) |
157 return; | 158 return; |
158 | 159 |
159 handler_->SetPublicSessionDisplayName( | 160 handler_->SetPublicSessionDisplayName( |
160 user_id, | 161 user_id, |
161 base::UTF16ToUTF8(user->GetDisplayName())); | 162 base::UTF16ToUTF8(user->GetDisplayName())); |
162 } | 163 } |
163 | 164 |
164 void ChromeUserSelectionScreen::SetPublicSessionLocales( | 165 void ChromeUserSelectionScreen::SetPublicSessionLocales( |
165 const std::string& user_id, | 166 const std::string& user_id, |
(...skipping 18 matching lines...) Expand all Loading... |
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 handler_->SetPublicSessionLocales(user_id, | 188 handler_->SetPublicSessionLocales(user_id, |
188 locales.Pass(), | 189 locales.Pass(), |
189 default_locale, | 190 default_locale, |
190 two_or_more_recommended_locales); | 191 two_or_more_recommended_locales); |
191 } | 192 } |
192 | 193 |
193 } // namespace chromeos | 194 } // namespace chromeos |
OLD | NEW |