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

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

Issue 1534173003: ChromeOS user_manager: move all KnownUser code to separate file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/FindUsingSAML/IsUsingSAML/ Created 5 years 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/user_selection_screen.h" 5 #include "chrome/browser/chromeos/login/screens/user_selection_screen.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/browser_process_platform_part.h" 12 #include "chrome/browser/browser_process_platform_part.h"
13 #include "chrome/browser/chromeos/login/lock/screen_locker.h" 13 #include "chrome/browser/chromeos/login/lock/screen_locker.h"
14 #include "chrome/browser/chromeos/login/reauth_stats.h" 14 #include "chrome/browser/chromeos/login/reauth_stats.h"
15 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" 15 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.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/login/users/chrome_user_manager.h" 17 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h"
18 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" 18 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h"
19 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 19 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
20 #include "chrome/browser/chromeos/profiles/profile_helper.h" 20 #include "chrome/browser/chromeos/profiles/profile_helper.h"
21 #include "chrome/browser/signin/easy_unlock_service.h" 21 #include "chrome/browser/signin/easy_unlock_service.h"
22 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" 22 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h"
23 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" 23 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
24 #include "components/proximity_auth/screenlock_bridge.h" 24 #include "components/proximity_auth/screenlock_bridge.h"
25 #include "components/signin/core/account_id/account_id.h" 25 #include "components/signin/core/account_id/account_id.h"
26 #include "components/user_manager/known_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 "ui/base/user_activity/user_activity_detector.h" 29 #include "ui/base/user_activity/user_activity_detector.h"
29 30
30 namespace chromeos { 31 namespace chromeos {
31 32
32 namespace { 33 namespace {
33 34
34 // User dictionary keys. 35 // User dictionary keys.
35 const char kKeyUsername[] = "username"; 36 const char kKeyUsername[] = "username";
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 if (is_public_session) { 166 if (is_public_session) {
166 AddPublicSessionDetailsToUserDictionaryEntry( 167 AddPublicSessionDetailsToUserDictionaryEntry(
167 user_dict, public_session_recommended_locales); 168 user_dict, public_session_recommended_locales);
168 } 169 }
169 } 170 }
170 171
171 // static 172 // static
172 void UserSelectionScreen::FillKnownUserPrefs(user_manager::User* user, 173 void UserSelectionScreen::FillKnownUserPrefs(user_manager::User* user,
173 base::DictionaryValue* user_dict) { 174 base::DictionaryValue* user_dict) {
174 std::string gaia_id; 175 std::string gaia_id;
175 if (user_manager::UserManager::Get()->FindGaiaID(user->GetAccountId(), 176 if (user_manager::known_user::FindGaiaID(user->GetAccountId(), &gaia_id)) {
176 &gaia_id)) {
177 user_dict->SetString(kKeyGaiaID, gaia_id); 177 user_dict->SetString(kKeyGaiaID, gaia_id);
178 } 178 }
179 } 179 }
180 180
181 // static 181 // static
182 void UserSelectionScreen::FillMultiProfileUserPrefs( 182 void UserSelectionScreen::FillMultiProfileUserPrefs(
183 user_manager::User* user, 183 user_manager::User* user,
184 base::DictionaryValue* user_dict, 184 base::DictionaryValue* user_dict,
185 bool is_signin_to_add) { 185 bool is_signin_to_add) {
186 const std::string& user_id = user->email(); 186 const std::string& user_id = user->email();
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 base::ListValue users_list; 342 base::ListValue users_list;
343 343
344 // TODO(nkostylev): Move to a separate method in UserManager. 344 // TODO(nkostylev): Move to a separate method in UserManager.
345 // http://crbug.com/230852 345 // http://crbug.com/230852
346 bool single_user = users_.size() == 1; 346 bool single_user = users_.size() == 1;
347 bool is_signin_to_add = LoginDisplayHostImpl::default_host() && 347 bool is_signin_to_add = LoginDisplayHostImpl::default_host() &&
348 user_manager::UserManager::Get()->IsUserLoggedIn(); 348 user_manager::UserManager::Get()->IsUserLoggedIn();
349 std::string owner_email; 349 std::string owner_email;
350 chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, 350 chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner,
351 &owner_email); 351 &owner_email);
352 const AccountId owner = user_manager::UserManager::GetKnownUserAccountId( 352 const AccountId owner =
353 owner_email, std::string()); 353 user_manager::known_user::GetAccountId(owner_email, std::string());
354 354
355 policy::BrowserPolicyConnectorChromeOS* connector = 355 policy::BrowserPolicyConnectorChromeOS* connector =
356 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 356 g_browser_process->platform_part()->browser_policy_connector_chromeos();
357 bool is_enterprise_managed = connector->IsEnterpriseManaged(); 357 bool is_enterprise_managed = connector->IsEnterpriseManaged();
358 358
359 const user_manager::UserList users_to_send = 359 const user_manager::UserList users_to_send =
360 PrepareUserListForSending(users_, owner, is_signin_to_add); 360 PrepareUserListForSending(users_, owner, is_signin_to_add);
361 361
362 user_auth_type_map_.clear(); 362 user_auth_type_map_.clear();
363 363
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 void UserSelectionScreen::HandleGetUsers() { 405 void UserSelectionScreen::HandleGetUsers() {
406 SendUserList(); 406 SendUserList();
407 } 407 }
408 408
409 void UserSelectionScreen::CheckUserStatus(const AccountId& account_id) { 409 void UserSelectionScreen::CheckUserStatus(const AccountId& account_id) {
410 // No checks on lock screen. 410 // No checks on lock screen.
411 if (ScreenLocker::default_screen_locker()) 411 if (ScreenLocker::default_screen_locker())
412 return; 412 return;
413 413
414 if (!token_handle_util_.get()) { 414 if (!token_handle_util_.get()) {
415 token_handle_util_.reset( 415 token_handle_util_.reset(new TokenHandleUtil());
416 new TokenHandleUtil(user_manager::UserManager::Get()));
417 } 416 }
418 417
419 if (token_handle_util_->HasToken(account_id)) { 418 if (token_handle_util_->HasToken(account_id)) {
420 token_handle_util_->CheckToken( 419 token_handle_util_->CheckToken(
421 account_id, base::Bind(&UserSelectionScreen::OnUserStatusChecked, 420 account_id, base::Bind(&UserSelectionScreen::OnUserStatusChecked,
422 weak_factory_.GetWeakPtr())); 421 weak_factory_.GetWeakPtr()));
423 } 422 }
424 } 423 }
425 424
426 void UserSelectionScreen::OnUserStatusChecked( 425 void UserSelectionScreen::OnUserStatusChecked(
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 // The user profile should exist if and only if this is the lock screen. 550 // The user profile should exist if and only if this is the lock screen.
552 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); 551 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN);
553 552
554 if (!profile) 553 if (!profile)
555 profile = profile_helper->GetSigninProfile(); 554 profile = profile_helper->GetSigninProfile();
556 555
557 return EasyUnlockService::Get(profile); 556 return EasyUnlockService::Get(profile);
558 } 557 }
559 558
560 } // namespace chromeos 559 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698