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

Side by Side Diff: chrome/browser/ui/webui/signin/user_manager_screen_handler.cc

Issue 845373002: Change default code flag to NewAvatarMenu. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test comment. GetAvatarIcon's no longer const. Created 5 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 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 return; 91 return;
92 profiles::FindOrCreateNewWindowForProfile( 92 profiles::FindOrCreateNewWindowForProfile(
93 profile, 93 profile,
94 chrome::startup::IS_PROCESS_STARTUP, 94 chrome::startup::IS_PROCESS_STARTUP,
95 chrome::startup::IS_FIRST_RUN, 95 chrome::startup::IS_FIRST_RUN,
96 desktop_type, 96 desktop_type,
97 false); 97 false);
98 } 98 }
99 99
100 std::string GetAvatarImageAtIndex( 100 std::string GetAvatarImageAtIndex(
101 size_t index, const ProfileInfoCache& info_cache) { 101 size_t index, ProfileInfoCache* info_cache) {
102 bool is_gaia_picture = 102 bool is_gaia_picture =
103 info_cache.IsUsingGAIAPictureOfProfileAtIndex(index) && 103 info_cache->IsUsingGAIAPictureOfProfileAtIndex(index) &&
104 info_cache.GetGAIAPictureOfProfileAtIndex(index); 104 info_cache->GetGAIAPictureOfProfileAtIndex(index);
105 105
106 // If the avatar is too small (i.e. the old-style low resolution avatar), 106 // If the avatar is too small (i.e. the old-style low resolution avatar),
107 // it will be pixelated when displayed in the User Manager, so we should 107 // it will be pixelated when displayed in the User Manager, so we should
108 // return the placeholder avatar instead. 108 // return the placeholder avatar instead.
109 gfx::Image avatar_image = info_cache.GetAvatarIconOfProfileAtIndex(index); 109 gfx::Image avatar_image = info_cache->GetAvatarIconOfProfileAtIndex(index);
110 if (avatar_image.Width() <= profiles::kAvatarIconWidth || 110 if (avatar_image.Width() <= profiles::kAvatarIconWidth ||
111 avatar_image.Height() <= profiles::kAvatarIconHeight ) { 111 avatar_image.Height() <= profiles::kAvatarIconHeight ) {
112 avatar_image = ui::ResourceBundle::GetSharedInstance().GetImageNamed( 112 avatar_image = ui::ResourceBundle::GetSharedInstance().GetImageNamed(
113 profiles::GetPlaceholderAvatarIconResourceID()); 113 profiles::GetPlaceholderAvatarIconResourceID());
114 } 114 }
115 gfx::Image resized_image = profiles::GetSizedAvatarIcon( 115 gfx::Image resized_image = profiles::GetSizedAvatarIcon(
116 avatar_image, is_gaia_picture, kAvatarIconSize, kAvatarIconSize); 116 avatar_image, is_gaia_picture, kAvatarIconSize, kAvatarIconSize);
117 return webui::GetBitmapDataUrl(resized_image.AsBitmap()); 117 return webui::GetBitmapDataUrl(resized_image.AsBitmap());
118 } 118 }
119 119
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 localized_strings->SetString("multiProfilesNotAllowedPolicyMsg", 709 localized_strings->SetString("multiProfilesNotAllowedPolicyMsg",
710 base::string16()); 710 base::string16());
711 localized_strings->SetString("multiProfilesPrimaryOnlyPolicyMsg", 711 localized_strings->SetString("multiProfilesPrimaryOnlyPolicyMsg",
712 base::string16()); 712 base::string16());
713 localized_strings->SetString("multiProfilesOwnerPrimaryOnlyMsg", 713 localized_strings->SetString("multiProfilesOwnerPrimaryOnlyMsg",
714 base::string16()); 714 base::string16());
715 } 715 }
716 716
717 void UserManagerScreenHandler::SendUserList() { 717 void UserManagerScreenHandler::SendUserList() {
718 base::ListValue users_list; 718 base::ListValue users_list;
719 const ProfileInfoCache& info_cache = 719 ProfileInfoCache* info_cache =
720 g_browser_process->profile_manager()->GetProfileInfoCache(); 720 &g_browser_process->profile_manager()->GetProfileInfoCache();
721 user_auth_type_map_.clear(); 721 user_auth_type_map_.clear();
722 722
723 // Profile deletion is not allowed in Metro mode. 723 // Profile deletion is not allowed in Metro mode.
724 bool can_remove = true; 724 bool can_remove = true;
725 #if defined(USE_ASH) 725 #if defined(USE_ASH)
726 can_remove = !ash::Shell::HasInstance(); 726 can_remove = !ash::Shell::HasInstance();
727 #endif 727 #endif
728 728
729 for (size_t i = 0; i < info_cache.GetNumberOfProfiles(); ++i) { 729 for (size_t i = 0; i < info_cache->GetNumberOfProfiles(); ++i) {
730 base::DictionaryValue* profile_value = new base::DictionaryValue(); 730 base::DictionaryValue* profile_value = new base::DictionaryValue();
731 base::FilePath profile_path = info_cache.GetPathOfProfileAtIndex(i); 731 base::FilePath profile_path = info_cache->GetPathOfProfileAtIndex(i);
732 732
733 profile_value->SetString( 733 profile_value->SetString(
734 kKeyUsername, info_cache.GetUserNameOfProfileAtIndex(i)); 734 kKeyUsername, info_cache->GetUserNameOfProfileAtIndex(i));
735 profile_value->SetString( 735 profile_value->SetString(
736 kKeyEmailAddress, info_cache.GetUserNameOfProfileAtIndex(i)); 736 kKeyEmailAddress, info_cache->GetUserNameOfProfileAtIndex(i));
737 profile_value->SetString( 737 profile_value->SetString(
738 kKeyDisplayName, 738 kKeyDisplayName,
739 profiles::GetAvatarNameForProfile(profile_path)); 739 profiles::GetAvatarNameForProfile(profile_path));
740 profile_value->Set( 740 profile_value->Set(
741 kKeyProfilePath, base::CreateFilePathValue(profile_path)); 741 kKeyProfilePath, base::CreateFilePathValue(profile_path));
742 profile_value->SetBoolean(kKeyPublicAccount, false); 742 profile_value->SetBoolean(kKeyPublicAccount, false);
743 profile_value->SetBoolean(kKeyLegacySupervisedUser, 743 profile_value->SetBoolean(kKeyLegacySupervisedUser,
744 info_cache.ProfileIsLegacySupervisedAtIndex(i)); 744 info_cache->ProfileIsLegacySupervisedAtIndex(i));
745 profile_value->SetBoolean( 745 profile_value->SetBoolean(
746 kKeyChildUser, info_cache.ProfileIsChildAtIndex(i)); 746 kKeyChildUser, info_cache->ProfileIsChildAtIndex(i));
747 profile_value->SetBoolean( 747 profile_value->SetBoolean(
748 kKeyNeedsSignin, info_cache.ProfileIsSigninRequiredAtIndex(i)); 748 kKeyNeedsSignin, info_cache->ProfileIsSigninRequiredAtIndex(i));
749 profile_value->SetBoolean(kKeyIsOwner, false); 749 profile_value->SetBoolean(kKeyIsOwner, false);
750 profile_value->SetBoolean(kKeyCanRemove, can_remove); 750 profile_value->SetBoolean(kKeyCanRemove, can_remove);
751 profile_value->SetBoolean(kKeyIsDesktop, true); 751 profile_value->SetBoolean(kKeyIsDesktop, true);
752 profile_value->SetString( 752 profile_value->SetString(
753 kKeyAvatarUrl, GetAvatarImageAtIndex(i, info_cache)); 753 kKeyAvatarUrl, GetAvatarImageAtIndex(i, info_cache));
754 754
755 users_list.Append(profile_value); 755 users_list.Append(profile_value);
756 } 756 }
757 757
758 web_ui()->CallJavascriptFunction("login.AccountPickerScreen.loadUsers", 758 web_ui()->CallJavascriptFunction("login.AccountPickerScreen.loadUsers",
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 Profile* profile, Profile::CreateStatus profile_create_status) { 841 Profile* profile, Profile::CreateStatus profile_create_status) {
842 Browser* browser = chrome::FindAnyBrowser(profile, false, desktop_type_); 842 Browser* browser = chrome::FindAnyBrowser(profile, false, desktop_type_);
843 if (browser && browser->window()) { 843 if (browser && browser->window()) {
844 OnBrowserWindowReady(browser); 844 OnBrowserWindowReady(browser);
845 } else { 845 } else {
846 registrar_.Add(this, 846 registrar_.Add(this,
847 chrome::NOTIFICATION_BROWSER_WINDOW_READY, 847 chrome::NOTIFICATION_BROWSER_WINDOW_READY,
848 content::NotificationService::AllSources()); 848 content::NotificationService::AllSources());
849 } 849 }
850 } 850 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/profiles/avatar_menu_button_browsertest.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698