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

Side by Side Diff: chrome/browser/ui/views/profiles/profile_chooser_view.cc

Issue 2910153002: Remove views::Label::SetDisabledColor(). Replace with typography colors. (Closed)
Patch Set: rebase for r476345 Created 3 years, 6 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 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/ui/views/profiles/profile_chooser_view.h" 5 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/metrics/user_metrics.h" 8 #include "base/metrics/user_metrics.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/app/vector_icons/vector_icons.h" 10 #include "chrome/app/vector_icons/vector_icons.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 // view might both have the selection highlight. 237 // view might both have the selection highlight.
238 if (state() == STATE_HOVERED || state() == STATE_PRESSED) 238 if (state() == STATE_HOVERED || state() == STATE_PRESSED)
239 RequestFocus(); 239 RequestFocus();
240 else if (state() == STATE_NORMAL && HasFocus()) 240 else if (state() == STATE_NORMAL && HasFocus())
241 GetFocusManager()->SetFocusedView(nullptr); 241 GetFocusManager()->SetFocusedView(nullptr);
242 242
243 UpdateColors(); 243 UpdateColors();
244 } 244 }
245 245
246 void UpdateColors() { 246 void UpdateColors() {
247 // TODO(tapted): This should use views::style::GetColor() to obtain grey
248 // text where it's needed. But note |subtitle_| is used to draw an email,
249 // which might not be grey in Harmony.
247 bool is_selected = HasFocus(); 250 bool is_selected = HasFocus();
248 251
249 set_background( 252 set_background(
250 is_selected 253 is_selected
251 ? views::Background::CreateSolidBackground( 254 ? views::Background::CreateSolidBackground(
252 GetNativeTheme()->GetSystemColor( 255 GetNativeTheme()->GetSystemColor(
253 ui::NativeTheme::kColorId_FocusedMenuItemBackgroundColor)) 256 ui::NativeTheme::kColorId_FocusedMenuItemBackgroundColor))
254 : nullptr); 257 : nullptr);
255 258
256 SkColor text_color = GetNativeTheme()->GetSystemColor( 259 SkColor text_color = GetNativeTheme()->GetSystemColor(
257 is_selected ? ui::NativeTheme::kColorId_SelectedMenuItemForegroundColor 260 is_selected ? ui::NativeTheme::kColorId_SelectedMenuItemForegroundColor
258 : ui::NativeTheme::kColorId_LabelEnabledColor); 261 : ui::NativeTheme::kColorId_LabelEnabledColor);
259 SetEnabledTextColors(text_color); 262 SetEnabledTextColors(text_color);
260 if (title_) 263 if (title_)
261 title_->SetEnabledColor(text_color); 264 title_->SetEnabledColor(text_color);
262 265
263 if (subtitle_) { 266 if (subtitle_) {
264 DCHECK(!subtitle_->enabled()); 267 subtitle_->SetEnabledColor(GetNativeTheme()->GetSystemColor(
265 subtitle_->SetDisabledColor(GetNativeTheme()->GetSystemColor(
266 is_selected 268 is_selected
267 ? ui::NativeTheme::kColorId_DisabledMenuItemForegroundColor 269 ? ui::NativeTheme::kColorId_DisabledMenuItemForegroundColor
268 : ui::NativeTheme::kColorId_LabelDisabledColor)); 270 : ui::NativeTheme::kColorId_LabelDisabledColor));
269 } 271 }
270 } 272 }
271 273
272 views::Label* title_; 274 views::Label* title_;
273 views::Label* subtitle_; 275 views::Label* subtitle_;
274 276
275 DISALLOW_COPY_AND_ASSIGN(BackgroundColorHoverButton); 277 DISALLOW_COPY_AND_ASSIGN(BackgroundColorHoverButton);
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 new BackgroundColorHoverButton(this, button_text); 1166 new BackgroundColorHoverButton(this, button_text);
1165 manage_accounts_button_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 1167 manage_accounts_button_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
1166 manage_accounts_button_->SetMinSize( 1168 manage_accounts_button_->SetMinSize(
1167 gfx::Size(kFixedMenuWidth, kButtonHeight)); 1169 gfx::Size(kFixedMenuWidth, kButtonHeight));
1168 view->AddChildView(manage_accounts_button_); 1170 view->AddChildView(manage_accounts_button_);
1169 } else { 1171 } else {
1170 views::Label* email_label = new views::Label(avatar_item.username); 1172 views::Label* email_label = new views::Label(avatar_item.username);
1171 current_profile_card->set_subtitle(email_label); 1173 current_profile_card->set_subtitle(email_label);
1172 email_label->SetAutoColorReadabilityEnabled(false); 1174 email_label->SetAutoColorReadabilityEnabled(false);
1173 email_label->SetElideBehavior(gfx::ELIDE_EMAIL); 1175 email_label->SetElideBehavior(gfx::ELIDE_EMAIL);
1174 email_label->SetEnabled(false);
1175 email_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 1176 email_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
1176 grid_layout->StartRow(1, 0); 1177 grid_layout->StartRow(1, 0);
1177 // Skip first column for the profile icon. 1178 // Skip first column for the profile icon.
1178 grid_layout->SkipColumns(1); 1179 grid_layout->SkipColumns(1);
1179 grid_layout->AddView(email_label, 1, 1, views::GridLayout::LEADING, 1180 grid_layout->AddView(email_label, 1, 1, views::GridLayout::LEADING,
1180 views::GridLayout::LEADING); 1181 views::GridLayout::LEADING);
1181 } 1182 }
1182 1183
1183 current_profile_card_->SetAccessibleName( 1184 current_profile_card_->SetAccessibleName(
1184 l10n_util::GetStringFUTF16( 1185 l10n_util::GetStringFUTF16(
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 1626 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
1626 IncognitoModePrefs::DISABLED; 1627 IncognitoModePrefs::DISABLED;
1627 return incognito_available && !browser_->profile()->IsGuestSession(); 1628 return incognito_available && !browser_->profile()->IsGuestSession();
1628 } 1629 }
1629 1630
1630 void ProfileChooserView::PostActionPerformed( 1631 void ProfileChooserView::PostActionPerformed(
1631 ProfileMetrics::ProfileDesktopMenu action_performed) { 1632 ProfileMetrics::ProfileDesktopMenu action_performed) {
1632 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); 1633 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_);
1633 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; 1634 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE;
1634 } 1635 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698