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

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

Issue 12096094: Finalizing the 'OnClick' behavior of the Launcher items. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Corrected Windows Created 7 years, 10 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 (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 "base/i18n/case_conversion.h" 7 #include "base/i18n/case_conversion.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "grit/ui_resources.h" 10 #include "grit/ui_resources.h"
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 int bottom_margin = GetBottomMargin(); 769 int bottom_margin = GetBottomMargin();
770 int icon_y = top_margin + (height() - config.item_top_margin - 770 int icon_y = top_margin + (height() - config.item_top_margin -
771 bottom_margin - config.check_height) / 2; 771 bottom_margin - config.check_height) / 2;
772 int icon_height = config.check_height; 772 int icon_height = config.check_height;
773 int available_height = height() - top_margin - bottom_margin; 773 int available_height = height() - top_margin - bottom_margin;
774 774
775 // Render the background. As MenuScrollViewContainer draws the background, we 775 // Render the background. As MenuScrollViewContainer draws the background, we
776 // only need the background when we want it to look different, as when we're 776 // only need the background when we want it to look different, as when we're
777 // selected. 777 // selected.
778 ui::NativeTheme* native_theme = GetNativeTheme(); 778 ui::NativeTheme* native_theme = GetNativeTheme();
779 if (render_selection) { 779 SkColor override_color;
780 if (GetDelegate() &&
781 GetDelegate()->GetBackgroundColor(GetCommand(),
782 IsSelected(),
783 &override_color)) {
784 canvas->DrawColor(override_color, SkXfermode::kSrc_Mode);
sky 2013/01/31 21:15:02 I don't think you need kSrc_Mode here, meaning Dra
Mr4D (OOO till 08-26) 2013/01/31 22:38:52 Did it as it was done in line 794 - but done as re
785 } else if (render_selection) {
780 if (ui::NativeTheme::IsNewMenuStyleEnabled()) { 786 if (ui::NativeTheme::IsNewMenuStyleEnabled()) {
781 gfx::Rect item_bounds(0, 0, width(), height()); 787 gfx::Rect item_bounds(0, 0, width(), height());
782 AdjustBoundsForRTLUI(&item_bounds); 788 AdjustBoundsForRTLUI(&item_bounds);
783 CommonThemePaintMenuItemBackground(canvas->sk_canvas(), 789 CommonThemePaintMenuItemBackground(canvas->sk_canvas(),
784 ui::NativeTheme::kHovered, item_bounds); 790 ui::NativeTheme::kHovered, item_bounds);
785 } else { 791 } else {
786 SkColor bg_color = native_theme->GetSystemColor( 792 SkColor bg_color = native_theme->GetSystemColor(
787 ui::NativeTheme::kColorId_FocusedMenuItemBackgroundColor); 793 ui::NativeTheme::kColorId_FocusedMenuItemBackgroundColor);
788 canvas->DrawColor(bg_color, SkXfermode::kSrc_Mode); 794 canvas->DrawColor(bg_color, SkXfermode::kSrc_Mode);
789 } 795 }
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 temp_width = menu_item->GetMaxIconViewWidth(); 1020 temp_width = menu_item->GetMaxIconViewWidth();
1015 } else if (menu_item->icon_view()) { 1021 } else if (menu_item->icon_view()) {
1016 temp_width = menu_item->icon_view()->GetPreferredSize().width(); 1022 temp_width = menu_item->icon_view()->GetPreferredSize().width();
1017 } 1023 }
1018 width = std::max(width, temp_width); 1024 width = std::max(width, temp_width);
1019 } 1025 }
1020 return width; 1026 return width;
1021 } 1027 }
1022 1028
1023 } // namespace views 1029 } // namespace views
OLDNEW
« ui/views/controls/menu/menu_delegate.h ('K') | « ui/views/controls/menu/menu_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698