Chromium Code Reviews| 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 "base/memory/scoped_ptr.h" |
| 9 #include "ui/gfx/geometry/point.h" | |
| 9 #include "ui/views/animation/ink_drop_host.h" | 10 #include "ui/views/animation/ink_drop_host.h" |
| 10 #include "ui/views/context_menu_controller.h" | 11 #include "ui/views/context_menu_controller.h" |
| 11 #include "ui/views/controls/button/button.h" | 12 #include "ui/views/controls/button/button.h" |
| 12 #include "ui/views/controls/button/label_button.h" | 13 #include "ui/views/controls/button/label_button.h" |
| 13 | 14 |
| 14 namespace ui { | 15 namespace ui { |
| 15 class MenuModel; | 16 class MenuModel; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace views { | 19 namespace views { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; | 62 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; |
| 62 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; | 63 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; |
| 63 | 64 |
| 64 protected: | 65 protected: |
| 65 // Overridden from CustomButton. Returns true if the button should become | 66 // Overridden from CustomButton. Returns true if the button should become |
| 66 // pressed when a user holds the mouse down over the button. For this | 67 // pressed when a user holds the mouse down over the button. For this |
| 67 // implementation, both left and right mouse buttons can trigger a change | 68 // implementation, both left and right mouse buttons can trigger a change |
| 68 // to the PUSHED state. | 69 // to the PUSHED state. |
| 69 bool ShouldEnterPushedState(const ui::Event& event) override; | 70 bool ShouldEnterPushedState(const ui::Event& event) override; |
| 70 | 71 |
| 72 // views::LabelButton: | |
|
Peter Kasting
2015/09/09 22:50:46
Nit: I would put this heading over both the overri
bruthig
2015/09/10 14:57:38
Done.
| |
| 73 void NotifyClick(const ui::Event& event) override; | |
| 74 | |
| 71 // Returns if menu should be shown. Override this to change default behavior. | 75 // Returns if menu should be shown. Override this to change default behavior. |
| 72 virtual bool ShouldShowMenu(); | 76 virtual bool ShouldShowMenu(); |
| 73 | 77 |
| 74 // Function to show the dropdown menu. | 78 // Function to show the dropdown menu. |
| 75 virtual void ShowDropDownMenu(ui::MenuSourceType source_type); | 79 virtual void ShowDropDownMenu(ui::MenuSourceType source_type); |
| 76 | 80 |
| 77 virtual void LayoutInkDrop(); | 81 // Returns the Point where the ink drop should be centered. |
| 82 virtual gfx::Point CalculateInkDropCenter() const; | |
| 78 | 83 |
| 79 views::InkDropAnimationController* ink_drop_animation_controller() { | 84 views::InkDropAnimationController* ink_drop_animation_controller() { |
| 80 return ink_drop_animation_controller_.get(); | 85 return ink_drop_animation_controller_.get(); |
| 81 } | 86 } |
| 82 | 87 |
| 83 private: | 88 private: |
| 84 // views::LabelButton: | 89 // views::LabelButton: |
| 85 const char* GetClassName() const override; | 90 const char* GetClassName() const override; |
| 86 | 91 |
| 87 // The model that populates the attached menu. | 92 // The model that populates the attached menu. |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 99 // Animation controller for the ink drop ripple effect. | 104 // Animation controller for the ink drop ripple effect. |
| 100 scoped_ptr<views::InkDropAnimationController> ink_drop_animation_controller_; | 105 scoped_ptr<views::InkDropAnimationController> ink_drop_animation_controller_; |
| 101 | 106 |
| 102 // A factory for tasks that show the dropdown context menu for the button. | 107 // A factory for tasks that show the dropdown context menu for the button. |
| 103 base::WeakPtrFactory<ToolbarButton> show_menu_factory_; | 108 base::WeakPtrFactory<ToolbarButton> show_menu_factory_; |
| 104 | 109 |
| 105 DISALLOW_COPY_AND_ASSIGN(ToolbarButton); | 110 DISALLOW_COPY_AND_ASSIGN(ToolbarButton); |
| 106 }; | 111 }; |
| 107 | 112 |
| 108 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ | 113 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ |
| OLD | NEW |