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

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

Issue 1425093004: Revert of This CL replaces user_manager::UserID with AccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@468875--Chrome-OS-handles-deletion-of-Gmail-account-poorly--Create-AccountID-structure-part2--user_names
Patch Set: Created 5 years, 1 month 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 "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"
25 #include "components/user_manager/user.h" 24 #include "components/user_manager/user.h"
26 #include "components/user_manager/user_manager.h" 25 #include "components/user_manager/user_manager.h"
27 #include "components/user_manager/user_type.h" 26 #include "components/user_manager/user_type.h"
28 #include "policy/policy_constants.h" 27 #include "policy/policy_constants.h"
29 28
30 namespace chromeos { 29 namespace chromeos {
31 30
32 ChromeUserSelectionScreen::ChromeUserSelectionScreen( 31 ChromeUserSelectionScreen::ChromeUserSelectionScreen(
33 const std::string& display_type) 32 const std::string& display_type)
34 : UserSelectionScreen(display_type), 33 : UserSelectionScreen(display_type),
35 handler_initialized_(false), 34 handler_initialized_(false),
36 weak_factory_(this) { 35 weak_factory_(this) {
37 device_local_account_policy_service_ = g_browser_process->platform_part()-> 36 device_local_account_policy_service_ = g_browser_process->platform_part()->
38 browser_policy_connector_chromeos()->GetDeviceLocalAccountPolicyService(); 37 browser_policy_connector_chromeos()->GetDeviceLocalAccountPolicyService();
39 device_local_account_policy_service_->AddObserver(this); 38 device_local_account_policy_service_->AddObserver(this);
40 } 39 }
41 40
42 ChromeUserSelectionScreen::~ChromeUserSelectionScreen() { 41 ChromeUserSelectionScreen::~ChromeUserSelectionScreen() {
43 device_local_account_policy_service_->RemoveObserver(this); 42 device_local_account_policy_service_->RemoveObserver(this);
44 } 43 }
45 44
46 void ChromeUserSelectionScreen::Init(const user_manager::UserList& users, 45 void ChromeUserSelectionScreen::Init(const user_manager::UserList& users,
47 bool show_guest) { 46 bool show_guest) {
48 UserSelectionScreen::Init(users, show_guest); 47 UserSelectionScreen::Init(users, show_guest);
49 48
50 // Retrieve the current policy for all users. 49 // Retrieve the current policy for all users.
51 for (user_manager::UserList::const_iterator it = users.begin(); 50 for (user_manager::UserList::const_iterator it = users.begin();
52 it != users.end(); ++it) { 51 it != users.end(); ++it) {
53 if ((*it)->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) 52 if ((*it)->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT)
54 OnPolicyUpdated((*it)->GetAccountId().GetUserEmail()); 53 OnPolicyUpdated((*it)->GetUserID());
55 } 54 }
56 } 55 }
57 56
58 void ChromeUserSelectionScreen::SendUserList() { 57 void ChromeUserSelectionScreen::SendUserList() {
59 UserSelectionScreen::SendUserList(); 58 UserSelectionScreen::SendUserList();
60 handler_initialized_ = true; 59 handler_initialized_ = true;
61 } 60 }
62 61
63 void ChromeUserSelectionScreen::OnPolicyUpdated(const std::string& user_id) { 62 void ChromeUserSelectionScreen::OnPolicyUpdated(const std::string& user_id) {
64 policy::DeviceLocalAccountPolicyBroker* broker = 63 policy::DeviceLocalAccountPolicyBroker* broker =
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 SetPublicSessionLocales(user_id, new_recommended_locales); 136 SetPublicSessionLocales(user_id, new_recommended_locales);
138 137
139 if (new_recommended_locales.empty()) 138 if (new_recommended_locales.empty())
140 public_session_recommended_locales_.erase(user_id); 139 public_session_recommended_locales_.erase(user_id);
141 else 140 else
142 recommended_locales = new_recommended_locales; 141 recommended_locales = new_recommended_locales;
143 } 142 }
144 143
145 void ChromeUserSelectionScreen::SetPublicSessionDisplayName( 144 void ChromeUserSelectionScreen::SetPublicSessionDisplayName(
146 const std::string& user_id) { 145 const std::string& user_id) {
147 const user_manager::User* user = user_manager::UserManager::Get()->FindUser( 146 const user_manager::User* user =
148 AccountId::FromUserEmail(user_id)); 147 user_manager::UserManager::Get()->FindUser(user_id);
149 if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) 148 if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT)
150 return; 149 return;
151 150
152 view_->SetPublicSessionDisplayName(user_id, 151 view_->SetPublicSessionDisplayName(user_id,
153 base::UTF16ToUTF8(user->GetDisplayName())); 152 base::UTF16ToUTF8(user->GetDisplayName()));
154 } 153 }
155 154
156 void ChromeUserSelectionScreen::SetPublicSessionLocales( 155 void ChromeUserSelectionScreen::SetPublicSessionLocales(
157 const std::string& user_id, 156 const std::string& user_id,
158 const std::vector<std::string>& recommended_locales) { 157 const std::vector<std::string>& recommended_locales) {
(...skipping 18 matching lines...) Expand all
177 // advanced form (two or more recommended locales). 176 // advanced form (two or more recommended locales).
178 const bool two_or_more_recommended_locales = recommended_locales.size() >= 2; 177 const bool two_or_more_recommended_locales = recommended_locales.size() >= 2;
179 178
180 // Notify the UI. 179 // Notify the UI.
181 view_->SetPublicSessionLocales(user_id, available_locales.Pass(), 180 view_->SetPublicSessionLocales(user_id, available_locales.Pass(),
182 default_locale, 181 default_locale,
183 two_or_more_recommended_locales); 182 two_or_more_recommended_locales);
184 } 183 }
185 184
186 } // namespace chromeos 185 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698