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/gfx/geometry/point.h" |
10 #include "ui/views/animation/ink_drop_host.h" | 10 #include "ui/views/animation/ink_drop_host.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 ui::MenuSourceType source_type) override; | 59 ui::MenuSourceType source_type) override; |
60 | 60 |
61 // views::InkDropHost: | 61 // views::InkDropHost: |
62 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; | 62 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; |
63 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; | 63 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; |
64 | 64 |
65 protected: | 65 protected: |
66 // views::LabelButton: | 66 // views::LabelButton: |
67 bool ShouldEnterPushedState(const ui::Event& event) override; | 67 bool ShouldEnterPushedState(const ui::Event& event) override; |
68 void NotifyClick(const ui::Event& event) override; | 68 void NotifyClick(const ui::Event& event) override; |
| 69 void OnClickCanceled(const ui::Event& event) override; |
69 | 70 |
70 // Returns if menu should be shown. Override this to change default behavior. | 71 // Returns if menu should be shown. Override this to change default behavior. |
71 virtual bool ShouldShowMenu(); | 72 virtual bool ShouldShowMenu(); |
72 | 73 |
73 // Function to show the dropdown menu. | 74 // Function to show the dropdown menu. |
74 virtual void ShowDropDownMenu(ui::MenuSourceType source_type); | 75 virtual void ShowDropDownMenu(ui::MenuSourceType source_type); |
75 | 76 |
76 views::InkDropAnimationController* ink_drop_animation_controller() { | 77 views::InkDropAnimationController* ink_drop_animation_controller() { |
77 return ink_drop_animation_controller_.get(); | 78 return ink_drop_animation_controller_.get(); |
78 } | 79 } |
79 | 80 |
80 private: | 81 private: |
81 // views::LabelButton: | 82 // views::LabelButton: |
82 const char* GetClassName() const override; | 83 const char* GetClassName() const override; |
83 | 84 |
84 // views::InkDropHost: | 85 // views::InkDropHost: |
85 gfx::Point CalculateInkDropCenter() const override; | 86 gfx::Point CalculateInkDropCenter() const override; |
86 | 87 |
87 // The model that populates the attached menu. | 88 // The model that populates the attached menu. |
88 scoped_ptr<ui::MenuModel> model_; | 89 scoped_ptr<ui::MenuModel> model_; |
89 | 90 |
90 // Indicates if menu is currently showing. | 91 // Indicates if menu is currently showing. |
91 bool menu_showing_; | 92 bool menu_showing_; |
92 | 93 |
93 // Y position of mouse when left mouse button is pressed | 94 // Y position of mouse when left mouse button is pressed. |
94 int y_position_on_lbuttondown_; | 95 int y_position_on_lbuttondown_; |
95 | 96 |
96 // Menu runner to display drop down menu. | 97 // Menu runner to display drop down menu. |
97 scoped_ptr<views::MenuRunner> menu_runner_; | 98 scoped_ptr<views::MenuRunner> menu_runner_; |
98 | 99 |
99 // Animation controller for the ink drop ripple effect. | 100 // Animation controller for the ink drop ripple effect. |
100 scoped_ptr<views::InkDropAnimationController> ink_drop_animation_controller_; | 101 scoped_ptr<views::InkDropAnimationController> ink_drop_animation_controller_; |
101 | 102 |
102 // A factory for tasks that show the dropdown context menu for the button. | 103 // A factory for tasks that show the dropdown context menu for the button. |
103 base::WeakPtrFactory<ToolbarButton> show_menu_factory_; | 104 base::WeakPtrFactory<ToolbarButton> show_menu_factory_; |
104 | 105 |
105 DISALLOW_COPY_AND_ASSIGN(ToolbarButton); | 106 DISALLOW_COPY_AND_ASSIGN(ToolbarButton); |
106 }; | 107 }; |
107 | 108 |
108 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ | 109 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ |
OLD | NEW |