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

Unified Diff: chrome/browser/chromeos/setting_level_bubble.cc

Issue 5559004: chromeos: Add support for multiple volume icons. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/browser/chromeos
Patch Set: merge Created 10 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/setting_level_bubble.h ('k') | chrome/browser/chromeos/setting_level_bubble_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/setting_level_bubble.cc
diff --git a/chrome/browser/chromeos/setting_level_bubble.cc b/chrome/browser/chromeos/setting_level_bubble.cc
index 1847413f7209d919c6173609564eaa2290efefd6..eb918e9caabbe5283eeb74937ecfc59dc5101fdc 100644
--- a/chrome/browser/chromeos/setting_level_bubble.cc
+++ b/chrome/browser/chromeos/setting_level_bubble.cc
@@ -55,10 +55,14 @@ static views::Widget* GetToplevelWidget() {
return root->GetWidget();
}
-SettingLevelBubble::SettingLevelBubble(SkBitmap* icon)
+SettingLevelBubble::SettingLevelBubble(SkBitmap* increase_icon,
+ SkBitmap* decrease_icon,
+ SkBitmap* zero_icon)
: previous_percent_(-1),
current_percent_(-1),
- icon_(icon),
+ increase_icon_(increase_icon),
+ decrease_icon_(decrease_icon),
+ zero_icon_(zero_icon),
bubble_(NULL),
view_(NULL),
animation_(this) {
@@ -74,13 +78,20 @@ void SettingLevelBubble::ShowBubble(int percent) {
if (previous_percent_ == -1)
previous_percent_ = percent;
current_percent_ = percent;
+
+ SkBitmap* icon = increase_icon_;
+ if (current_percent_ == 0)
+ icon = zero_icon_;
+ else if (current_percent_ < previous_percent_)
+ icon = decrease_icon_;
+
if (!bubble_) {
views::Widget* widget = GetToplevelWidget();
if (widget == NULL)
return;
DCHECK(view_ == NULL);
view_ = new SettingLevelBubbleView;
- view_->Init(icon_, previous_percent_);
+ view_->Init(icon, previous_percent_);
// Calculate position of the bubble.
gfx::Rect bounds;
widget->GetBounds(&bounds, false);
@@ -94,6 +105,7 @@ void SettingLevelBubble::ShowBubble(int percent) {
} else {
DCHECK(view_);
timeout_timer_.Stop();
+ view_->SetIcon(icon);
}
if (animation_.is_animating())
animation_.End();
« no previous file with comments | « chrome/browser/chromeos/setting_level_bubble.h ('k') | chrome/browser/chromeos/setting_level_bubble_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698