| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_TOOLBAR_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 namespace views { | 26 namespace views { |
| 27 class MenuModelAdapter; | 27 class MenuModelAdapter; |
| 28 class MenuRunner; | 28 class MenuRunner; |
| 29 } | 29 } |
| 30 | 30 |
| 31 // This class provides basic drawing and mouse-over behavior for buttons | 31 // This class provides basic drawing and mouse-over behavior for buttons |
| 32 // appearing in the toolbar. | 32 // appearing in the toolbar. |
| 33 class ToolbarButton : public views::LabelButton, | 33 class ToolbarButton : public views::LabelButton, |
| 34 public views::ContextMenuController { | 34 public views::ContextMenuController { |
| 35 public: | 35 public: |
| 36 // Padding inside the border (around the image). |
| 37 static constexpr int kInteriorPadding = 6; |
| 38 |
| 36 // Takes ownership of the |model|, which can be null if no menu | 39 // Takes ownership of the |model|, which can be null if no menu |
| 37 // is to be shown. | 40 // is to be shown. |
| 38 ToolbarButton(Profile* profile, | 41 ToolbarButton(Profile* profile, |
| 39 views::ButtonListener* listener, | 42 views::ButtonListener* listener, |
| 40 ui::MenuModel* model); | 43 ui::MenuModel* model); |
| 41 ~ToolbarButton() override; | 44 ~ToolbarButton() override; |
| 42 | 45 |
| 43 // Set up basic mouseover border behavior. | 46 // Set up basic mouseover border behavior. |
| 44 // Should be called before first paint. | 47 // Should be called before first paint. |
| 45 void Init(); | 48 void Init(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // Menu runner to display drop down menu. | 103 // Menu runner to display drop down menu. |
| 101 std::unique_ptr<views::MenuRunner> menu_runner_; | 104 std::unique_ptr<views::MenuRunner> menu_runner_; |
| 102 | 105 |
| 103 // A factory for tasks that show the dropdown context menu for the button. | 106 // A factory for tasks that show the dropdown context menu for the button. |
| 104 base::WeakPtrFactory<ToolbarButton> show_menu_factory_; | 107 base::WeakPtrFactory<ToolbarButton> show_menu_factory_; |
| 105 | 108 |
| 106 DISALLOW_COPY_AND_ASSIGN(ToolbarButton); | 109 DISALLOW_COPY_AND_ASSIGN(ToolbarButton); |
| 107 }; | 110 }; |
| 108 | 111 |
| 109 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ | 112 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ |
| OLD | NEW |