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