| 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_WRENCH_TOOLBAR_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_WRENCH_TOOLBAR_BUTTON_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_WRENCH_TOOLBAR_BUTTON_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_WRENCH_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 "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "chrome/browser/ui/toolbar/wrench_icon_painter.h" | 11 #include "chrome/browser/ui/toolbar/wrench_icon_painter.h" |
| 12 #include "ui/views/controls/button/menu_button.h" | 12 #include "ui/views/controls/button/menu_button.h" |
| 13 | 13 |
| 14 namespace views { | 14 namespace views { |
| 15 class LabelButtonBorder; | 15 class LabelButtonBorder; |
| 16 } | 16 } |
| 17 | 17 |
| 18 class ToolbarView; | 18 class ToolbarView; |
| 19 | 19 |
| 20 // TODO(gbillock): Rename this? No longer a wrench. | 20 // TODO(gbillock): Rename this? No longer a wrench. |
| 21 class WrenchToolbarButton : public views::MenuButton, | 21 class WrenchToolbarButton : public views::MenuButton, |
| 22 public WrenchIconPainter::Delegate { | 22 public WrenchIconPainter::Delegate { |
| 23 public: | 23 public: |
| 24 explicit WrenchToolbarButton(ToolbarView* toolbar_view); | 24 explicit WrenchToolbarButton(ToolbarView* toolbar_view); |
| 25 ~WrenchToolbarButton() override; | 25 ~WrenchToolbarButton() override; |
| 26 | 26 |
| 27 void SetSeverity(WrenchIconPainter::Severity severity, bool animate); | 27 void SetSeverity(WrenchIconPainter::Severity severity, bool animate); |
| 28 | 28 |
| 29 // views::MenuButton: | 29 // views::MenuButton: |
| 30 const char* GetClassName() const override; |
| 30 gfx::Size GetPreferredSize() const override; | 31 gfx::Size GetPreferredSize() const override; |
| 31 void OnPaint(gfx::Canvas* canvas) override; | 32 void OnPaint(gfx::Canvas* canvas) override; |
| 32 | 33 |
| 33 // WrenchIconPainter::Delegate: | 34 // WrenchIconPainter::Delegate: |
| 34 void ScheduleWrenchIconPaint() override; | 35 void ScheduleWrenchIconPaint() override; |
| 35 | 36 |
| 36 // Sets |overflowed_toolbar_action_wants_to_run_| and schedules a paint. | 37 // Sets |overflowed_toolbar_action_wants_to_run_| and schedules a paint. |
| 37 void SetOverflowedToolbarActionWantsToRun(bool wants_to_run); | 38 void SetOverflowedToolbarActionWantsToRun(bool wants_to_run); |
| 38 | 39 |
| 39 bool overflowed_toolbar_action_wants_to_run_for_testing() const { | 40 bool overflowed_toolbar_action_wants_to_run_for_testing() const { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // Only needed for testing. | 73 // Only needed for testing. |
| 73 bool overflowed_toolbar_action_wants_to_run_for_testing_; | 74 bool overflowed_toolbar_action_wants_to_run_for_testing_; |
| 74 | 75 |
| 75 // Used to spawn weak pointers for delayed tasks to open the overflow menu. | 76 // Used to spawn weak pointers for delayed tasks to open the overflow menu. |
| 76 base::WeakPtrFactory<WrenchToolbarButton> weak_factory_; | 77 base::WeakPtrFactory<WrenchToolbarButton> weak_factory_; |
| 77 | 78 |
| 78 DISALLOW_COPY_AND_ASSIGN(WrenchToolbarButton); | 79 DISALLOW_COPY_AND_ASSIGN(WrenchToolbarButton); |
| 79 }; | 80 }; |
| 80 | 81 |
| 81 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_WRENCH_TOOLBAR_BUTTON_H_ | 82 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_WRENCH_TOOLBAR_BUTTON_H_ |
| OLD | NEW |