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

Side by Side Diff: chrome/browser/ui/views/toolbar/extension_toolbar_menu_view.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 | « chrome/browser/ui/views/toolbar/app_menu.cc ('k') | ui/views/BUILD.gn » ('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 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/toolbar/extension_toolbar_menu_view.h" 5 #include "chrome/browser/ui/views/toolbar/extension_toolbar_menu_view.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // views::ScrollView::GetPreferredSize() includes the contents' size, but 67 // views::ScrollView::GetPreferredSize() includes the contents' size, but
68 // not the scrollbar width. Add it in if necessary. 68 // not the scrollbar width. Add it in if necessary.
69 if (container_->GetPreferredSize().height() > max_height_) 69 if (container_->GetPreferredSize().height() > max_height_)
70 s.Enlarge(GetScrollBarWidth(), 0); 70 s.Enlarge(GetScrollBarWidth(), 0);
71 return s; 71 return s;
72 } 72 }
73 73
74 int ExtensionToolbarMenuView::GetHeightForWidth(int width) const { 74 int ExtensionToolbarMenuView::GetHeightForWidth(int width) const {
75 // The width passed in here includes the full width of the menu, so we need 75 // The width passed in here includes the full width of the menu, so we need
76 // to omit the necessary padding. 76 // to omit the necessary padding.
77 const views::MenuConfig& menu_config = views::MenuConfig::instance(); 77 const views::MenuConfig& menu_config =
78 static_cast<const views::MenuItemView*>(parent())->GetMenuConfig();
78 int end_padding = menu_config.arrow_to_edge_padding - 79 int end_padding = menu_config.arrow_to_edge_padding -
79 container_->toolbar_actions_bar()->platform_settings().item_spacing; 80 container_->toolbar_actions_bar()->platform_settings().item_spacing;
80 width -= start_padding() + end_padding; 81 width -= start_padding() + end_padding;
81 82
82 return views::ScrollView::GetHeightForWidth(width); 83 return views::ScrollView::GetHeightForWidth(width);
83 } 84 }
84 85
85 void ExtensionToolbarMenuView::Layout() { 86 void ExtensionToolbarMenuView::Layout() {
86 SetPosition(gfx::Point(start_padding(), 0)); 87 SetPosition(gfx::Point(start_padding(), 0));
87 SizeToPreferredSize(); 88 SizeToPreferredSize();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 } 134 }
134 135
135 int ExtensionToolbarMenuView::start_padding() const { 136 int ExtensionToolbarMenuView::start_padding() const {
136 // We pad enough on the left so that the first icon starts at the same point 137 // We pad enough on the left so that the first icon starts at the same point
137 // as the labels. We subtract kItemSpacing because there needs to be padding 138 // as the labels. We subtract kItemSpacing because there needs to be padding
138 // so we can see the drop indicator. 139 // so we can see the drop indicator.
139 return views::MenuItemView::label_start() - 140 return views::MenuItemView::label_start() -
140 container_->toolbar_actions_bar()->platform_settings().item_spacing; 141 container_->toolbar_actions_bar()->platform_settings().item_spacing;
141 } 142 }
142 143
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar/app_menu.cc ('k') | ui/views/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698