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

Side by Side Diff: chrome/browser/ui/views/toolbar/extension_toolbar_menu_view.cc

Issue 324393002: Extension Toolbar redesign, part 1 (overflow) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Peter's comments Created 6 years, 5 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/views/toolbar/extension_toolbar_menu_view.h"
6
7 #include "chrome/browser/ui/views/frame/browser_view.h"
8 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h"
9 #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
10 #include "ui/views/controls/menu/menu_item_view.h"
11
12 namespace {
13
14 // TODO(devlin): Figure out why the bottom few pixels of the last row in the
15 // overflow menu are cut off (so we can remove this).
Peter Kasting 2014/07/02 20:54:01 Nit: Move TODO to be just after this next sentence
16 // Bottom padding to make sure we have enough room for the icons.
17 const int kVerticalPadding = 8;
18
19 } // namespace
20
21 ExtensionToolbarMenuView::ExtensionToolbarMenuView(Browser* browser)
22 : browser_(browser) {
23 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser);
24 container_ = new BrowserActionsContainer(
25 browser_,
26 NULL, // No owner view, means no extra keybindings are registered.
27 browser_view->GetToolbarView()->browser_actions());
28 container_->Init();
29 AddChildView(container_);
30 }
31
32 ExtensionToolbarMenuView::~ExtensionToolbarMenuView() {
33 }
34
35 gfx::Size ExtensionToolbarMenuView::GetPreferredSize() const {
36 gfx::Size sz = container_->GetPreferredSize();
37 if (sz.height() == 0)
38 return sz;
39
40 sz.Enlarge(0, kVerticalPadding);
41 return sz;
42 }
43
44 void ExtensionToolbarMenuView::Layout() {
45 // All buttons are given the same width.
46 gfx::Size sz = container_->GetPreferredSize();
47 container_->SetBounds(views::MenuItemView::label_start(),
48 0,
49 sz.width(),
50 sz.height() + (kVerticalPadding / 2));
51 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698