| OLD | NEW |
| 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 14 matching lines...) Expand all Loading... |
| 25 #include "base/strings/stringprintf.h" | 25 #include "base/strings/stringprintf.h" |
| 26 #include "base/strings/utf_string_conversions.h" | 26 #include "base/strings/utf_string_conversions.h" |
| 27 #include "base/sys_info.h" | 27 #include "base/sys_info.h" |
| 28 #include "base/task_runner.h" | 28 #include "base/task_runner.h" |
| 29 #include "base/task_scheduler/post_task.h" | 29 #include "base/task_scheduler/post_task.h" |
| 30 #include "base/threading/thread_task_runner_handle.h" | 30 #include "base/threading/thread_task_runner_handle.h" |
| 31 #include "base/values.h" | 31 #include "base/values.h" |
| 32 #include "chrome/browser/browser_process.h" | 32 #include "chrome/browser/browser_process.h" |
| 33 #include "chrome/browser/chrome_notification_types.h" | 33 #include "chrome/browser/chrome_notification_types.h" |
| 34 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 34 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 35 #include "chrome/browser/chromeos/extensions/active_tab_permission_granter_deleg
ate_chromeos.h" |
| 35 #include "chrome/browser/chromeos/extensions/extension_tab_util_delegate_chromeo
s.h" | 36 #include "chrome/browser/chromeos/extensions/extension_tab_util_delegate_chromeo
s.h" |
| 36 #include "chrome/browser/chromeos/extensions/permissions_updater_delegate_chrome
os.h" | 37 #include "chrome/browser/chromeos/extensions/permissions_updater_delegate_chrome
os.h" |
| 37 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" | 38 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" |
| 38 #include "chrome/browser/chromeos/login/enterprise_user_session_metrics.h" | 39 #include "chrome/browser/chromeos/login/enterprise_user_session_metrics.h" |
| 39 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 40 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 40 #include "chrome/browser/chromeos/login/signin/auth_sync_observer.h" | 41 #include "chrome/browser/chromeos/login/signin/auth_sync_observer.h" |
| 41 #include "chrome/browser/chromeos/login/signin/auth_sync_observer_factory.h" | 42 #include "chrome/browser/chromeos/login/signin/auth_sync_observer_factory.h" |
| 42 #include "chrome/browser/chromeos/login/users/affiliation.h" | 43 #include "chrome/browser/chromeos/login/users/affiliation.h" |
| 43 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.h" | 44 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.h" |
| 44 #include "chrome/browser/chromeos/login/users/chrome_user_manager_util.h" | 45 #include "chrome/browser/chromeos/login/users/chrome_user_manager_util.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 PrefService* const prefs = profile->GetPrefs(); | 148 PrefService* const prefs = profile->GetPrefs(); |
| 148 if (can_lock) | 149 if (can_lock) |
| 149 *can_lock = user->can_lock() && prefs->GetBoolean(prefs::kAllowScreenLock); | 150 *can_lock = user->can_lock() && prefs->GetBoolean(prefs::kAllowScreenLock); |
| 150 if (multi_profile_behavior) { | 151 if (multi_profile_behavior) { |
| 151 *multi_profile_behavior = | 152 *multi_profile_behavior = |
| 152 prefs->GetString(prefs::kMultiProfileUserBehavior); | 153 prefs->GetString(prefs::kMultiProfileUserBehavior); |
| 153 } | 154 } |
| 154 return true; | 155 return true; |
| 155 } | 156 } |
| 156 | 157 |
| 158 // Sets the neccessary delegates in Public Session. They will be active for the |
| 159 // whole user-session and they will go away together with the browser process |
| 160 // during logout (the browser process is destroyed during logout), ie. they are |
| 161 // not freed and they leak but that is fine. |
| 162 void SetPublicAccountDelegates() { |
| 163 extensions::PermissionsUpdater::SetPlatformDelegate( |
| 164 new extensions::PermissionsUpdaterDelegateChromeOS); |
| 165 |
| 166 extensions::ExtensionTabUtil::SetPlatformDelegate( |
| 167 new extensions::ExtensionTabUtilDelegateChromeOS); |
| 168 |
| 169 extensions::ActiveTabPermissionGranter::SetPlatformDelegate( |
| 170 new extensions::ActiveTabPermissionGranterDelegateChromeOS); |
| 171 } |
| 172 |
| 157 } // namespace | 173 } // namespace |
| 158 | 174 |
| 159 // static | 175 // static |
| 160 void ChromeUserManagerImpl::RegisterPrefs(PrefRegistrySimple* registry) { | 176 void ChromeUserManagerImpl::RegisterPrefs(PrefRegistrySimple* registry) { |
| 161 ChromeUserManager::RegisterPrefs(registry); | 177 ChromeUserManager::RegisterPrefs(registry); |
| 162 | 178 |
| 163 registry->RegisterListPref(kDeviceLocalAccounts); | 179 registry->RegisterListPref(kDeviceLocalAccounts); |
| 164 registry->RegisterStringPref(kDeviceLocalAccountPendingDataRemoval, | 180 registry->RegisterStringPref(kDeviceLocalAccountPendingDataRemoval, |
| 165 std::string()); | 181 std::string()); |
| 166 registry->RegisterListPref(kReportingUsers); | 182 registry->RegisterListPref(kReportingUsers); |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 user_manager::User* user) { | 846 user_manager::User* user) { |
| 831 SetIsCurrentUserNew(true); | 847 SetIsCurrentUserNew(true); |
| 832 active_user_ = user; | 848 active_user_ = user; |
| 833 | 849 |
| 834 // The UserImageManager chooses a random avatar picture when a user logs in | 850 // The UserImageManager chooses a random avatar picture when a user logs in |
| 835 // for the first time. Tell the UserImageManager that this user is not new to | 851 // for the first time. Tell the UserImageManager that this user is not new to |
| 836 // prevent the avatar from getting changed. | 852 // prevent the avatar from getting changed. |
| 837 GetUserImageManager(user->GetAccountId())->UserLoggedIn(false, true); | 853 GetUserImageManager(user->GetAccountId())->UserLoggedIn(false, true); |
| 838 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded(); | 854 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded(); |
| 839 | 855 |
| 840 // In Public Sessions set the PS delegate on PermissionsUpdater (used to | 856 SetPublicAccountDelegates(); |
| 841 // remove clipboard read permission from extensions in PS). This delegate will | |
| 842 // be active for the whole user-session and it will go away together with the | |
| 843 // browser process during logout (the browser process is destroyed during | |
| 844 // logout), ie. it's not freed and it leaks but that is fine. | |
| 845 extensions::PermissionsUpdater::SetPlatformDelegate( | |
| 846 new extensions::PermissionsUpdaterDelegateChromeOS); | |
| 847 | |
| 848 // In Public Sessions set the PS delegate on ExtensionTabUtil (used to scrub | |
| 849 // URL down to origin for security reasons). See comment above about | |
| 850 // PermissionsUpdaterDelegateChromeOS for more info. | |
| 851 extensions::ExtensionTabUtil::SetPlatformDelegate( | |
| 852 new extensions::ExtensionTabUtilDelegateChromeOS); | |
| 853 } | 857 } |
| 854 | 858 |
| 855 void ChromeUserManagerImpl::KioskAppLoggedIn(user_manager::User* user) { | 859 void ChromeUserManagerImpl::KioskAppLoggedIn(user_manager::User* user) { |
| 856 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 860 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 857 | 861 |
| 858 active_user_ = user; | 862 active_user_ = user; |
| 859 active_user_->SetStubImage( | 863 active_user_->SetStubImage( |
| 860 base::MakeUnique<user_manager::UserImage>( | 864 base::MakeUnique<user_manager::UserImage>( |
| 861 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 865 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 862 IDR_PROFILE_PICTURE_LOADING)), | 866 IDR_PROFILE_PICTURE_LOADING)), |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1380 break; | 1384 break; |
| 1381 default: | 1385 default: |
| 1382 NOTREACHED(); | 1386 NOTREACHED(); |
| 1383 break; | 1387 break; |
| 1384 } | 1388 } |
| 1385 | 1389 |
| 1386 return user; | 1390 return user; |
| 1387 } | 1391 } |
| 1388 | 1392 |
| 1389 } // namespace chromeos | 1393 } // namespace chromeos |
| OLD | NEW |