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/ui/views/user_board_view.h" | 16 #include "chrome/browser/chromeos/login/ui/views/user_board_view.h" |
17 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 17 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
18 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" | 18 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" |
19 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 19 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
20 #include "components/policy/core/common/cloud/cloud_policy_core.h" | 20 #include "components/policy/core/common/cloud/cloud_policy_core.h" |
21 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 21 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
22 #include "components/policy/core/common/policy_map.h" | 22 #include "components/policy/core/common/policy_map.h" |
23 #include "components/policy/core/common/policy_types.h" | 23 #include "components/policy/core/common/policy_types.h" |
24 #include "components/signin/core/account_id/account_id.h" | 24 #include "components/signin/core/account_id/account_id.h" |
| 25 #include "components/user_manager/known_user.h" |
25 #include "components/user_manager/user.h" | 26 #include "components/user_manager/user.h" |
26 #include "components/user_manager/user_manager.h" | 27 #include "components/user_manager/user_manager.h" |
27 #include "components/user_manager/user_type.h" | 28 #include "components/user_manager/user_type.h" |
28 #include "policy/policy_constants.h" | 29 #include "policy/policy_constants.h" |
29 | 30 |
30 namespace chromeos { | 31 namespace chromeos { |
31 | 32 |
32 ChromeUserSelectionScreen::ChromeUserSelectionScreen( | 33 ChromeUserSelectionScreen::ChromeUserSelectionScreen( |
33 const std::string& display_type) | 34 const std::string& display_type) |
34 : UserSelectionScreen(display_type), | 35 : UserSelectionScreen(display_type), |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 } | 72 } |
72 | 73 |
73 void ChromeUserSelectionScreen::OnDeviceLocalAccountsChanged() { | 74 void ChromeUserSelectionScreen::OnDeviceLocalAccountsChanged() { |
74 // Nothing to do here. When the list of device-local accounts changes, the | 75 // Nothing to do here. When the list of device-local accounts changes, the |
75 // entire UI is reloaded. | 76 // entire UI is reloaded. |
76 } | 77 } |
77 | 78 |
78 void ChromeUserSelectionScreen::CheckForPublicSessionDisplayNameChange( | 79 void ChromeUserSelectionScreen::CheckForPublicSessionDisplayNameChange( |
79 policy::DeviceLocalAccountPolicyBroker* broker) { | 80 policy::DeviceLocalAccountPolicyBroker* broker) { |
80 const AccountId& account_id = | 81 const AccountId& account_id = |
81 user_manager::UserManager::GetKnownUserAccountId(broker->user_id(), | 82 user_manager::known_user::GetAccountId(broker->user_id(), std::string()); |
82 std::string()); | |
83 DCHECK(account_id.is_valid()); | 83 DCHECK(account_id.is_valid()); |
84 const std::string& display_name = broker->GetDisplayName(); | 84 const std::string& display_name = broker->GetDisplayName(); |
85 if (display_name == public_session_display_names_[account_id]) | 85 if (display_name == public_session_display_names_[account_id]) |
86 return; | 86 return; |
87 | 87 |
88 public_session_display_names_[account_id] = display_name; | 88 public_session_display_names_[account_id] = display_name; |
89 | 89 |
90 if (!handler_initialized_) | 90 if (!handler_initialized_) |
91 return; | 91 return; |
92 | 92 |
(...skipping 10 matching lines...) Expand all Loading... |
103 // been informed of the change. | 103 // been informed of the change. |
104 base::MessageLoop::current()->PostTask( | 104 base::MessageLoop::current()->PostTask( |
105 FROM_HERE, | 105 FROM_HERE, |
106 base::Bind(&ChromeUserSelectionScreen::SetPublicSessionDisplayName, | 106 base::Bind(&ChromeUserSelectionScreen::SetPublicSessionDisplayName, |
107 weak_factory_.GetWeakPtr(), account_id)); | 107 weak_factory_.GetWeakPtr(), account_id)); |
108 } | 108 } |
109 | 109 |
110 void ChromeUserSelectionScreen::CheckForPublicSessionLocalePolicyChange( | 110 void ChromeUserSelectionScreen::CheckForPublicSessionLocalePolicyChange( |
111 policy::DeviceLocalAccountPolicyBroker* broker) { | 111 policy::DeviceLocalAccountPolicyBroker* broker) { |
112 const AccountId& account_id = | 112 const AccountId& account_id = |
113 user_manager::UserManager::GetKnownUserAccountId(broker->user_id(), | 113 user_manager::known_user::GetAccountId(broker->user_id(), std::string()); |
114 std::string()); | |
115 DCHECK(account_id.is_valid()); | 114 DCHECK(account_id.is_valid()); |
116 const policy::PolicyMap::Entry* entry = | 115 const policy::PolicyMap::Entry* entry = |
117 broker->core()->store()->policy_map().Get(policy::key::kSessionLocales); | 116 broker->core()->store()->policy_map().Get(policy::key::kSessionLocales); |
118 | 117 |
119 // Parse the list of recommended locales set by policy. | 118 // Parse the list of recommended locales set by policy. |
120 std::vector<std::string> new_recommended_locales; | 119 std::vector<std::string> new_recommended_locales; |
121 base::ListValue const* list = NULL; | 120 base::ListValue const* list = NULL; |
122 if (entry && | 121 if (entry && |
123 entry->level == policy::POLICY_LEVEL_RECOMMENDED && | 122 entry->level == policy::POLICY_LEVEL_RECOMMENDED && |
124 entry->value && | 123 entry->value && |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // advanced form (two or more recommended locales). | 181 // advanced form (two or more recommended locales). |
183 const bool two_or_more_recommended_locales = recommended_locales.size() >= 2; | 182 const bool two_or_more_recommended_locales = recommended_locales.size() >= 2; |
184 | 183 |
185 // Notify the UI. | 184 // Notify the UI. |
186 view_->SetPublicSessionLocales(account_id, available_locales.Pass(), | 185 view_->SetPublicSessionLocales(account_id, available_locales.Pass(), |
187 default_locale, | 186 default_locale, |
188 two_or_more_recommended_locales); | 187 two_or_more_recommended_locales); |
189 } | 188 } |
190 | 189 |
191 } // namespace chromeos | 190 } // namespace chromeos |
OLD | NEW |