| 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/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ui/gfx/geometry/point.h" | 10 #include "ui/gfx/geometry/point.h" |
| 11 #include "ui/views/context_menu_controller.h" | 11 #include "ui/views/context_menu_controller.h" |
| 12 #include "ui/views/controls/button/button.h" | 12 #include "ui/views/controls/button/button.h" |
| 13 #include "ui/views/controls/button/label_button.h" | 13 #include "ui/views/controls/button/label_button.h" |
| 14 | 14 |
| 15 class Profile; | 15 class Profile; |
| 16 | 16 |
| 17 namespace test { |
| 18 class ToolbarButtonTestApi; |
| 19 } |
| 20 |
| 17 namespace ui { | 21 namespace ui { |
| 18 class MenuModel; | 22 class MenuModel; |
| 19 } | 23 } |
| 20 | 24 |
| 21 namespace views { | 25 namespace views { |
| 22 class InkDropDelegate; | 26 class InkDropDelegate; |
| 23 class MenuModelAdapter; | 27 class MenuModelAdapter; |
| 24 class MenuRunner; | 28 class MenuRunner; |
| 25 } | 29 } |
| 26 | 30 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 ui::MenuSourceType source_type) override; | 66 ui::MenuSourceType source_type) override; |
| 63 | 67 |
| 64 protected: | 68 protected: |
| 65 // Returns if menu should be shown. Override this to change default behavior. | 69 // Returns if menu should be shown. Override this to change default behavior. |
| 66 virtual bool ShouldShowMenu(); | 70 virtual bool ShouldShowMenu(); |
| 67 | 71 |
| 68 // Function to show the dropdown menu. | 72 // Function to show the dropdown menu. |
| 69 virtual void ShowDropDownMenu(ui::MenuSourceType source_type); | 73 virtual void ShowDropDownMenu(ui::MenuSourceType source_type); |
| 70 | 74 |
| 71 private: | 75 private: |
| 76 friend test::ToolbarButtonTestApi; |
| 77 |
| 72 // Callback for MenuModelAdapter. | 78 // Callback for MenuModelAdapter. |
| 73 void OnMenuClosed(); | 79 void OnMenuClosed(); |
| 74 | 80 |
| 75 // views::LabelButton: | 81 // views::LabelButton: |
| 76 const char* GetClassName() const override; | 82 const char* GetClassName() const override; |
| 77 | 83 |
| 78 // The associated profile. The browser theme affects rendering. | 84 // The associated profile. The browser theme affects rendering. |
| 79 Profile* profile_; | 85 Profile* profile_; |
| 80 | 86 |
| 81 // The model that populates the attached menu. | 87 // The model that populates the attached menu. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 96 // Controls the visual feedback for the button state. | 102 // Controls the visual feedback for the button state. |
| 97 scoped_ptr<views::InkDropDelegate> ink_drop_delegate_; | 103 scoped_ptr<views::InkDropDelegate> ink_drop_delegate_; |
| 98 | 104 |
| 99 // A factory for tasks that show the dropdown context menu for the button. | 105 // A factory for tasks that show the dropdown context menu for the button. |
| 100 base::WeakPtrFactory<ToolbarButton> show_menu_factory_; | 106 base::WeakPtrFactory<ToolbarButton> show_menu_factory_; |
| 101 | 107 |
| 102 DISALLOW_COPY_AND_ASSIGN(ToolbarButton); | 108 DISALLOW_COPY_AND_ASSIGN(ToolbarButton); |
| 103 }; | 109 }; |
| 104 | 110 |
| 105 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ | 111 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ |
| OLD | NEW |