Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: chrome/browser/chromeos/login/screens/chrome_user_selection_screen.cc

Issue 2593133002: Revert of Add account_type into AccountId (Closed)
Patch Set: Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 CheckForPublicSessionLocalePolicyChange(broker); 78 CheckForPublicSessionLocalePolicyChange(broker);
79 } 79 }
80 80
81 void ChromeUserSelectionScreen::OnDeviceLocalAccountsChanged() { 81 void ChromeUserSelectionScreen::OnDeviceLocalAccountsChanged() {
82 // Nothing to do here. When the list of device-local accounts changes, the 82 // Nothing to do here. When the list of device-local accounts changes, the
83 // entire UI is reloaded. 83 // entire UI is reloaded.
84 } 84 }
85 85
86 void ChromeUserSelectionScreen::CheckForPublicSessionDisplayNameChange( 86 void ChromeUserSelectionScreen::CheckForPublicSessionDisplayNameChange(
87 policy::DeviceLocalAccountPolicyBroker* broker) { 87 policy::DeviceLocalAccountPolicyBroker* broker) {
88 const AccountId& account_id = user_manager::known_user::GetAccountId( 88 const AccountId& account_id =
89 broker->user_id(), std::string() /* id */, AccountType::UNKNOWN); 89 user_manager::known_user::GetAccountId(broker->user_id(), std::string());
90 DCHECK(account_id.is_valid()); 90 DCHECK(account_id.is_valid());
91 const std::string& display_name = broker->GetDisplayName(); 91 const std::string& display_name = broker->GetDisplayName();
92 if (display_name == public_session_display_names_[account_id]) 92 if (display_name == public_session_display_names_[account_id])
93 return; 93 return;
94 94
95 public_session_display_names_[account_id] = display_name; 95 public_session_display_names_[account_id] = display_name;
96 96
97 if (!handler_initialized_) 97 if (!handler_initialized_)
98 return; 98 return;
99 99
100 if (!display_name.empty()) { 100 if (!display_name.empty()) {
101 // If a new display name was set by policy, notify the UI about it. 101 // If a new display name was set by policy, notify the UI about it.
102 view_->SetPublicSessionDisplayName(account_id, display_name); 102 view_->SetPublicSessionDisplayName(account_id, display_name);
103 return; 103 return;
104 } 104 }
105 105
106 // When no display name is set by policy, the |User|, owned by |UserManager|, 106 // When no display name is set by policy, the |User|, owned by |UserManager|,
107 // decides what display name to use. However, the order in which |UserManager| 107 // decides what display name to use. However, the order in which |UserManager|
108 // and |this| are informed of the display name change is undefined. Post a 108 // and |this| are informed of the display name change is undefined. Post a
109 // task that will update the UI after the UserManager is guaranteed to have 109 // task that will update the UI after the UserManager is guaranteed to have
110 // been informed of the change. 110 // been informed of the change.
111 base::ThreadTaskRunnerHandle::Get()->PostTask( 111 base::ThreadTaskRunnerHandle::Get()->PostTask(
112 FROM_HERE, 112 FROM_HERE,
113 base::Bind(&ChromeUserSelectionScreen::SetPublicSessionDisplayName, 113 base::Bind(&ChromeUserSelectionScreen::SetPublicSessionDisplayName,
114 weak_factory_.GetWeakPtr(), account_id)); 114 weak_factory_.GetWeakPtr(), account_id));
115 } 115 }
116 116
117 void ChromeUserSelectionScreen::CheckForPublicSessionLocalePolicyChange( 117 void ChromeUserSelectionScreen::CheckForPublicSessionLocalePolicyChange(
118 policy::DeviceLocalAccountPolicyBroker* broker) { 118 policy::DeviceLocalAccountPolicyBroker* broker) {
119 const AccountId& account_id = user_manager::known_user::GetAccountId( 119 const AccountId& account_id =
120 broker->user_id(), std::string() /* id */, AccountType::UNKNOWN); 120 user_manager::known_user::GetAccountId(broker->user_id(), std::string());
121 DCHECK(account_id.is_valid()); 121 DCHECK(account_id.is_valid());
122 const policy::PolicyMap::Entry* entry = 122 const policy::PolicyMap::Entry* entry =
123 broker->core()->store()->policy_map().Get(policy::key::kSessionLocales); 123 broker->core()->store()->policy_map().Get(policy::key::kSessionLocales);
124 124
125 // Parse the list of recommended locales set by policy. 125 // Parse the list of recommended locales set by policy.
126 std::vector<std::string> new_recommended_locales; 126 std::vector<std::string> new_recommended_locales;
127 base::ListValue const* list = NULL; 127 base::ListValue const* list = NULL;
128 if (entry && 128 if (entry &&
129 entry->level == policy::POLICY_LEVEL_RECOMMENDED && 129 entry->level == policy::POLICY_LEVEL_RECOMMENDED &&
130 entry->value && 130 entry->value &&
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 // advanced form (two or more recommended locales). 188 // advanced form (two or more recommended locales).
189 const bool two_or_more_recommended_locales = recommended_locales.size() >= 2; 189 const bool two_or_more_recommended_locales = recommended_locales.size() >= 2;
190 190
191 // Notify the UI. 191 // Notify the UI.
192 view_->SetPublicSessionLocales(account_id, std::move(available_locales), 192 view_->SetPublicSessionLocales(account_id, std::move(available_locales),
193 default_locale, 193 default_locale,
194 two_or_more_recommended_locales); 194 two_or_more_recommended_locales);
195 } 195 }
196 196
197 } // namespace chromeos 197 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698