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

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

Issue 395193003: Create a cross-platform helper class for badging the wrench menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 5 months 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
« no previous file with comments | « chrome/browser/ui/views/toolbar/toolbar_view.cc ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "grit/theme_resources.h" 7 #include "grit/theme_resources.h"
8 #include "ui/base/resource/resource_bundle.h" 8 #include "ui/base/resource/resource_bundle.h"
9 #include "ui/base/theme_provider.h" 9 #include "ui/base/theme_provider.h"
10 #include "ui/views/painter.h" 10 #include "ui/views/painter.h"
11 11
12 WrenchToolbarButton::WrenchToolbarButton(views::MenuButtonListener* listener) 12 WrenchToolbarButton::WrenchToolbarButton(views::MenuButtonListener* listener)
13 : views::MenuButton(NULL, base::string16(), listener, false) { 13 : views::MenuButton(NULL, base::string16(), listener, false) {
14 wrench_icon_painter_.reset(new WrenchIconPainter(this)); 14 wrench_icon_painter_.reset(new WrenchIconPainter(this));
15 } 15 }
16 16
17 WrenchToolbarButton::~WrenchToolbarButton() { 17 WrenchToolbarButton::~WrenchToolbarButton() {
18 } 18 }
19 19
20 void WrenchToolbarButton::SetSeverity(WrenchIconPainter::Severity severity, 20 void WrenchToolbarButton::SetSeverity(WrenchIconPainter::Severity severity,
21 bool animate) { 21 bool animate) {
22 wrench_icon_painter_->SetSeverity(severity, animate); 22 wrench_icon_painter_->SetSeverity(severity, animate);
23 SchedulePaint();
23 } 24 }
24 25
25 gfx::Size WrenchToolbarButton::GetPreferredSize() const { 26 gfx::Size WrenchToolbarButton::GetPreferredSize() const {
26 return ResourceBundle::GetSharedInstance(). 27 return ResourceBundle::GetSharedInstance().
27 GetImageSkiaNamed(IDR_TOOLBAR_BEZEL_HOVER)->size(); 28 GetImageSkiaNamed(IDR_TOOLBAR_BEZEL_HOVER)->size();
28 } 29 }
29 30
30 void WrenchToolbarButton::OnPaint(gfx::Canvas* canvas) { 31 void WrenchToolbarButton::OnPaint(gfx::Canvas* canvas) {
31 views::MenuButton::OnPaint(canvas); 32 views::MenuButton::OnPaint(canvas);
32 wrench_icon_painter_->Paint(canvas, 33 wrench_icon_painter_->Paint(canvas,
33 GetThemeProvider(), 34 GetThemeProvider(),
34 gfx::Rect(size()), 35 gfx::Rect(size()),
35 WrenchIconPainter::BEZEL_NONE); 36 WrenchIconPainter::BEZEL_NONE);
36 } 37 }
37 38
38 void WrenchToolbarButton::ScheduleWrenchIconPaint() { 39 void WrenchToolbarButton::ScheduleWrenchIconPaint() {
39 SchedulePaint(); 40 SchedulePaint();
40 } 41 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar/toolbar_view.cc ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698