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

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

Issue 1794323003: Make user_manager::UserImage non-copyable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 9 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/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 #include <cstddef> 8 #include <cstddef>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 } 680 }
681 681
682 void ChromeUserManagerImpl::GuestUserLoggedIn() { 682 void ChromeUserManagerImpl::GuestUserLoggedIn() {
683 DCHECK_CURRENTLY_ON(BrowserThread::UI); 683 DCHECK_CURRENTLY_ON(BrowserThread::UI);
684 ChromeUserManager::GuestUserLoggedIn(); 684 ChromeUserManager::GuestUserLoggedIn();
685 685
686 // TODO(nkostylev): Add support for passing guest session cryptohome 686 // TODO(nkostylev): Add support for passing guest session cryptohome
687 // mount point. Legacy (--login-profile) value will be used for now. 687 // mount point. Legacy (--login-profile) value will be used for now.
688 // http://crosbug.com/230859 688 // http://crosbug.com/230859
689 active_user_->SetStubImage( 689 active_user_->SetStubImage(
690 user_manager::UserImage( 690 make_scoped_ptr(new user_manager::UserImage(
691 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 691 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
692 IDR_PROFILE_PICTURE_LOADING)), 692 IDR_PROFILE_PICTURE_LOADING))),
693 user_manager::User::USER_IMAGE_INVALID, 693 user_manager::User::USER_IMAGE_INVALID, false);
694 false);
695 694
696 // Initializes wallpaper after active_user_ is set. 695 // Initializes wallpaper after active_user_ is set.
697 WallpaperManager::Get()->SetUserWallpaperNow(login::GuestAccountId()); 696 WallpaperManager::Get()->SetUserWallpaperNow(login::GuestAccountId());
698 } 697 }
699 698
700 void ChromeUserManagerImpl::RegularUserLoggedIn(const AccountId& account_id) { 699 void ChromeUserManagerImpl::RegularUserLoggedIn(const AccountId& account_id) {
701 ChromeUserManager::RegularUserLoggedIn(account_id); 700 ChromeUserManager::RegularUserLoggedIn(account_id);
702 701
703 if (FakeOwnership()) { 702 if (FakeOwnership()) {
704 const AccountId owner_account_id = GetActiveUser()->GetAccountId(); 703 const AccountId owner_account_id = GetActiveUser()->GetAccountId();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 const AccountId& kiosk_app_account_id) { 789 const AccountId& kiosk_app_account_id) {
791 DCHECK_CURRENTLY_ON(BrowserThread::UI); 790 DCHECK_CURRENTLY_ON(BrowserThread::UI);
792 policy::DeviceLocalAccount::Type device_local_account_type; 791 policy::DeviceLocalAccount::Type device_local_account_type;
793 DCHECK(policy::IsDeviceLocalAccountUser(kiosk_app_account_id.GetUserEmail(), 792 DCHECK(policy::IsDeviceLocalAccountUser(kiosk_app_account_id.GetUserEmail(),
794 &device_local_account_type)); 793 &device_local_account_type));
795 DCHECK_EQ(policy::DeviceLocalAccount::TYPE_KIOSK_APP, 794 DCHECK_EQ(policy::DeviceLocalAccount::TYPE_KIOSK_APP,
796 device_local_account_type); 795 device_local_account_type);
797 796
798 active_user_ = user_manager::User::CreateKioskAppUser(kiosk_app_account_id); 797 active_user_ = user_manager::User::CreateKioskAppUser(kiosk_app_account_id);
799 active_user_->SetStubImage( 798 active_user_->SetStubImage(
800 user_manager::UserImage( 799 make_scoped_ptr(new user_manager::UserImage(
801 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 800 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
802 IDR_PROFILE_PICTURE_LOADING)), 801 IDR_PROFILE_PICTURE_LOADING))),
803 user_manager::User::USER_IMAGE_INVALID, 802 user_manager::User::USER_IMAGE_INVALID, false);
804 false);
805 803
806 WallpaperManager::Get()->SetUserWallpaperNow(kiosk_app_account_id); 804 WallpaperManager::Get()->SetUserWallpaperNow(kiosk_app_account_id);
807 805
808 // TODO(bartfab): Add KioskAppUsers to the users_ list and keep metadata like 806 // TODO(bartfab): Add KioskAppUsers to the users_ list and keep metadata like
809 // the kiosk_app_id in these objects, removing the need to re-parse the 807 // the kiosk_app_id in these objects, removing the need to re-parse the
810 // device-local account list here to extract the kiosk_app_id. 808 // device-local account list here to extract the kiosk_app_id.
811 const std::vector<policy::DeviceLocalAccount> device_local_accounts = 809 const std::vector<policy::DeviceLocalAccount> device_local_accounts =
812 policy::GetDeviceLocalAccounts(cros_settings_); 810 policy::GetDeviceLocalAccounts(cros_settings_);
813 const policy::DeviceLocalAccount* account = NULL; 811 const policy::DeviceLocalAccount* account = NULL;
814 for (std::vector<policy::DeviceLocalAccount>::const_iterator it = 812 for (std::vector<policy::DeviceLocalAccount>::const_iterator it =
(...skipping 20 matching lines...) Expand all
835 833
836 // Disable window animation since kiosk app runs in a single full screen 834 // Disable window animation since kiosk app runs in a single full screen
837 // window and window animation causes start-up janks. 835 // window and window animation causes start-up janks.
838 command_line->AppendSwitch(wm::switches::kWindowAnimationsDisabled); 836 command_line->AppendSwitch(wm::switches::kWindowAnimationsDisabled);
839 } 837 }
840 838
841 void ChromeUserManagerImpl::DemoAccountLoggedIn() { 839 void ChromeUserManagerImpl::DemoAccountLoggedIn() {
842 DCHECK_CURRENTLY_ON(BrowserThread::UI); 840 DCHECK_CURRENTLY_ON(BrowserThread::UI);
843 active_user_ = user_manager::User::CreateKioskAppUser(login::DemoAccountId()); 841 active_user_ = user_manager::User::CreateKioskAppUser(login::DemoAccountId());
844 active_user_->SetStubImage( 842 active_user_->SetStubImage(
845 user_manager::UserImage( 843 make_scoped_ptr(new user_manager::UserImage(
846 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 844 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
847 IDR_PROFILE_PICTURE_LOADING)), 845 IDR_PROFILE_PICTURE_LOADING))),
848 user_manager::User::USER_IMAGE_INVALID, 846 user_manager::User::USER_IMAGE_INVALID, false);
849 false);
850 WallpaperManager::Get()->SetUserWallpaperNow(login::DemoAccountId()); 847 WallpaperManager::Get()->SetUserWallpaperNow(login::DemoAccountId());
851 848
852 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 849 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
853 command_line->AppendSwitch(::switches::kForceAppMode); 850 command_line->AppendSwitch(::switches::kForceAppMode);
854 command_line->AppendSwitchASCII(::switches::kAppId, 851 command_line->AppendSwitchASCII(::switches::kAppId,
855 DemoAppLauncher::kDemoAppId); 852 DemoAppLauncher::kDemoAppId);
856 853
857 // Disable window animation since the demo app runs in a single full screen 854 // Disable window animation since the demo app runs in a single full screen
858 // window and window animation causes start-up janks. 855 // window and window animation causes start-up janks.
859 base::CommandLine::ForCurrentProcess()->AppendSwitch( 856 base::CommandLine::ForCurrentProcess()->AppendSwitch(
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 base::Bind(ResolveLocale, locale, base::Unretained(out_resolved_locale)), 1292 base::Bind(ResolveLocale, locale, base::Unretained(out_resolved_locale)),
1296 on_resolved_callback); 1293 on_resolved_callback);
1297 } 1294 }
1298 1295
1299 bool ChromeUserManagerImpl::IsValidDefaultUserImageId(int image_index) const { 1296 bool ChromeUserManagerImpl::IsValidDefaultUserImageId(int image_index) const {
1300 return image_index >= 0 && 1297 return image_index >= 0 &&
1301 image_index < chromeos::default_user_image::kDefaultImagesCount; 1298 image_index < chromeos::default_user_image::kDefaultImagesCount;
1302 } 1299 }
1303 1300
1304 } // namespace chromeos 1301 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698