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

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

Powered by Google App Engine
This is Rietveld 408576698