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/chromeos/profiles/profile_list_chromeos.h" | 5 #include "chrome/browser/chromeos/profiles/profile_list_chromeos.h" |
6 | 6 |
7 #include <unordered_map> | 7 #include <unordered_map> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 12 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
13 #include "chrome/browser/profiles/profile_attributes_entry.h" | 13 #include "chrome/browser/profiles/profile_attributes_entry.h" |
14 #include "chrome/browser/profiles/profile_attributes_storage.h" | 14 #include "chrome/browser/profiles/profile_attributes_storage.h" |
15 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 15 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
16 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
18 #include "components/signin/core/common/profile_management_switches.h" | |
19 #include "components/user_manager/user_manager.h" | 18 #include "components/user_manager/user_manager.h" |
20 | 19 |
21 // static | 20 // static |
22 ProfileList* ProfileList::Create(ProfileAttributesStorage* profile_storage) { | 21 ProfileList* ProfileList::Create(ProfileAttributesStorage* profile_storage) { |
23 return new chromeos::ProfileListChromeOS(profile_storage); | 22 return new chromeos::ProfileListChromeOS(profile_storage); |
24 } | 23 } |
25 | 24 |
26 namespace chromeos { | 25 namespace chromeos { |
27 | 26 |
28 ProfileListChromeOS::ProfileListChromeOS( | 27 ProfileListChromeOS::ProfileListChromeOS( |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 profile_storage_->GetAllProfilesAttributesSortedByName(); | 61 profile_storage_->GetAllProfilesAttributesSortedByName(); |
63 | 62 |
64 // Add the profiles. | 63 // Add the profiles. |
65 for (ProfileAttributesEntry* entry : entries) { | 64 for (ProfileAttributesEntry* entry : entries) { |
66 auto user_index_it = user_indices_by_path.find(entry->GetPath().value()); | 65 auto user_index_it = user_indices_by_path.find(entry->GetPath().value()); |
67 if (user_index_it == user_indices_by_path.end()) | 66 if (user_index_it == user_indices_by_path.end()) |
68 continue; | 67 continue; |
69 user_manager::User* user = users[user_index_it->second]; | 68 user_manager::User* user = users[user_index_it->second]; |
70 | 69 |
71 gfx::Image icon = gfx::Image(user->GetImage()); | 70 gfx::Image icon = gfx::Image(user->GetImage()); |
72 if (!switches::IsNewProfileManagement() && !icon.IsEmpty()) { | |
73 // old avatar menu uses resized-small images | |
74 icon = profiles::GetAvatarIconForMenu(icon, true); | |
75 } | |
76 | |
77 std::unique_ptr<AvatarMenu::Item> item( | 71 std::unique_ptr<AvatarMenu::Item> item( |
78 new AvatarMenu::Item(items_.size(), entry->GetPath(), icon)); | 72 new AvatarMenu::Item(items_.size(), entry->GetPath(), icon)); |
79 item->name = user->GetDisplayName(); | 73 item->name = user->GetDisplayName(); |
80 item->username = entry->GetUserName(); | 74 item->username = entry->GetUserName(); |
81 DCHECK(!entry->IsLegacySupervised()); | 75 DCHECK(!entry->IsLegacySupervised()); |
82 item->legacy_supervised = false; | 76 item->legacy_supervised = false; |
83 item->child_account = entry->IsChild(); | 77 item->child_account = entry->IsChild(); |
84 item->signed_in = true; | 78 item->signed_in = true; |
85 item->active = item->profile_path == active_profile_path_; | 79 item->active = item->profile_path == active_profile_path_; |
86 item->signin_required = entry->IsSigninRequired(); | 80 item->signin_required = entry->IsSigninRequired(); |
(...skipping 15 matching lines...) Expand all Loading... |
102 // up in the model as a logged-in user. In that case, we return 0. | 96 // up in the model as a logged-in user. In that case, we return 0. |
103 return 0; | 97 return 0; |
104 } | 98 } |
105 | 99 |
106 void ProfileListChromeOS::ActiveProfilePathChanged( | 100 void ProfileListChromeOS::ActiveProfilePathChanged( |
107 const base::FilePath& active_profile_path) { | 101 const base::FilePath& active_profile_path) { |
108 active_profile_path_ = active_profile_path; | 102 active_profile_path_ = active_profile_path; |
109 } | 103 } |
110 | 104 |
111 } // namespace chromeos | 105 } // namespace chromeos |
OLD | NEW |