Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: chrome/browser/ui/views/wrench_toolbar_button.cc

Issue 71743002: [Toolbar Views] Move toolbar files to a new subdirectory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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.
4
5 #include "chrome/browser/ui/views/wrench_toolbar_button.h"
6
7 #include "grit/theme_resources.h"
8 #include "ui/base/resource/resource_bundle.h"
9 #include "ui/base/theme_provider.h"
10
11 WrenchToolbarButton::WrenchToolbarButton(views::MenuButtonListener* listener)
12 : views::MenuButton(NULL, string16(), listener, false) {
13 wrench_icon_painter_.reset(new WrenchIconPainter(this));
14
15 // Used for sizing only.
16 ui::ResourceBundle& rb = ResourceBundle::GetSharedInstance();
17 SetIcon(*rb.GetImageSkiaNamed(IDR_TOOLBAR_BEZEL_HOVER));
18 }
19
20 WrenchToolbarButton::~WrenchToolbarButton() {
21 }
22
23 void WrenchToolbarButton::SetSeverity(WrenchIconPainter::Severity severity,
24 bool animate) {
25 wrench_icon_painter_->SetSeverity(severity, animate);
26 }
27
28 void WrenchToolbarButton::OnPaint(gfx::Canvas* canvas) {
29 wrench_icon_painter_->Paint(
30 canvas, GetThemeProvider(), gfx::Rect(size()), GetCurrentBezelType());
31 }
32
33 void WrenchToolbarButton::ScheduleWrenchIconPaint() {
34 SchedulePaint();
35 }
36
37 WrenchIconPainter::BezelType WrenchToolbarButton::GetCurrentBezelType() const {
38 switch (state()) {
39 case STATE_HOVERED:
40 return WrenchIconPainter::BEZEL_HOVER;
41 case STATE_PRESSED:
42 return WrenchIconPainter::BEZEL_PRESSED;
43 default:
44 return WrenchIconPainter::BEZEL_NONE;
45 }
46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698