Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / views / toolbar / chevron_menu_button.h
blob582ee34f65b7e84f740bf7bf17b955ceed52f789
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.
5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_CHEVRON_MENU_BUTTON_H_
6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_CHEVRON_MENU_BUTTON_H_
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"
14 class BrowserActionsContainer;
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 ~ChevronMenuButton() override;
25 // Closes the overflow menu (and any context menu), if it is open.
26 void CloseMenu();
28 private:
29 class MenuController;
31 // views::MenuButton:
32 scoped_ptr<views::LabelButtonBorder> CreateDefaultBorder() const override;
33 bool GetDropFormats(
34 int* formats,
35 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) override;
36 bool AreDropTypesRequired() override;
37 bool CanDrop(const ui::OSExchangeData& data) override;
38 void OnDragEntered(const ui::DropTargetEvent& event) override;
39 int OnDragUpdated(const ui::DropTargetEvent& event) override;
40 void OnDragExited() override;
41 int OnPerformDrop(const ui::DropTargetEvent& event) override;
43 // views::MenuButtonListener:
44 void OnMenuButtonClicked(View* source, const gfx::Point& point) override;
46 // Shows the overflow menu.
47 void ShowOverflowMenu(bool for_drop);
49 // Called by the overflow menu when all the work is done.
50 void MenuDone();
52 // The owning BrowserActionsContainer.
53 BrowserActionsContainer* browser_actions_container_;
55 // The overflow menu controller.
56 scoped_ptr<MenuController> menu_controller_;
58 base::WeakPtrFactory<ChevronMenuButton> weak_factory_;
60 DISALLOW_COPY_AND_ASSIGN(ChevronMenuButton);
63 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_CHEVRON_MENU_BUTTON_H_