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" |
| 9 #include "base/scoped_observer.h" |
| 10 #include "chrome/browser/ui/views/toolbar/browser_actions_container_observer.h" |
8 #include "ui/views/view.h" | 11 #include "ui/views/view.h" |
9 | 12 |
10 class Browser; | 13 class Browser; |
11 class BrowserActionsContainer; | 14 class BrowserActionsContainer; |
| 15 class WrenchMenu; |
12 | 16 |
13 // ExtensionToolbarMenuView is the view containing the extension actions that | 17 // ExtensionToolbarMenuView is the view containing the extension actions that |
14 // overflowed from the BrowserActionsContainer, and is contained in and owned by | 18 // overflowed from the BrowserActionsContainer, and is contained in and owned by |
15 // the wrench menu. | 19 // the wrench menu. |
16 class ExtensionToolbarMenuView : public views::View { | 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. |
| 22 class ExtensionToolbarMenuView : public views::View, |
| 23 public BrowserActionsContainerObserver { |
17 public: | 24 public: |
18 explicit ExtensionToolbarMenuView(Browser* browser); | 25 ExtensionToolbarMenuView(Browser* browser, WrenchMenu* wrench_menu); |
19 virtual ~ExtensionToolbarMenuView(); | 26 virtual ~ExtensionToolbarMenuView(); |
20 | 27 |
21 // views::View: | 28 // views::View: |
22 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 29 virtual gfx::Size GetPreferredSize() const OVERRIDE; |
23 virtual void Layout() OVERRIDE; | 30 virtual void Layout() OVERRIDE; |
24 | 31 |
25 private: | 32 private: |
| 33 // BrowserActionsContainerObserver: |
| 34 virtual void OnBrowserActionDragDone() OVERRIDE; |
| 35 |
| 36 // The associated browser. |
26 Browser* browser_; | 37 Browser* browser_; |
| 38 |
| 39 // The WrenchMenu, which may need to be closed after a drag-and-drop. |
| 40 WrenchMenu* wrench_menu_; |
| 41 |
| 42 // The overflow BrowserActionsContainer which is nested in this view. |
27 BrowserActionsContainer* container_; | 43 BrowserActionsContainer* container_; |
28 | 44 |
| 45 ScopedObserver<BrowserActionsContainer, BrowserActionsContainerObserver> |
| 46 browser_actions_container_observer_; |
| 47 |
29 DISALLOW_COPY_AND_ASSIGN(ExtensionToolbarMenuView); | 48 DISALLOW_COPY_AND_ASSIGN(ExtensionToolbarMenuView); |
30 }; | 49 }; |
31 | 50 |
32 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_EXTENSION_TOOLBAR_MENU_VIEW_H_ | 51 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_EXTENSION_TOOLBAR_MENU_VIEW_H_ |
OLD | NEW |