| 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 "ui/views/context_menu_controller.h" | 8 #include "ui/views/context_menu_controller.h" |
| 9 #include "ui/views/controls/button/button.h" | 9 #include "ui/views/controls/button/button.h" |
| 10 #include "ui/views/controls/button/label_button.h" | 10 #include "ui/views/controls/button/label_button.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // to the PUSHED state. | 59 // to the PUSHED state. |
| 60 bool ShouldEnterPushedState(const ui::Event& event) override; | 60 bool ShouldEnterPushedState(const ui::Event& event) override; |
| 61 | 61 |
| 62 // Returns if menu should be shown. Override this to change default behavior. | 62 // Returns if menu should be shown. Override this to change default behavior. |
| 63 virtual bool ShouldShowMenu(); | 63 virtual bool ShouldShowMenu(); |
| 64 | 64 |
| 65 // Function to show the dropdown menu. | 65 // Function to show the dropdown menu. |
| 66 virtual void ShowDropDownMenu(ui::MenuSourceType source_type); | 66 virtual void ShowDropDownMenu(ui::MenuSourceType source_type); |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 // views::LabelButton: |
| 70 const char* GetClassName() const override; |
| 71 |
| 69 // The model that populates the attached menu. | 72 // The model that populates the attached menu. |
| 70 scoped_ptr<ui::MenuModel> model_; | 73 scoped_ptr<ui::MenuModel> model_; |
| 71 | 74 |
| 72 // Indicates if menu is currently showing. | 75 // Indicates if menu is currently showing. |
| 73 bool menu_showing_; | 76 bool menu_showing_; |
| 74 | 77 |
| 75 // Y position of mouse when left mouse button is pressed | 78 // Y position of mouse when left mouse button is pressed |
| 76 int y_position_on_lbuttondown_; | 79 int y_position_on_lbuttondown_; |
| 77 | 80 |
| 78 // Menu runner to display drop down menu. | 81 // Menu runner to display drop down menu. |
| 79 scoped_ptr<views::MenuRunner> menu_runner_; | 82 scoped_ptr<views::MenuRunner> menu_runner_; |
| 80 | 83 |
| 81 // A factory for tasks that show the dropdown context menu for the button. | 84 // A factory for tasks that show the dropdown context menu for the button. |
| 82 base::WeakPtrFactory<ToolbarButton> show_menu_factory_; | 85 base::WeakPtrFactory<ToolbarButton> show_menu_factory_; |
| 83 | 86 |
| 84 DISALLOW_COPY_AND_ASSIGN(ToolbarButton); | 87 DISALLOW_COPY_AND_ASSIGN(ToolbarButton); |
| 85 }; | 88 }; |
| 86 | 89 |
| 87 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ | 90 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ |
| OLD | NEW |