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