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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/views/toolbar/wrench_toolbar_button.h"
7 #include "grit/theme_resources.h"
8 #include "ui/base/resource/resource_bundle.h"
9 #include "ui/base/theme_provider.h"
11 WrenchToolbarButton::WrenchToolbarButton(views::MenuButtonListener
* listener
)
12 : views::MenuButton(NULL
, base::string16(), listener
, false) {
13 wrench_icon_painter_
.reset(new WrenchIconPainter(this));
15 // Used for sizing only.
16 ui::ResourceBundle
& rb
= ResourceBundle::GetSharedInstance();
17 SetIcon(*rb
.GetImageSkiaNamed(IDR_TOOLBAR_BEZEL_HOVER
));
20 WrenchToolbarButton::~WrenchToolbarButton() {
23 void WrenchToolbarButton::SetSeverity(WrenchIconPainter::Severity severity
,
25 wrench_icon_painter_
->SetSeverity(severity
, animate
);
28 void WrenchToolbarButton::OnPaint(gfx::Canvas
* canvas
) {
29 wrench_icon_painter_
->Paint(
30 canvas
, GetThemeProvider(), gfx::Rect(size()), GetCurrentBezelType());
31 views::Painter::PaintFocusPainter(this, canvas
, focus_painter());
34 void WrenchToolbarButton::ScheduleWrenchIconPaint() {
38 WrenchIconPainter::BezelType
WrenchToolbarButton::GetCurrentBezelType() const {
41 return WrenchIconPainter::BEZEL_HOVER
;
43 return WrenchIconPainter::BEZEL_PRESSED
;
45 return WrenchIconPainter::BEZEL_NONE
;