OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_TOOLBAR_WRENCH_ICON_PAINTER_H_ | 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_WRENCH_ICON_PAINTER_H_ |
6 #define CHROME_BROWSER_UI_TOOLBAR_WRENCH_ICON_PAINTER_H_ | 6 #define CHROME_BROWSER_UI_TOOLBAR_WRENCH_ICON_PAINTER_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 // Map a global error level to a severity level. | 53 // Map a global error level to a severity level. |
54 static Severity SeverityFromGlobalErrorSeverity( | 54 static Severity SeverityFromGlobalErrorSeverity( |
55 GlobalError::Severity severity); | 55 GlobalError::Severity severity); |
56 | 56 |
57 explicit WrenchIconPainter(Delegate* delegate); | 57 explicit WrenchIconPainter(Delegate* delegate); |
58 virtual ~WrenchIconPainter(); | 58 virtual ~WrenchIconPainter(); |
59 | 59 |
60 // If |severity| is not |SEVERITY_NONE| then the wrench icon is colored to | 60 // If |severity| is not |SEVERITY_NONE| then the wrench icon is colored to |
61 // match the severity level. | 61 // match the severity level. |
62 void SetSeverity(Severity severity); | 62 void SetSeverity(Severity severity, bool animate); |
63 | 63 |
64 // A badge drawn on the top left. | 64 // A badge drawn on the top left. |
65 void set_badge(const gfx::ImageSkia& badge) { badge_ = badge; } | 65 void set_badge(const gfx::ImageSkia& badge) { badge_ = badge; } |
66 | 66 |
67 void Paint(gfx::Canvas* canvas, | 67 void Paint(gfx::Canvas* canvas, |
68 ui::ThemeProvider* theme_provider, | 68 ui::ThemeProvider* theme_provider, |
69 const gfx::Rect& rect, | 69 const gfx::Rect& rect, |
70 BezelType bezel_type); | 70 BezelType bezel_type); |
71 | 71 |
72 private: | 72 private: |
73 FRIEND_TEST_ALL_PREFIXES(WrenchIconPainterTest, PaintCallback); | 73 FRIEND_TEST_ALL_PREFIXES(WrenchIconPainterTest, PaintCallback); |
74 | 74 |
75 // AnimationDelegate: | 75 // AnimationDelegate: |
76 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 76 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
77 | 77 |
78 // Gets the image ID used to draw bars for the current severity level. | 78 // Gets the image ID used to draw bars for the current severity level. |
79 int GetCurrentSeverityImageID() const; | 79 int GetCurrentSeverityImageID() const; |
80 | 80 |
81 Delegate* delegate_; | 81 Delegate* delegate_; |
82 Severity severity_; | 82 Severity severity_; |
83 gfx::ImageSkia badge_; | 83 gfx::ImageSkia badge_; |
84 scoped_ptr<ui::MultiAnimation> animation_; | 84 scoped_ptr<ui::MultiAnimation> animation_; |
85 | 85 |
86 DISALLOW_COPY_AND_ASSIGN(WrenchIconPainter); | 86 DISALLOW_COPY_AND_ASSIGN(WrenchIconPainter); |
87 }; | 87 }; |
88 | 88 |
89 #endif // CHROME_BROWSER_UI_TOOLBAR_WRENCH_ICON_PAINTER_H_ | 89 #endif // CHROME_BROWSER_UI_TOOLBAR_WRENCH_ICON_PAINTER_H_ |
OLD | NEW |