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

Side by Side Diff: chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc

Issue 2452983002: ChromeOS: This CL moves chromeos/login/user_names* to user_mananger. (Closed)
Patch Set: Removed unused #includes Created 4 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/users/chrome_user_manager_impl.h" 5 #include "chrome/browser/chromeos/login/users/chrome_user_manager_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cstddef> 9 #include <cstddef>
10 #include <set> 10 #include <set>
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "chrome/browser/supervised_user/chromeos/manager_password_service_facto ry.h" 53 #include "chrome/browser/supervised_user/chromeos/manager_password_service_facto ry.h"
54 #include "chrome/browser/supervised_user/chromeos/supervised_user_password_servi ce_factory.h" 54 #include "chrome/browser/supervised_user/chromeos/supervised_user_password_servi ce_factory.h"
55 #include "chrome/common/chrome_constants.h" 55 #include "chrome/common/chrome_constants.h"
56 #include "chrome/common/chrome_switches.h" 56 #include "chrome/common/chrome_switches.h"
57 #include "chrome/common/crash_keys.h" 57 #include "chrome/common/crash_keys.h"
58 #include "chrome/common/pref_names.h" 58 #include "chrome/common/pref_names.h"
59 #include "chrome/grit/theme_resources.h" 59 #include "chrome/grit/theme_resources.h"
60 #include "chromeos/chromeos_switches.h" 60 #include "chromeos/chromeos_switches.h"
61 #include "chromeos/cryptohome/async_method_caller.h" 61 #include "chromeos/cryptohome/async_method_caller.h"
62 #include "chromeos/login/login_state.h" 62 #include "chromeos/login/login_state.h"
63 #include "chromeos/login/user_names.h"
64 #include "chromeos/settings/cros_settings_names.h" 63 #include "chromeos/settings/cros_settings_names.h"
65 #include "chromeos/timezone/timezone_resolver.h" 64 #include "chromeos/timezone/timezone_resolver.h"
66 #include "components/policy/policy_constants.h" 65 #include "components/policy/policy_constants.h"
67 #include "components/prefs/pref_registry_simple.h" 66 #include "components/prefs/pref_registry_simple.h"
68 #include "components/prefs/pref_service.h" 67 #include "components/prefs/pref_service.h"
69 #include "components/prefs/scoped_user_pref_update.h" 68 #include "components/prefs/scoped_user_pref_update.h"
70 #include "components/session_manager/core/session_manager.h" 69 #include "components/session_manager/core/session_manager.h"
71 #include "components/signin/core/account_id/account_id.h" 70 #include "components/signin/core/account_id/account_id.h"
72 #include "components/user_manager/known_user.h" 71 #include "components/user_manager/known_user.h"
73 #include "components/user_manager/remove_user_delegate.h" 72 #include "components/user_manager/remove_user_delegate.h"
74 #include "components/user_manager/user.h" 73 #include "components/user_manager/user.h"
75 #include "components/user_manager/user_image/user_image.h" 74 #include "components/user_manager/user_image/user_image.h"
75 #include "components/user_manager/user_names.h"
76 #include "components/user_manager/user_type.h" 76 #include "components/user_manager/user_type.h"
77 #include "content/public/browser/browser_thread.h" 77 #include "content/public/browser/browser_thread.h"
78 #include "content/public/browser/notification_service.h" 78 #include "content/public/browser/notification_service.h"
79 #include "extensions/common/features/feature_session_type.h" 79 #include "extensions/common/features/feature_session_type.h"
80 #include "ui/base/l10n/l10n_util.h" 80 #include "ui/base/l10n/l10n_util.h"
81 #include "ui/base/resource/resource_bundle.h" 81 #include "ui/base/resource/resource_bundle.h"
82 #include "ui/chromeos/resources/grit/ui_chromeos_resources.h" 82 #include "ui/chromeos/resources/grit/ui_chromeos_resources.h"
83 #include "ui/chromeos/strings/grit/ui_chromeos_strings.h" 83 #include "ui/chromeos/strings/grit/ui_chromeos_strings.h"
84 #include "ui/gfx/image/image_skia.h" 84 #include "ui/gfx/image/image_skia.h"
85 #include "ui/wm/core/wm_core_switches.h" 85 #include "ui/wm/core/wm_core_switches.h"
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 // TODO(nkostylev): Add support for passing guest session cryptohome 721 // TODO(nkostylev): Add support for passing guest session cryptohome
722 // mount point. Legacy (--login-profile) value will be used for now. 722 // mount point. Legacy (--login-profile) value will be used for now.
723 // http://crosbug.com/230859 723 // http://crosbug.com/230859
724 active_user_->SetStubImage( 724 active_user_->SetStubImage(
725 base::MakeUnique<user_manager::UserImage>( 725 base::MakeUnique<user_manager::UserImage>(
726 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 726 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
727 IDR_PROFILE_PICTURE_LOADING)), 727 IDR_PROFILE_PICTURE_LOADING)),
728 user_manager::User::USER_IMAGE_INVALID, false); 728 user_manager::User::USER_IMAGE_INVALID, false);
729 729
730 // Initializes wallpaper after active_user_ is set. 730 // Initializes wallpaper after active_user_ is set.
731 WallpaperManager::Get()->SetUserWallpaperNow(login::GuestAccountId()); 731 WallpaperManager::Get()->SetUserWallpaperNow(user_manager::GuestAccountId());
732 } 732 }
733 733
734 void ChromeUserManagerImpl::RegularUserLoggedIn(const AccountId& account_id) { 734 void ChromeUserManagerImpl::RegularUserLoggedIn(const AccountId& account_id) {
735 ChromeUserManager::RegularUserLoggedIn(account_id); 735 ChromeUserManager::RegularUserLoggedIn(account_id);
736 736
737 if (FakeOwnership()) { 737 if (FakeOwnership()) {
738 const AccountId owner_account_id = GetActiveUser()->GetAccountId(); 738 const AccountId owner_account_id = GetActiveUser()->GetAccountId();
739 VLOG(1) << "Set device owner to: " << owner_account_id.GetUserEmail(); 739 VLOG(1) << "Set device owner to: " << owner_account_id.GetUserEmail();
740 CrosSettings::Get()->SetString(kDeviceOwner, 740 CrosSettings::Get()->SetString(kDeviceOwner,
741 owner_account_id.GetUserEmail()); 741 owner_account_id.GetUserEmail());
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 command_line->AppendSwitch(::switches::kForceAppMode); 861 command_line->AppendSwitch(::switches::kForceAppMode);
862 command_line->AppendSwitchASCII(::switches::kAppId, kiosk_app_id); 862 command_line->AppendSwitchASCII(::switches::kAppId, kiosk_app_id);
863 863
864 // Disable window animation since kiosk app runs in a single full screen 864 // Disable window animation since kiosk app runs in a single full screen
865 // window and window animation causes start-up janks. 865 // window and window animation causes start-up janks.
866 command_line->AppendSwitch(wm::switches::kWindowAnimationsDisabled); 866 command_line->AppendSwitch(wm::switches::kWindowAnimationsDisabled);
867 } 867 }
868 868
869 void ChromeUserManagerImpl::DemoAccountLoggedIn() { 869 void ChromeUserManagerImpl::DemoAccountLoggedIn() {
870 DCHECK_CURRENTLY_ON(BrowserThread::UI); 870 DCHECK_CURRENTLY_ON(BrowserThread::UI);
871 active_user_ = user_manager::User::CreateKioskAppUser(login::DemoAccountId()); 871 active_user_ =
872 user_manager::User::CreateKioskAppUser(user_manager::DemoAccountId());
872 active_user_->SetStubImage( 873 active_user_->SetStubImage(
873 base::MakeUnique<user_manager::UserImage>( 874 base::MakeUnique<user_manager::UserImage>(
874 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 875 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
875 IDR_PROFILE_PICTURE_LOADING)), 876 IDR_PROFILE_PICTURE_LOADING)),
876 user_manager::User::USER_IMAGE_INVALID, false); 877 user_manager::User::USER_IMAGE_INVALID, false);
877 WallpaperManager::Get()->SetUserWallpaperNow(login::DemoAccountId()); 878 WallpaperManager::Get()->SetUserWallpaperNow(user_manager::DemoAccountId());
878 879
879 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 880 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
880 command_line->AppendSwitch(::switches::kForceAppMode); 881 command_line->AppendSwitch(::switches::kForceAppMode);
881 command_line->AppendSwitchASCII(::switches::kAppId, 882 command_line->AppendSwitchASCII(::switches::kAppId,
882 DemoAppLauncher::kDemoAppId); 883 DemoAppLauncher::kDemoAppId);
883 884
884 // Disable window animation since the demo app runs in a single full screen 885 // Disable window animation since the demo app runs in a single full screen
885 // window and window animation causes start-up janks. 886 // window and window animation causes start-up janks.
886 base::CommandLine::ForCurrentProcess()->AppendSwitch( 887 base::CommandLine::ForCurrentProcess()->AppendSwitch(
887 wm::switches::kWindowAnimationsDisabled); 888 wm::switches::kWindowAnimationsDisabled);
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 1247
1247 bool ChromeUserManagerImpl::GetPlatformKnownUserId( 1248 bool ChromeUserManagerImpl::GetPlatformKnownUserId(
1248 const std::string& user_email, 1249 const std::string& user_email,
1249 const std::string& gaia_id, 1250 const std::string& gaia_id,
1250 AccountId* out_account_id) const { 1251 AccountId* out_account_id) const {
1251 return chrome_user_manager_util::GetPlatformKnownUserId(user_email, gaia_id, 1252 return chrome_user_manager_util::GetPlatformKnownUserId(user_email, gaia_id,
1252 out_account_id); 1253 out_account_id);
1253 } 1254 }
1254 1255
1255 const AccountId& ChromeUserManagerImpl::GetGuestAccountId() const { 1256 const AccountId& ChromeUserManagerImpl::GetGuestAccountId() const {
1256 return login::GuestAccountId(); 1257 return user_manager::GuestAccountId();
1257 } 1258 }
1258 1259
1259 bool ChromeUserManagerImpl::IsFirstExecAfterBoot() const { 1260 bool ChromeUserManagerImpl::IsFirstExecAfterBoot() const {
1260 return base::CommandLine::ForCurrentProcess()->HasSwitch( 1261 return base::CommandLine::ForCurrentProcess()->HasSwitch(
1261 chromeos::switches::kFirstExecAfterBoot); 1262 chromeos::switches::kFirstExecAfterBoot);
1262 } 1263 }
1263 1264
1264 void ChromeUserManagerImpl::AsyncRemoveCryptohome( 1265 void ChromeUserManagerImpl::AsyncRemoveCryptohome(
1265 const AccountId& account_id) const { 1266 const AccountId& account_id) const {
1266 cryptohome::AsyncMethodCaller::GetInstance()->AsyncRemove( 1267 cryptohome::AsyncMethodCaller::GetInstance()->AsyncRemove(
1267 cryptohome::Identification(account_id), 1268 cryptohome::Identification(account_id),
1268 base::Bind(&OnRemoveUserComplete, account_id)); 1269 base::Bind(&OnRemoveUserComplete, account_id));
1269 } 1270 }
1270 1271
1271 bool ChromeUserManagerImpl::IsGuestAccountId( 1272 bool ChromeUserManagerImpl::IsGuestAccountId(
1272 const AccountId& account_id) const { 1273 const AccountId& account_id) const {
1273 return account_id == login::GuestAccountId(); 1274 return account_id == user_manager::GuestAccountId();
1274 } 1275 }
1275 1276
1276 bool ChromeUserManagerImpl::IsStubAccountId(const AccountId& account_id) const { 1277 bool ChromeUserManagerImpl::IsStubAccountId(const AccountId& account_id) const {
1277 return account_id == login::StubAccountId(); 1278 return account_id == user_manager::StubAccountId();
1278 } 1279 }
1279 1280
1280 bool ChromeUserManagerImpl::IsSupervisedAccountId( 1281 bool ChromeUserManagerImpl::IsSupervisedAccountId(
1281 const AccountId& account_id) const { 1282 const AccountId& account_id) const {
1282 return gaia::ExtractDomainName(account_id.GetUserEmail()) == 1283 return gaia::ExtractDomainName(account_id.GetUserEmail()) ==
1283 chromeos::login::kSupervisedUserDomain; 1284 user_manager::kSupervisedUserDomain;
1284 } 1285 }
1285 1286
1286 bool ChromeUserManagerImpl::HasBrowserRestarted() const { 1287 bool ChromeUserManagerImpl::HasBrowserRestarted() const {
1287 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 1288 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
1288 return base::SysInfo::IsRunningOnChromeOS() && 1289 return base::SysInfo::IsRunningOnChromeOS() &&
1289 command_line->HasSwitch(chromeos::switches::kLoginUser); 1290 command_line->HasSwitch(chromeos::switches::kLoginUser);
1290 } 1291 }
1291 1292
1292 const gfx::ImageSkia& ChromeUserManagerImpl::GetResourceImagekiaNamed( 1293 const gfx::ImageSkia& ChromeUserManagerImpl::GetResourceImagekiaNamed(
1293 int id) const { 1294 int id) const {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 break; 1332 break;
1332 default: 1333 default:
1333 NOTREACHED(); 1334 NOTREACHED();
1334 break; 1335 break;
1335 } 1336 }
1336 1337
1337 return user; 1338 return user;
1338 } 1339 }
1339 1340
1340 } // namespace chromeos 1341 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698