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" |
11 #include "chrome/browser/ui/global_error/global_error.h" | |
12 #include "chrome/browser/upgrade_detector.h" | |
13 #include "ui/gfx/animation/animation_delegate.h" | 11 #include "ui/gfx/animation/animation_delegate.h" |
14 #include "ui/gfx/image/image_skia.h" | 12 #include "ui/gfx/image/image_skia.h" |
15 | 13 |
16 namespace gfx { | 14 namespace gfx { |
17 class Canvas; | 15 class Canvas; |
18 class MultiAnimation; | 16 class MultiAnimation; |
19 class Rect; | 17 class Rect; |
20 } | 18 } |
21 namespace ui { | 19 namespace ui { |
22 class ThemeProvider; | 20 class ThemeProvider; |
(...skipping 16 matching lines...) Expand all Loading... |
39 SEVERITY_HIGH, | 37 SEVERITY_HIGH, |
40 }; | 38 }; |
41 | 39 |
42 class Delegate { | 40 class Delegate { |
43 public: | 41 public: |
44 virtual void ScheduleWrenchIconPaint() = 0; | 42 virtual void ScheduleWrenchIconPaint() = 0; |
45 protected: | 43 protected: |
46 virtual ~Delegate() {} | 44 virtual ~Delegate() {} |
47 }; | 45 }; |
48 | 46 |
49 // Map an upgrade level to a severity level. | |
50 static Severity SeverityFromUpgradeLevel( | |
51 UpgradeDetector::UpgradeNotificationAnnoyanceLevel level); | |
52 | |
53 // Checks if the wrench icon should be animated for the given upgrade level. | |
54 static bool ShouldAnimateUpgradeLevel( | |
55 UpgradeDetector::UpgradeNotificationAnnoyanceLevel level); | |
56 | |
57 // Get the severity level for global errors. | |
58 static Severity GlobalErrorSeverity(); | |
59 | |
60 explicit WrenchIconPainter(Delegate* delegate); | 47 explicit WrenchIconPainter(Delegate* delegate); |
61 virtual ~WrenchIconPainter(); | 48 virtual ~WrenchIconPainter(); |
62 | 49 |
63 // If |severity| is not |SEVERITY_NONE| then the wrench icon is colored to | 50 // If |severity| is not |SEVERITY_NONE| then the wrench icon is colored to |
64 // match the severity level. | 51 // match the severity level. |
65 void SetSeverity(Severity severity, bool animate); | 52 void SetSeverity(Severity severity, bool animate); |
66 | 53 |
67 // A badge drawn on the top left. | 54 // A badge drawn on the top left. |
68 void set_badge(const gfx::ImageSkia& badge) { badge_ = badge; } | 55 void set_badge(const gfx::ImageSkia& badge) { badge_ = badge; } |
69 | 56 |
(...skipping 13 matching lines...) Expand all Loading... |
83 | 70 |
84 Delegate* delegate_; | 71 Delegate* delegate_; |
85 Severity severity_; | 72 Severity severity_; |
86 gfx::ImageSkia badge_; | 73 gfx::ImageSkia badge_; |
87 scoped_ptr<gfx::MultiAnimation> animation_; | 74 scoped_ptr<gfx::MultiAnimation> animation_; |
88 | 75 |
89 DISALLOW_COPY_AND_ASSIGN(WrenchIconPainter); | 76 DISALLOW_COPY_AND_ASSIGN(WrenchIconPainter); |
90 }; | 77 }; |
91 | 78 |
92 #endif // CHROME_BROWSER_UI_TOOLBAR_WRENCH_ICON_PAINTER_H_ | 79 #endif // CHROME_BROWSER_UI_TOOLBAR_WRENCH_ICON_PAINTER_H_ |
OLD | NEW |