| 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 "base/memory/scoped_ptr.h" |
| 8 #include "ui/views/context_menu_controller.h" | 9 #include "ui/views/context_menu_controller.h" |
| 9 #include "ui/views/controls/button/button.h" | 10 #include "ui/views/controls/button/button.h" |
| 10 #include "ui/views/controls/button/label_button.h" | 11 #include "ui/views/controls/button/label_button.h" |
| 11 | 12 |
| 12 namespace ui { | 13 namespace ui { |
| 13 class MenuModel; | 14 class MenuModel; |
| 14 } | 15 } |
| 15 | 16 |
| 16 namespace views { | 17 namespace views { |
| 18 class InkDropAnimationController; |
| 17 class MenuRunner; | 19 class MenuRunner; |
| 18 } | 20 } |
| 19 | 21 |
| 20 // This class provides basic drawing and mouse-over behavior for buttons | 22 // This class provides basic drawing and mouse-over behavior for buttons |
| 21 // appearing in the toolbar. | 23 // appearing in the toolbar. |
| 22 class ToolbarButton : public views::LabelButton, | 24 class ToolbarButton : public views::LabelButton, |
| 23 public views::ContextMenuController { | 25 public views::ContextMenuController { |
| 24 public: | 26 public: |
| 25 // Takes ownership of the |model|, which can be null if no menu | 27 // Takes ownership of the |model|, which can be null if no menu |
| 26 // is to be shown. | 28 // is to be shown. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 76 |
| 75 // Indicates if menu is currently showing. | 77 // Indicates if menu is currently showing. |
| 76 bool menu_showing_; | 78 bool menu_showing_; |
| 77 | 79 |
| 78 // Y position of mouse when left mouse button is pressed | 80 // Y position of mouse when left mouse button is pressed |
| 79 int y_position_on_lbuttondown_; | 81 int y_position_on_lbuttondown_; |
| 80 | 82 |
| 81 // Menu runner to display drop down menu. | 83 // Menu runner to display drop down menu. |
| 82 scoped_ptr<views::MenuRunner> menu_runner_; | 84 scoped_ptr<views::MenuRunner> menu_runner_; |
| 83 | 85 |
| 86 // Animation controller for the ink drop ripple effect. |
| 87 scoped_ptr<views::InkDropAnimationController> ink_drop_animation_controller_; |
| 88 |
| 84 // A factory for tasks that show the dropdown context menu for the button. | 89 // A factory for tasks that show the dropdown context menu for the button. |
| 85 base::WeakPtrFactory<ToolbarButton> show_menu_factory_; | 90 base::WeakPtrFactory<ToolbarButton> show_menu_factory_; |
| 86 | 91 |
| 87 DISALLOW_COPY_AND_ASSIGN(ToolbarButton); | 92 DISALLOW_COPY_AND_ASSIGN(ToolbarButton); |
| 88 }; | 93 }; |
| 89 | 94 |
| 90 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ | 95 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ |
| OLD | NEW |