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

Side by Side Diff: ui/views/controls/menu/menu_item_view.cc

Issue 2382443007: Clean up NativeTheme (particularly CommonTheme). (Closed)
Patch Set: share color constant Created 4 years, 2 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
« no previous file with comments | « ui/views/controls/menu/menu_delegate.cc ('k') | ui/views/style/platform_style.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/controls/menu/menu_item_view.h" 5 #include "ui/views/controls/menu/menu_item_view.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/i18n/case_conversion.h" 9 #include "base/i18n/case_conversion.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 const int bottom_margin = GetBottomMargin(); 776 const int bottom_margin = GetBottomMargin();
777 const int available_height = height() - top_margin - bottom_margin; 777 const int available_height = height() - top_margin - bottom_margin;
778 778
779 // Calculate some colors. 779 // Calculate some colors.
780 ui::NativeTheme::ColorId color_id; 780 ui::NativeTheme::ColorId color_id;
781 if (enabled()) { 781 if (enabled()) {
782 color_id = render_selection ? 782 color_id = render_selection ?
783 ui::NativeTheme::kColorId_SelectedMenuItemForegroundColor: 783 ui::NativeTheme::kColorId_SelectedMenuItemForegroundColor:
784 ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor; 784 ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor;
785 } else { 785 } else {
786 bool emphasized = delegate && 786 bool emphasized =
787 delegate->GetShouldUseDisabledEmphasizedForegroundColor( 787 delegate && delegate->GetShouldUseNormalForegroundColor(GetCommand());
788 GetCommand()); 788 color_id = emphasized
789 color_id = emphasized ? 789 ? ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor
790 ui::NativeTheme::kColorId_DisabledEmphasizedMenuItemForegroundColor : 790 : ui::NativeTheme::kColorId_DisabledMenuItemForegroundColor;
791 ui::NativeTheme::kColorId_DisabledMenuItemForegroundColor;
792 } 791 }
793 SkColor fg_color = native_theme->GetSystemColor(color_id); 792 SkColor fg_color = native_theme->GetSystemColor(color_id);
794 SkColor override_foreground_color; 793 SkColor override_foreground_color;
795 if (delegate && delegate->GetForegroundColor(GetCommand(), 794 if (delegate && delegate->GetForegroundColor(GetCommand(),
796 render_selection, 795 render_selection,
797 &override_foreground_color)) { 796 &override_foreground_color)) {
798 fg_color = override_foreground_color; 797 fg_color = override_foreground_color;
799 } 798 }
800 SkColor icon_color = color_utils::DeriveDefaultIconColor(fg_color); 799 SkColor icon_color = color_utils::DeriveDefaultIconColor(fg_color);
801 800
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 } else { 1076 } else {
1078 const Type& type = menu_item->GetType(); 1077 const Type& type = menu_item->GetType();
1079 if (type == CHECKBOX || type == RADIO) 1078 if (type == CHECKBOX || type == RADIO)
1080 return true; 1079 return true;
1081 } 1080 }
1082 } 1081 }
1083 return false; 1082 return false;
1084 } 1083 }
1085 1084
1086 } // namespace views 1085 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_delegate.cc ('k') | ui/views/style/platform_style.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698