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

Side by Side Diff: chrome/browser/profiles/profile_list_desktop.cc

Issue 235833002: [Mac] Redesign the avatar bubble UI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unittest broken by rebase Created 6 years, 8 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 | Annotate | Revision Log
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/profiles/profile_list_desktop.h" 5 #include "chrome/browser/profiles/profile_list_desktop.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 8 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
9 #include "chrome/browser/profiles/profile_info_cache.h" 9 #include "chrome/browser/profiles/profile_info_cache.h"
10 #include "components/signin/core/common/profile_management_switches.h" 10 #include "components/signin/core/common/profile_management_switches.h"
(...skipping 25 matching lines...) Expand all
36 36
37 void ProfileListDesktop::RebuildMenu() { 37 void ProfileListDesktop::RebuildMenu() {
38 ClearMenu(); 38 ClearMenu();
39 39
40 const size_t count = profile_info_->GetNumberOfProfiles(); 40 const size_t count = profile_info_->GetNumberOfProfiles();
41 for (size_t i = 0; i < count; ++i) { 41 for (size_t i = 0; i < count; ++i) {
42 if (profile_info_->IsOmittedProfileAtIndex(i)) { 42 if (profile_info_->IsOmittedProfileAtIndex(i)) {
43 omitted_item_count_++; 43 omitted_item_count_++;
44 continue; 44 continue;
45 } 45 }
46 bool is_gaia_picture =
47 profile_info_->IsUsingGAIAPictureOfProfileAtIndex(i) &&
48 profile_info_->GetGAIAPictureOfProfileAtIndex(i);
49
50 gfx::Image icon = profile_info_->GetAvatarIconOfProfileAtIndex(i); 46 gfx::Image icon = profile_info_->GetAvatarIconOfProfileAtIndex(i);
51 if (!switches::IsNewProfileManagement()) {
52 // The old avatar menu uses resized-small images.
53 icon = profiles::GetAvatarIconForMenu(icon, is_gaia_picture);
54 }
55
56 AvatarMenu::Item* item = new AvatarMenu::Item(i - omitted_item_count_, 47 AvatarMenu::Item* item = new AvatarMenu::Item(i - omitted_item_count_,
57 i, 48 i,
58 icon); 49 icon);
59 item->name = profile_info_->GetNameOfProfileAtIndex(i); 50 item->name = profile_info_->GetNameOfProfileAtIndex(i);
60 item->sync_state = profile_info_->GetUserNameOfProfileAtIndex(i); 51 item->sync_state = profile_info_->GetUserNameOfProfileAtIndex(i);
61 item->profile_path = profile_info_->GetPathOfProfileAtIndex(i); 52 item->profile_path = profile_info_->GetPathOfProfileAtIndex(i);
62 item->managed = profile_info_->ProfileIsManagedAtIndex(i); 53 item->managed = profile_info_->ProfileIsManagedAtIndex(i);
63 item->signed_in = !item->sync_state.empty(); 54 item->signed_in = !item->sync_state.empty();
64 if (!item->signed_in) { 55 if (!item->signed_in) {
65 item->sync_state = l10n_util::GetStringUTF16( 56 item->sync_state = l10n_util::GetStringUTF16(
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 89 }
99 90
100 void ProfileListDesktop::ActiveProfilePathChanged(base::FilePath& path) { 91 void ProfileListDesktop::ActiveProfilePathChanged(base::FilePath& path) {
101 active_profile_path_ = path; 92 active_profile_path_ = path;
102 } 93 }
103 94
104 void ProfileListDesktop::ClearMenu() { 95 void ProfileListDesktop::ClearMenu() {
105 STLDeleteElements(&items_); 96 STLDeleteElements(&items_);
106 omitted_item_count_ = 0; 97 omitted_item_count_ = 0;
107 } 98 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698