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/wallpaper/wallpaper_manager.h" | 5 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "ash/common/ash_constants.h" | 9 #include "ash/common/ash_constants.h" |
10 #include "ash/common/wallpaper/wallpaper_controller.h" | 10 #include "ash/common/wallpaper/wallpaper_controller.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "chrome/browser/chromeos/login/startup_utils.h" | 29 #include "chrome/browser/chromeos/login/startup_utils.h" |
30 #include "chrome/browser/chromeos/login/users/avatar/user_image_loader.h" | 30 #include "chrome/browser/chromeos/login/users/avatar/user_image_loader.h" |
31 #include "chrome/browser/chromeos/login/wizard_controller.h" | 31 #include "chrome/browser/chromeos/login/wizard_controller.h" |
32 #include "chrome/browser/image_decoder.h" | 32 #include "chrome/browser/image_decoder.h" |
33 #include "chrome/browser/ui/ash/ash_util.h" | 33 #include "chrome/browser/ui/ash/ash_util.h" |
34 #include "chrome/common/chrome_paths.h" | 34 #include "chrome/common/chrome_paths.h" |
35 #include "chrome/common/chrome_switches.h" | 35 #include "chrome/common/chrome_switches.h" |
36 #include "chrome/common/pref_names.h" | 36 #include "chrome/common/pref_names.h" |
37 #include "chromeos/chromeos_switches.h" | 37 #include "chromeos/chromeos_switches.h" |
38 #include "chromeos/cryptohome/system_salt_getter.h" | 38 #include "chromeos/cryptohome/system_salt_getter.h" |
39 #include "chromeos/login/user_names.h" | |
40 #include "components/prefs/pref_registry_simple.h" | 39 #include "components/prefs/pref_registry_simple.h" |
41 #include "components/prefs/pref_service.h" | 40 #include "components/prefs/pref_service.h" |
42 #include "components/prefs/scoped_user_pref_update.h" | 41 #include "components/prefs/scoped_user_pref_update.h" |
43 #include "components/signin/core/account_id/account_id.h" | 42 #include "components/signin/core/account_id/account_id.h" |
44 #include "components/user_manager/known_user.h" | 43 #include "components/user_manager/known_user.h" |
| 44 #include "components/user_manager/user_names.h" |
45 #include "components/user_manager/user_type.h" | 45 #include "components/user_manager/user_type.h" |
46 #include "components/wallpaper/wallpaper_files_id.h" | 46 #include "components/wallpaper/wallpaper_files_id.h" |
47 #include "components/wallpaper/wallpaper_layout.h" | 47 #include "components/wallpaper/wallpaper_layout.h" |
48 #include "content/public/browser/browser_thread.h" | 48 #include "content/public/browser/browser_thread.h" |
49 #include "content/public/browser/notification_service.h" | 49 #include "content/public/browser/notification_service.h" |
50 #include "content/public/common/content_switches.h" | 50 #include "content/public/common/content_switches.h" |
51 #include "content/public/common/service_manager_connection.h" | 51 #include "content/public/common/service_manager_connection.h" |
52 #include "services/service_manager/public/cpp/connector.h" | 52 #include "services/service_manager/public/cpp/connector.h" |
53 | 53 |
54 using content::BrowserThread; | 54 using content::BrowserThread; |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 | 431 |
432 // Zero delays is also set in autotests. | 432 // Zero delays is also set in autotests. |
433 if (WizardController::IsZeroDelayEnabled()) { | 433 if (WizardController::IsZeroDelayEnabled()) { |
434 // Ensure tests have some sort of wallpaper. | 434 // Ensure tests have some sort of wallpaper. |
435 ash::WmShell::Get()->wallpaper_controller()->CreateEmptyWallpaper(); | 435 ash::WmShell::Get()->wallpaper_controller()->CreateEmptyWallpaper(); |
436 return; | 436 return; |
437 } | 437 } |
438 | 438 |
439 if (!user_manager->IsUserLoggedIn()) { | 439 if (!user_manager->IsUserLoggedIn()) { |
440 if (!StartupUtils::IsDeviceRegistered()) | 440 if (!StartupUtils::IsDeviceRegistered()) |
441 SetDefaultWallpaperDelayed(login::SignInAccountId()); | 441 SetDefaultWallpaperDelayed(user_manager::SignInAccountId()); |
442 else | 442 else |
443 InitializeRegisteredDeviceWallpaper(); | 443 InitializeRegisteredDeviceWallpaper(); |
444 return; | 444 return; |
445 } | 445 } |
446 SetUserWallpaperDelayed(user_manager->GetLoggedInUser()->GetAccountId()); | 446 SetUserWallpaperDelayed(user_manager->GetLoggedInUser()->GetAccountId()); |
447 } | 447 } |
448 | 448 |
449 void WallpaperManager::Open() { | 449 void WallpaperManager::Open() { |
450 wallpaper_manager_util::OpenWallpaperManager(); | 450 wallpaper_manager_util::OpenWallpaperManager(); |
451 } | 451 } |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 ->ResetSetWallpaperImage(image, info); | 791 ->ResetSetWallpaperImage(image, info); |
792 } | 792 } |
793 } | 793 } |
794 | 794 |
795 void WallpaperManager::UpdateWallpaper(bool clear_cache) { | 795 void WallpaperManager::UpdateWallpaper(bool clear_cache) { |
796 // For GAIA login flow, the last_selected_user_ may not be set before user | 796 // For GAIA login flow, the last_selected_user_ may not be set before user |
797 // login. If UpdateWallpaper is called at GAIA login screen, no wallpaper will | 797 // login. If UpdateWallpaper is called at GAIA login screen, no wallpaper will |
798 // be set. It could result a black screen on external monitors. | 798 // be set. It could result a black screen on external monitors. |
799 // See http://crbug.com/265689 for detail. | 799 // See http://crbug.com/265689 for detail. |
800 if (last_selected_user_.empty()) | 800 if (last_selected_user_.empty()) |
801 SetDefaultWallpaperNow(chromeos::login::SignInAccountId()); | 801 SetDefaultWallpaperNow(user_manager::SignInAccountId()); |
802 WallpaperManagerBase::UpdateWallpaper(clear_cache); | 802 WallpaperManagerBase::UpdateWallpaper(clear_cache); |
803 } | 803 } |
804 | 804 |
805 // WallpaperManager, private: -------------------------------------------------- | 805 // WallpaperManager, private: -------------------------------------------------- |
806 | 806 |
807 WallpaperManager::WallpaperManager() | 807 WallpaperManager::WallpaperManager() |
808 : pending_inactive_(NULL), weak_factory_(this) { | 808 : pending_inactive_(NULL), weak_factory_(this) { |
809 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 809 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
810 wallpaper::WallpaperManagerBase::SetPathIds( | 810 wallpaper::WallpaperManagerBase::SetPathIds( |
811 chrome::DIR_USER_DATA, chrome::DIR_CHROMEOS_WALLPAPERS, | 811 chrome::DIR_USER_DATA, chrome::DIR_CHROMEOS_WALLPAPERS, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 bool show_users = true; | 890 bool show_users = true; |
891 bool result = CrosSettings::Get()->GetBoolean( | 891 bool result = CrosSettings::Get()->GetBoolean( |
892 kAccountsPrefShowUserNamesOnSignIn, &show_users); | 892 kAccountsPrefShowUserNamesOnSignIn, &show_users); |
893 DCHECK(result) << "Unable to fetch setting " | 893 DCHECK(result) << "Unable to fetch setting " |
894 << kAccountsPrefShowUserNamesOnSignIn; | 894 << kAccountsPrefShowUserNamesOnSignIn; |
895 const user_manager::UserList& users = | 895 const user_manager::UserList& users = |
896 user_manager::UserManager::Get()->GetUsers(); | 896 user_manager::UserManager::Get()->GetUsers(); |
897 int public_session_user_index = FindPublicSession(users); | 897 int public_session_user_index = FindPublicSession(users); |
898 if ((!show_users && public_session_user_index == -1) || users.empty()) { | 898 if ((!show_users && public_session_user_index == -1) || users.empty()) { |
899 // Boot into sign in form, preload default wallpaper. | 899 // Boot into sign in form, preload default wallpaper. |
900 SetDefaultWallpaperDelayed(login::SignInAccountId()); | 900 SetDefaultWallpaperDelayed(user_manager::SignInAccountId()); |
901 return; | 901 return; |
902 } | 902 } |
903 | 903 |
904 if (!disable_boot_animation) { | 904 if (!disable_boot_animation) { |
905 int index = public_session_user_index != -1 ? public_session_user_index : 0; | 905 int index = public_session_user_index != -1 ? public_session_user_index : 0; |
906 // Normal boot, load user wallpaper. | 906 // Normal boot, load user wallpaper. |
907 // If normal boot animation is disabled wallpaper would be set | 907 // If normal boot animation is disabled wallpaper would be set |
908 // asynchronously once user pods are loaded. | 908 // asynchronously once user pods are loaded. |
909 SetUserWallpaperDelayed(users[index]->GetAccountId()); | 909 SetUserWallpaperDelayed(users[index]->GetAccountId()); |
910 } | 910 } |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1154 &stored_value)) { | 1154 &stored_value)) { |
1155 return wallpaper::WallpaperFilesId::FromString(stored_value); | 1155 return wallpaper::WallpaperFilesId::FromString(stored_value); |
1156 } | 1156 } |
1157 const std::string& old_id = account_id.GetUserEmail(); // Migrated | 1157 const std::string& old_id = account_id.GetUserEmail(); // Migrated |
1158 const wallpaper::WallpaperFilesId files_id = HashWallpaperFilesIdStr(old_id); | 1158 const wallpaper::WallpaperFilesId files_id = HashWallpaperFilesIdStr(old_id); |
1159 SetKnownUserWallpaperFilesId(account_id, files_id); | 1159 SetKnownUserWallpaperFilesId(account_id, files_id); |
1160 return files_id; | 1160 return files_id; |
1161 } | 1161 } |
1162 | 1162 |
1163 } // namespace chromeos | 1163 } // namespace chromeos |
OLD | NEW |