| 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/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/scoped_observer.h" | 10 #include "base/scoped_observer.h" |
| 11 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_observer.h" | 11 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_observer.h" |
| 12 #include "ui/views/controls/scroll_view.h" | 12 #include "ui/views/controls/scroll_view.h" |
| 13 | 13 |
| 14 class AppMenu; | 14 class AppMenu; |
| 15 class Browser; | 15 class Browser; |
| 16 class BrowserActionsContainer; | 16 class BrowserActionsContainer; |
| 17 class ToolbarActionsBar; | 17 class ToolbarActionsBar; |
| 18 | 18 |
| 19 namespace views { |
| 20 class MenuItemView; |
| 21 } |
| 22 |
| 19 // ExtensionToolbarMenuView is the view containing the extension actions that | 23 // ExtensionToolbarMenuView is the view containing the extension actions that |
| 20 // overflowed from the BrowserActionsContainer, and is contained in and owned by | 24 // overflowed from the BrowserActionsContainer, and is contained in and owned by |
| 21 // the app menu. | 25 // the app menu. |
| 22 // In the event that the app menu was opened for an Extension Action drag-and- | 26 // In the event that the app menu was opened for an Extension Action drag-and- |
| 23 // drop, this will also close the menu upon completion. | 27 // drop, this will also close the menu upon completion. |
| 24 class ExtensionToolbarMenuView : public views::ScrollView, | 28 class ExtensionToolbarMenuView : public views::ScrollView, |
| 25 public ToolbarActionsBarObserver { | 29 public ToolbarActionsBarObserver { |
| 26 public: | 30 public: |
| 27 ExtensionToolbarMenuView(Browser* browser, AppMenu* app_menu); | 31 ExtensionToolbarMenuView(Browser* browser, |
| 32 AppMenu* app_menu, |
| 33 views::MenuItemView* menu_item); |
| 28 ~ExtensionToolbarMenuView() override; | 34 ~ExtensionToolbarMenuView() override; |
| 29 | 35 |
| 30 // Returns whether the app menu should show this view. This is true when | 36 // Returns whether the app menu should show this view. This is true when |
| 31 // either |container_| has icons to display or the menu was opened for a drag- | 37 // either |container_| has icons to display or the menu was opened for a drag- |
| 32 // and-drop operation. | 38 // and-drop operation. |
| 33 bool ShouldShow(); | 39 bool ShouldShow(); |
| 34 | 40 |
| 35 // views::View: | 41 // views::View: |
| 36 gfx::Size GetPreferredSize() const override; | 42 gfx::Size GetPreferredSize() const override; |
| 37 int GetHeightForWidth(int width) const override; | 43 int GetHeightForWidth(int width) const override; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 59 | 65 |
| 60 // Returns the padding before the BrowserActionsContainer in the menu. | 66 // Returns the padding before the BrowserActionsContainer in the menu. |
| 61 int start_padding() const; | 67 int start_padding() const; |
| 62 | 68 |
| 63 // The associated browser. | 69 // The associated browser. |
| 64 Browser* browser_; | 70 Browser* browser_; |
| 65 | 71 |
| 66 // The app menu, which may need to be closed after a drag-and-drop. | 72 // The app menu, which may need to be closed after a drag-and-drop. |
| 67 AppMenu* app_menu_; | 73 AppMenu* app_menu_; |
| 68 | 74 |
| 75 // The MenuItemView this view is contained within. |
| 76 views::MenuItemView* menu_item_; |
| 77 |
| 69 // The overflow BrowserActionsContainer which is nested in this view. | 78 // The overflow BrowserActionsContainer which is nested in this view. |
| 70 BrowserActionsContainer* container_; | 79 BrowserActionsContainer* container_; |
| 71 | 80 |
| 72 // The maximum allowed height for the view. | 81 // The maximum allowed height for the view. |
| 73 int max_height_; | 82 int max_height_; |
| 74 | 83 |
| 75 ScopedObserver<ToolbarActionsBar, ToolbarActionsBarObserver> | 84 ScopedObserver<ToolbarActionsBar, ToolbarActionsBarObserver> |
| 76 toolbar_actions_bar_observer_; | 85 toolbar_actions_bar_observer_; |
| 77 | 86 |
| 78 base::WeakPtrFactory<ExtensionToolbarMenuView> weak_factory_; | 87 base::WeakPtrFactory<ExtensionToolbarMenuView> weak_factory_; |
| 79 | 88 |
| 80 DISALLOW_COPY_AND_ASSIGN(ExtensionToolbarMenuView); | 89 DISALLOW_COPY_AND_ASSIGN(ExtensionToolbarMenuView); |
| 81 }; | 90 }; |
| 82 | 91 |
| 83 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_EXTENSION_TOOLBAR_MENU_VIEW_H_ | 92 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_EXTENSION_TOOLBAR_MENU_VIEW_H_ |
| OLD | NEW |