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

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

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

Powered by Google App Engine
This is Rietveld 408576698