OLD | NEW |
(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 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_CHEVRON_MENU_BUTTON_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_CHEVRON_MENU_BUTTON_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" |
| 11 #include "ui/views/controls/button/menu_button.h" |
| 12 #include "ui/views/controls/button/menu_button_listener.h" |
| 13 |
| 14 class BrowserActionsContainer; |
| 15 |
| 16 // The MenuButton for the chevron in the extension toolbar, which is also |
| 17 // responsible for showing the legacy (drop-down) overflow menu. |
| 18 class ChevronMenuButton : public views::MenuButton, |
| 19 public views::MenuButtonListener { |
| 20 public: |
| 21 explicit ChevronMenuButton( |
| 22 BrowserActionsContainer* browser_actions_container); |
| 23 virtual ~ChevronMenuButton(); |
| 24 |
| 25 // Closes the overflow menu (and any context menu), if it is open. |
| 26 void CloseMenu(); |
| 27 |
| 28 private: |
| 29 class MenuController; |
| 30 |
| 31 // views::MenuButton: |
| 32 virtual scoped_ptr<views::LabelButtonBorder> CreateDefaultBorder() const |
| 33 OVERRIDE; |
| 34 virtual bool GetDropFormats(int* formats, |
| 35 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; |
| 36 virtual bool AreDropTypesRequired() OVERRIDE; |
| 37 virtual bool CanDrop(const ui::OSExchangeData& data) OVERRIDE; |
| 38 virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE; |
| 39 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; |
| 40 virtual void OnDragExited() OVERRIDE; |
| 41 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; |
| 42 |
| 43 // views::MenuButtonListener: |
| 44 virtual void OnMenuButtonClicked(View* source, const gfx::Point& point) |
| 45 OVERRIDE; |
| 46 |
| 47 // Shows the overflow menu. |
| 48 void ShowOverflowMenu(bool for_drop); |
| 49 |
| 50 // Called by the overflow menu when all the work is done. |
| 51 void MenuDone(); |
| 52 |
| 53 // The owning BrowserActionsContainer. |
| 54 BrowserActionsContainer* browser_actions_container_; |
| 55 |
| 56 // The overflow menu controller. |
| 57 scoped_ptr<MenuController> menu_controller_; |
| 58 |
| 59 base::WeakPtrFactory<ChevronMenuButton> weak_factory_; |
| 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(ChevronMenuButton); |
| 62 }; |
| 63 |
| 64 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_CHEVRON_MENU_BUTTON_H_ |
OLD | NEW |