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

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

Issue 553233002: Dynamically calculate the number of extension icons to show per row in overflow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
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 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_EXTENSION_TOOLBAR_MENU_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_EXTENSION_TOOLBAR_MENU_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_EXTENSION_TOOLBAR_MENU_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_EXTENSION_TOOLBAR_MENU_VIEW_H_
7 7
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/scoped_observer.h" 9 #include "base/scoped_observer.h"
10 #include "chrome/browser/ui/views/toolbar/browser_actions_container_observer.h" 10 #include "chrome/browser/ui/views/toolbar/browser_actions_container_observer.h"
11 #include "ui/views/view.h" 11 #include "ui/views/view.h"
12 12
13 class Browser; 13 class Browser;
14 class BrowserActionsContainer; 14 class BrowserActionsContainer;
15 class WrenchMenu; 15 class WrenchMenu;
16 16
17 namespace views {
18 class MenuItemView;
19 }
20
17 // ExtensionToolbarMenuView is the view containing the extension actions that 21 // ExtensionToolbarMenuView is the view containing the extension actions that
18 // overflowed from the BrowserActionsContainer, and is contained in and owned by 22 // overflowed from the BrowserActionsContainer, and is contained in and owned by
19 // the wrench menu. 23 // the wrench menu.
20 // In the event that the WrenchMenu was opened for an Extension Action drag-and- 24 // In the event that the WrenchMenu was opened for an Extension Action drag-and-
21 // drop, this will also close the menu upon completion. 25 // drop, this will also close the menu upon completion.
22 class ExtensionToolbarMenuView : public views::View, 26 class ExtensionToolbarMenuView : public views::View,
23 public BrowserActionsContainerObserver { 27 public BrowserActionsContainerObserver {
24 public: 28 public:
25 ExtensionToolbarMenuView(Browser* browser, WrenchMenu* wrench_menu); 29 ExtensionToolbarMenuView(Browser* browser, WrenchMenu* wrench_menu);
26 virtual ~ExtensionToolbarMenuView(); 30 virtual ~ExtensionToolbarMenuView();
27 31
32 // Initialize the view and have it calculate the number of icons that will
33 // be shown on each row. This will likely cause a change in menu width.
34 void Init(views::MenuItemView* menu_root);
35
28 // views::View: 36 // views::View:
29 virtual gfx::Size GetPreferredSize() const OVERRIDE; 37 virtual gfx::Size GetPreferredSize() const OVERRIDE;
30 virtual void Layout() OVERRIDE; 38 virtual void Layout() OVERRIDE;
31 39
32 private: 40 private:
33 // BrowserActionsContainerObserver: 41 // BrowserActionsContainerObserver:
34 virtual void OnBrowserActionDragDone() OVERRIDE; 42 virtual void OnBrowserActionDragDone() OVERRIDE;
35 43
36 // The associated browser. 44 // The associated browser.
37 Browser* browser_; 45 Browser* browser_;
38 46
39 // The WrenchMenu, which may need to be closed after a drag-and-drop. 47 // The WrenchMenu, which may need to be closed after a drag-and-drop.
40 WrenchMenu* wrench_menu_; 48 WrenchMenu* wrench_menu_;
41 49
42 // The overflow BrowserActionsContainer which is nested in this view. 50 // The overflow BrowserActionsContainer which is nested in this view.
43 BrowserActionsContainer* container_; 51 BrowserActionsContainer* container_;
44 52
45 ScopedObserver<BrowserActionsContainer, BrowserActionsContainerObserver> 53 ScopedObserver<BrowserActionsContainer, BrowserActionsContainerObserver>
46 browser_actions_container_observer_; 54 browser_actions_container_observer_;
47 55
56 // The padding before the container's view.
57 int start_padding_;
58
59 // The padding between the container and the edge of the menu.
60 int end_padding_;
61
48 DISALLOW_COPY_AND_ASSIGN(ExtensionToolbarMenuView); 62 DISALLOW_COPY_AND_ASSIGN(ExtensionToolbarMenuView);
49 }; 63 };
50 64
51 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_EXTENSION_TOOLBAR_MENU_VIEW_H_ 65 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_EXTENSION_TOOLBAR_MENU_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698