| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/webui/signin/user_manager_screen_handler.h" | 5 #include "chrome/browser/ui/webui/signin/user_manager_screen_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/profiler/scoped_tracker.h" | 9 #include "base/profiler/scoped_tracker.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 return; | 93 return; |
| 94 profiles::FindOrCreateNewWindowForProfile( | 94 profiles::FindOrCreateNewWindowForProfile( |
| 95 profile, | 95 profile, |
| 96 chrome::startup::IS_PROCESS_STARTUP, | 96 chrome::startup::IS_PROCESS_STARTUP, |
| 97 chrome::startup::IS_FIRST_RUN, | 97 chrome::startup::IS_FIRST_RUN, |
| 98 desktop_type, | 98 desktop_type, |
| 99 false); | 99 false); |
| 100 } | 100 } |
| 101 | 101 |
| 102 std::string GetAvatarImageAtIndex( | 102 std::string GetAvatarImageAtIndex( |
| 103 size_t index, const ProfileInfoCache& info_cache) { | 103 size_t index, ProfileInfoCache* info_cache) { |
| 104 bool is_gaia_picture = | 104 bool is_gaia_picture = |
| 105 info_cache.IsUsingGAIAPictureOfProfileAtIndex(index) && | 105 info_cache->IsUsingGAIAPictureOfProfileAtIndex(index) && |
| 106 info_cache.GetGAIAPictureOfProfileAtIndex(index); | 106 info_cache->GetGAIAPictureOfProfileAtIndex(index); |
| 107 | 107 |
| 108 // If the avatar is too small (i.e. the old-style low resolution avatar), | 108 // If the avatar is too small (i.e. the old-style low resolution avatar), |
| 109 // it will be pixelated when displayed in the User Manager, so we should | 109 // it will be pixelated when displayed in the User Manager, so we should |
| 110 // return the placeholder avatar instead. | 110 // return the placeholder avatar instead. |
| 111 gfx::Image avatar_image = info_cache.GetAvatarIconOfProfileAtIndex(index); | 111 gfx::Image avatar_image = info_cache->GetAvatarIconOfProfileAtIndex(index); |
| 112 if (avatar_image.Width() <= profiles::kAvatarIconWidth || | 112 if (avatar_image.Width() <= profiles::kAvatarIconWidth || |
| 113 avatar_image.Height() <= profiles::kAvatarIconHeight ) { | 113 avatar_image.Height() <= profiles::kAvatarIconHeight ) { |
| 114 avatar_image = ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 114 avatar_image = ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
| 115 profiles::GetPlaceholderAvatarIconResourceID()); | 115 profiles::GetPlaceholderAvatarIconResourceID()); |
| 116 } | 116 } |
| 117 gfx::Image resized_image = profiles::GetSizedAvatarIcon( | 117 gfx::Image resized_image = profiles::GetSizedAvatarIcon( |
| 118 avatar_image, is_gaia_picture, kAvatarIconSize, kAvatarIconSize); | 118 avatar_image, is_gaia_picture, kAvatarIconSize, kAvatarIconSize); |
| 119 return webui::GetBitmapDataUrl(resized_image.AsBitmap()); | 119 return webui::GetBitmapDataUrl(resized_image.AsBitmap()); |
| 120 } | 120 } |
| 121 | 121 |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 localized_strings->SetString("multiProfilesNotAllowedPolicyMsg", | 718 localized_strings->SetString("multiProfilesNotAllowedPolicyMsg", |
| 719 base::string16()); | 719 base::string16()); |
| 720 localized_strings->SetString("multiProfilesPrimaryOnlyPolicyMsg", | 720 localized_strings->SetString("multiProfilesPrimaryOnlyPolicyMsg", |
| 721 base::string16()); | 721 base::string16()); |
| 722 localized_strings->SetString("multiProfilesOwnerPrimaryOnlyMsg", | 722 localized_strings->SetString("multiProfilesOwnerPrimaryOnlyMsg", |
| 723 base::string16()); | 723 base::string16()); |
| 724 } | 724 } |
| 725 | 725 |
| 726 void UserManagerScreenHandler::SendUserList() { | 726 void UserManagerScreenHandler::SendUserList() { |
| 727 base::ListValue users_list; | 727 base::ListValue users_list; |
| 728 const ProfileInfoCache& info_cache = | 728 ProfileInfoCache* info_cache = |
| 729 g_browser_process->profile_manager()->GetProfileInfoCache(); | 729 &g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 730 user_auth_type_map_.clear(); | 730 user_auth_type_map_.clear(); |
| 731 | 731 |
| 732 // Profile deletion is not allowed in Metro mode. | 732 // Profile deletion is not allowed in Metro mode. |
| 733 bool can_remove = true; | 733 bool can_remove = true; |
| 734 #if defined(USE_ASH) | 734 #if defined(USE_ASH) |
| 735 can_remove = !ash::Shell::HasInstance(); | 735 can_remove = !ash::Shell::HasInstance(); |
| 736 #endif | 736 #endif |
| 737 | 737 |
| 738 for (size_t i = 0; i < info_cache.GetNumberOfProfiles(); ++i) { | 738 for (size_t i = 0; i < info_cache->GetNumberOfProfiles(); ++i) { |
| 739 base::DictionaryValue* profile_value = new base::DictionaryValue(); | 739 base::DictionaryValue* profile_value = new base::DictionaryValue(); |
| 740 base::FilePath profile_path = info_cache.GetPathOfProfileAtIndex(i); | 740 base::FilePath profile_path = info_cache->GetPathOfProfileAtIndex(i); |
| 741 | 741 |
| 742 profile_value->SetString( | 742 profile_value->SetString( |
| 743 kKeyUsername, info_cache.GetUserNameOfProfileAtIndex(i)); | 743 kKeyUsername, info_cache->GetUserNameOfProfileAtIndex(i)); |
| 744 profile_value->SetString( | 744 profile_value->SetString( |
| 745 kKeyEmailAddress, info_cache.GetUserNameOfProfileAtIndex(i)); | 745 kKeyEmailAddress, info_cache->GetUserNameOfProfileAtIndex(i)); |
| 746 profile_value->SetString( | 746 profile_value->SetString( |
| 747 kKeyDisplayName, | 747 kKeyDisplayName, |
| 748 profiles::GetAvatarNameForProfile(profile_path)); | 748 profiles::GetAvatarNameForProfile(profile_path)); |
| 749 profile_value->Set( | 749 profile_value->Set( |
| 750 kKeyProfilePath, base::CreateFilePathValue(profile_path)); | 750 kKeyProfilePath, base::CreateFilePathValue(profile_path)); |
| 751 profile_value->SetBoolean(kKeyPublicAccount, false); | 751 profile_value->SetBoolean(kKeyPublicAccount, false); |
| 752 profile_value->SetBoolean(kKeyLegacySupervisedUser, | 752 profile_value->SetBoolean(kKeyLegacySupervisedUser, |
| 753 info_cache.ProfileIsLegacySupervisedAtIndex(i)); | 753 info_cache->ProfileIsLegacySupervisedAtIndex(i)); |
| 754 profile_value->SetBoolean( | 754 profile_value->SetBoolean( |
| 755 kKeyChildUser, info_cache.ProfileIsChildAtIndex(i)); | 755 kKeyChildUser, info_cache->ProfileIsChildAtIndex(i)); |
| 756 profile_value->SetBoolean( | 756 profile_value->SetBoolean( |
| 757 kKeyNeedsSignin, info_cache.ProfileIsSigninRequiredAtIndex(i)); | 757 kKeyNeedsSignin, info_cache->ProfileIsSigninRequiredAtIndex(i)); |
| 758 profile_value->SetBoolean(kKeyIsOwner, false); | 758 profile_value->SetBoolean(kKeyIsOwner, false); |
| 759 profile_value->SetBoolean(kKeyCanRemove, can_remove); | 759 profile_value->SetBoolean(kKeyCanRemove, can_remove); |
| 760 profile_value->SetBoolean(kKeyIsDesktop, true); | 760 profile_value->SetBoolean(kKeyIsDesktop, true); |
| 761 profile_value->SetString( | 761 profile_value->SetString( |
| 762 kKeyAvatarUrl, GetAvatarImageAtIndex(i, info_cache)); | 762 kKeyAvatarUrl, GetAvatarImageAtIndex(i, info_cache)); |
| 763 | 763 |
| 764 users_list.Append(profile_value); | 764 users_list.Append(profile_value); |
| 765 } | 765 } |
| 766 | 766 |
| 767 web_ui()->CallJavascriptFunction("login.AccountPickerScreen.loadUsers", | 767 web_ui()->CallJavascriptFunction("login.AccountPickerScreen.loadUsers", |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 Profile* profile, Profile::CreateStatus profile_create_status) { | 855 Profile* profile, Profile::CreateStatus profile_create_status) { |
| 856 Browser* browser = chrome::FindAnyBrowser(profile, false, desktop_type_); | 856 Browser* browser = chrome::FindAnyBrowser(profile, false, desktop_type_); |
| 857 if (browser && browser->window()) { | 857 if (browser && browser->window()) { |
| 858 OnBrowserWindowReady(browser); | 858 OnBrowserWindowReady(browser); |
| 859 } else { | 859 } else { |
| 860 registrar_.Add(this, | 860 registrar_.Add(this, |
| 861 chrome::NOTIFICATION_BROWSER_WINDOW_READY, | 861 chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
| 862 content::NotificationService::AllSources()); | 862 content::NotificationService::AllSources()); |
| 863 } | 863 } |
| 864 } | 864 } |
| OLD | NEW |