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

Side by Side Diff: chrome/browser/ui/toolbar/wrench_icon_painter.h

Issue 14245003: Wrench Icon: Only animate low severity status once (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 public: 43 public:
44 virtual void ScheduleWrenchIconPaint() = 0; 44 virtual void ScheduleWrenchIconPaint() = 0;
45 protected: 45 protected:
46 virtual ~Delegate() {} 46 virtual ~Delegate() {}
47 }; 47 };
48 48
49 // Map an upgrade level to a severity level. 49 // Map an upgrade level to a severity level.
50 static Severity SeverityFromUpgradeLevel( 50 static Severity SeverityFromUpgradeLevel(
51 UpgradeDetector::UpgradeNotificationAnnoyanceLevel level); 51 UpgradeDetector::UpgradeNotificationAnnoyanceLevel level);
52 52
53 // Checks if the wrench icon should be animated for the given upgrade level.
54 static bool ShouldAnimateUpgradeLevel(
55 UpgradeDetector::UpgradeNotificationAnnoyanceLevel level);
56
53 // Map a global error level to a severity level. 57 // Map a global error level to a severity level.
54 static Severity SeverityFromGlobalErrorSeverity( 58 static Severity SeverityFromGlobalErrorSeverity(
55 GlobalError::Severity severity); 59 GlobalError::Severity severity);
56 60
57 explicit WrenchIconPainter(Delegate* delegate); 61 explicit WrenchIconPainter(Delegate* delegate);
58 virtual ~WrenchIconPainter(); 62 virtual ~WrenchIconPainter();
59 63
60 // If |severity| is not |SEVERITY_NONE| then the wrench icon is colored to 64 // If |severity| is not |SEVERITY_NONE| then the wrench icon is colored to
61 // match the severity level. 65 // match the severity level.
62 void SetSeverity(Severity severity); 66 void SetSeverity(Severity severity, bool animate);
63 67
64 // A badge drawn on the top left. 68 // A badge drawn on the top left.
65 void set_badge(const gfx::ImageSkia& badge) { badge_ = badge; } 69 void set_badge(const gfx::ImageSkia& badge) { badge_ = badge; }
66 70
67 void Paint(gfx::Canvas* canvas, 71 void Paint(gfx::Canvas* canvas,
68 ui::ThemeProvider* theme_provider, 72 ui::ThemeProvider* theme_provider,
69 const gfx::Rect& rect, 73 const gfx::Rect& rect,
70 BezelType bezel_type); 74 BezelType bezel_type);
71 75
72 private: 76 private:
73 FRIEND_TEST_ALL_PREFIXES(WrenchIconPainterTest, PaintCallback); 77 FRIEND_TEST_ALL_PREFIXES(WrenchIconPainterTest, PaintCallback);
74 78
75 // AnimationDelegate: 79 // AnimationDelegate:
76 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 80 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
77 81
78 // Gets the image ID used to draw bars for the current severity level. 82 // Gets the image ID used to draw bars for the current severity level.
79 int GetCurrentSeverityImageID() const; 83 int GetCurrentSeverityImageID() const;
80 84
81 Delegate* delegate_; 85 Delegate* delegate_;
82 Severity severity_; 86 Severity severity_;
83 gfx::ImageSkia badge_; 87 gfx::ImageSkia badge_;
84 scoped_ptr<ui::MultiAnimation> animation_; 88 scoped_ptr<ui::MultiAnimation> animation_;
85 89
86 DISALLOW_COPY_AND_ASSIGN(WrenchIconPainter); 90 DISALLOW_COPY_AND_ASSIGN(WrenchIconPainter);
87 }; 91 };
88 92
89 #endif // CHROME_BROWSER_UI_TOOLBAR_WRENCH_ICON_PAINTER_H_ 93 #endif // CHROME_BROWSER_UI_TOOLBAR_WRENCH_ICON_PAINTER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/toolbar/wrench_toolbar_button_cell.mm ('k') | chrome/browser/ui/toolbar/wrench_icon_painter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698