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

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

Issue 1514693006: Revert of Use a single views::MenuConfig instance for each platform (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase revert on https://codereview.chromium.org/1504743003 Created 5 years 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_separator.h ('k') | ui/views/controls/menu/submenu_view.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_separator.h" 5 #include "ui/views/controls/menu/menu_separator.h"
6 6
7 #include "third_party/skia/include/core/SkColor.h" 7 #include "third_party/skia/include/core/SkColor.h"
8 #include "ui/gfx/canvas.h" 8 #include "ui/gfx/canvas.h"
9 #include "ui/native_theme/native_theme.h" 9 #include "ui/native_theme/native_theme.h"
10 #include "ui/views/controls/menu/menu_config.h" 10 #include "ui/views/controls/menu/menu_config.h"
11 #include "ui/views/controls/menu/menu_item_view.h"
11 12
12 namespace { 13 namespace {
13 14
14 const int kSeparatorHeight = 1; 15 const int kSeparatorHeight = 1;
15 16
16 } // namespace 17 } // namespace
17 18
18 namespace views { 19 namespace views {
19 20
20 #if !defined(OS_WIN) 21 #if !defined(OS_WIN)
21 void MenuSeparator::OnPaint(gfx::Canvas* canvas) { 22 void MenuSeparator::OnPaint(gfx::Canvas* canvas) {
22 OnPaintAura(canvas); 23 OnPaintAura(canvas);
23 } 24 }
24 #endif 25 #endif
25 26
26 gfx::Size MenuSeparator::GetPreferredSize() const { 27 gfx::Size MenuSeparator::GetPreferredSize() const {
27 const MenuConfig& menu_config = MenuConfig::instance(); 28 const MenuConfig& menu_config = parent_menu_item_->GetMenuConfig();
28 int height = menu_config.separator_height; 29 int height = menu_config.separator_height;
29 switch(type_) { 30 switch(type_) {
30 case ui::SPACING_SEPARATOR: 31 case ui::SPACING_SEPARATOR:
31 height = menu_config.separator_spacing_height; 32 height = menu_config.separator_spacing_height;
32 break; 33 break;
33 case ui::LOWER_SEPARATOR: 34 case ui::LOWER_SEPARATOR:
34 height = menu_config.separator_lower_height; 35 height = menu_config.separator_lower_height;
35 break; 36 break;
36 case ui::UPPER_SEPARATOR: 37 case ui::UPPER_SEPARATOR:
37 height = menu_config.separator_upper_height; 38 height = menu_config.separator_upper_height;
(...skipping 15 matching lines...) Expand all
53 case ui::SPACING_SEPARATOR: 54 case ui::SPACING_SEPARATOR:
54 return gfx::Rect(); 55 return gfx::Rect();
55 case ui::UPPER_SEPARATOR: 56 case ui::UPPER_SEPARATOR:
56 break; 57 break;
57 default: 58 default:
58 pos = height() / 2; 59 pos = height() / 2;
59 break; 60 break;
60 } 61 }
61 62
62 gfx::Rect paint_rect(0, pos, width(), kSeparatorHeight); 63 gfx::Rect paint_rect(0, pos, width(), kSeparatorHeight);
63 if (MenuConfig::instance().use_outer_border) 64 if (parent_menu_item_->GetMenuConfig().use_outer_border)
64 paint_rect.Inset(1, 0); 65 paint_rect.Inset(1, 0);
65 return paint_rect; 66 return paint_rect;
66 } 67 }
67 68
68 void MenuSeparator::OnPaintAura(gfx::Canvas* canvas) { 69 void MenuSeparator::OnPaintAura(gfx::Canvas* canvas) {
69 canvas->FillRect(GetPaintBounds(), 70 canvas->FillRect(GetPaintBounds(),
70 GetNativeTheme()->GetSystemColor( 71 GetNativeTheme()->GetSystemColor(
71 ui::NativeTheme::kColorId_MenuSeparatorColor)); 72 ui::NativeTheme::kColorId_MenuSeparatorColor));
72 } 73 }
73 74
74 } // namespace views 75 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_separator.h ('k') | ui/views/controls/menu/submenu_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698