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 #include "chrome/browser/ui/views/toolbar/wrench_toolbar_button.h" | 5 #include "chrome/browser/ui/views/toolbar/wrench_toolbar_button.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/views/extensions/browser_action_drag_data.h" | 10 #include "chrome/browser/ui/views/extensions/browser_action_drag_data.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 scoped_ptr<views::LabelButtonBorder> border = CreateDefaultBorder(); | 46 scoped_ptr<views::LabelButtonBorder> border = CreateDefaultBorder(); |
47 if (wants_to_run) { | 47 if (wants_to_run) { |
48 // We use the same style of border as the ToolbarActionViews do to indicate | 48 // We use the same style of border as the ToolbarActionViews do to indicate |
49 // an action wants to run. | 49 // an action wants to run. |
50 ToolbarActionView::DecorateWantsToRunBorder(border.get()); | 50 ToolbarActionView::DecorateWantsToRunBorder(border.get()); |
51 } | 51 } |
52 SetBorder(border.Pass()); | 52 SetBorder(border.Pass()); |
53 SchedulePaint(); | 53 SchedulePaint(); |
54 } | 54 } |
55 | 55 |
| 56 const char* WrenchToolbarButton::GetClassName() const { |
| 57 return "WrenchToolbarButton"; |
| 58 } |
| 59 |
56 gfx::Size WrenchToolbarButton::GetPreferredSize() const { | 60 gfx::Size WrenchToolbarButton::GetPreferredSize() const { |
57 return ResourceBundle::GetSharedInstance(). | 61 return ResourceBundle::GetSharedInstance(). |
58 GetImageSkiaNamed(IDR_TOOLBAR_BEZEL_HOVER)->size(); | 62 GetImageSkiaNamed(IDR_TOOLBAR_BEZEL_HOVER)->size(); |
59 } | 63 } |
60 | 64 |
61 void WrenchToolbarButton::OnPaint(gfx::Canvas* canvas) { | 65 void WrenchToolbarButton::OnPaint(gfx::Canvas* canvas) { |
62 views::MenuButton::OnPaint(canvas); | 66 views::MenuButton::OnPaint(canvas); |
63 wrench_icon_painter_->Paint(canvas, | 67 wrench_icon_painter_->Paint(canvas, |
64 GetThemeProvider(), | 68 GetThemeProvider(), |
65 gfx::Rect(size()), | 69 gfx::Rect(size()), |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } | 117 } |
114 | 118 |
115 int WrenchToolbarButton::OnPerformDrop(const ui::DropTargetEvent& event) { | 119 int WrenchToolbarButton::OnPerformDrop(const ui::DropTargetEvent& event) { |
116 DCHECK(allow_extension_dragging_); | 120 DCHECK(allow_extension_dragging_); |
117 return ui::DragDropTypes::DRAG_MOVE; | 121 return ui::DragDropTypes::DRAG_MOVE; |
118 } | 122 } |
119 | 123 |
120 void WrenchToolbarButton::ShowOverflowMenu() { | 124 void WrenchToolbarButton::ShowOverflowMenu() { |
121 toolbar_view_->ShowAppMenu(true); // For drop. | 125 toolbar_view_->ShowAppMenu(true); // For drop. |
122 } | 126 } |
OLD | NEW |