OLD | NEW |
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/controls/scroll_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 // ExtensionToolbarMenuView is the view containing the extension actions that | 17 // ExtensionToolbarMenuView is the view containing the extension actions that |
18 // overflowed from the BrowserActionsContainer, and is contained in and owned by | 18 // overflowed from the BrowserActionsContainer, and is contained in and owned by |
19 // the wrench menu. | 19 // the wrench menu. |
20 // In the event that the WrenchMenu was opened for an Extension Action drag-and- | 20 // In the event that the WrenchMenu was opened for an Extension Action drag-and- |
21 // drop, this will also close the menu upon completion. | 21 // drop, this will also close the menu upon completion. |
22 class ExtensionToolbarMenuView : public views::View, | 22 class ExtensionToolbarMenuView : public views::ScrollView, |
23 public BrowserActionsContainerObserver { | 23 public BrowserActionsContainerObserver { |
24 public: | 24 public: |
25 ExtensionToolbarMenuView(Browser* browser, WrenchMenu* wrench_menu); | 25 ExtensionToolbarMenuView(Browser* browser, WrenchMenu* wrench_menu); |
26 ~ExtensionToolbarMenuView() override; | 26 ~ExtensionToolbarMenuView() override; |
27 | 27 |
28 // Returns whether the wrench menu should show this view. This is true when | 28 // Returns whether the wrench menu should show this view. This is true when |
29 // either |container_| has icons to display or the menu was opened for a drag- | 29 // either |container_| has icons to display or the menu was opened for a drag- |
30 // and-drop operation. | 30 // and-drop operation. |
31 bool ShouldShow(); | 31 bool ShouldShow(); |
32 | 32 |
(...skipping 18 matching lines...) Expand all Loading... |
51 | 51 |
52 // The associated browser. | 52 // The associated browser. |
53 Browser* browser_; | 53 Browser* browser_; |
54 | 54 |
55 // The WrenchMenu, which may need to be closed after a drag-and-drop. | 55 // The WrenchMenu, which may need to be closed after a drag-and-drop. |
56 WrenchMenu* wrench_menu_; | 56 WrenchMenu* wrench_menu_; |
57 | 57 |
58 // The overflow BrowserActionsContainer which is nested in this view. | 58 // The overflow BrowserActionsContainer which is nested in this view. |
59 BrowserActionsContainer* container_; | 59 BrowserActionsContainer* container_; |
60 | 60 |
| 61 // The maximum allowed height for the view. |
| 62 int max_height_; |
| 63 |
61 ScopedObserver<BrowserActionsContainer, BrowserActionsContainerObserver> | 64 ScopedObserver<BrowserActionsContainer, BrowserActionsContainerObserver> |
62 browser_actions_container_observer_; | 65 browser_actions_container_observer_; |
63 | 66 |
64 base::WeakPtrFactory<ExtensionToolbarMenuView> weak_factory_; | 67 base::WeakPtrFactory<ExtensionToolbarMenuView> weak_factory_; |
65 | 68 |
66 DISALLOW_COPY_AND_ASSIGN(ExtensionToolbarMenuView); | 69 DISALLOW_COPY_AND_ASSIGN(ExtensionToolbarMenuView); |
67 }; | 70 }; |
68 | 71 |
69 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_EXTENSION_TOOLBAR_MENU_VIEW_H_ | 72 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_EXTENSION_TOOLBAR_MENU_VIEW_H_ |
OLD | NEW |