diff options
Diffstat (limited to 'ash/shelf/overflow_button.cc')
-rw-r--r-- | ash/shelf/overflow_button.cc | 75 |
1 files changed, 27 insertions, 48 deletions
diff --git a/ash/shelf/overflow_button.cc b/ash/shelf/overflow_button.cc index 7a40e6a..5e6c607 100644 --- a/ash/shelf/overflow_button.cc +++ b/ash/shelf/overflow_button.cc @@ -88,56 +88,35 @@ void OverflowButton::OnPaint(gfx::Canvas* canvas) { ShelfAlignment alignment = layout_manager->GetAlignment(); gfx::Rect bounds(GetContentsBounds()); - if (ash::switches::UseAlternateShelfLayout()) { - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - int background_image_id = 0; - if (layout_manager->shelf_widget()->shelf()->IsShowingOverflowBubble()) - background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_PRESSED; - else if(layout_manager->shelf_widget()->GetDimsShelf()) - background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_ON_BLACK; - else - background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_NORMAL; - - const gfx::ImageSkia* background = - rb.GetImageNamed(background_image_id).ToImageSkia(); - if (alignment == SHELF_ALIGNMENT_LEFT) { - bounds = gfx::Rect( - bounds.right() - background->width() - - ShelfLayoutManager::kShelfItemInset, - bounds.y() + (bounds.height() - background->height()) / 2, - background->width(), background->height()); - } else if (alignment == SHELF_ALIGNMENT_RIGHT) { - bounds = gfx::Rect( - bounds.x() + ShelfLayoutManager::kShelfItemInset, - bounds.y() + (bounds.height() - background->height()) / 2, - background->width(), background->height()); - } else { - bounds = gfx::Rect( - bounds.x() + (bounds.width() - background->width()) / 2, - bounds.y() + ShelfLayoutManager::kShelfItemInset, - background->width(), background->height()); - } - canvas->DrawImageInt(*background, bounds.x(), bounds.y()); + ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + int background_image_id = 0; + if (layout_manager->shelf_widget()->shelf()->IsShowingOverflowBubble()) + background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_PRESSED; + else if(layout_manager->shelf_widget()->GetDimsShelf()) + background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_ON_BLACK; + else + background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_NORMAL; + + const gfx::ImageSkia* background = + rb.GetImageNamed(background_image_id).ToImageSkia(); + if (alignment == SHELF_ALIGNMENT_LEFT) { + bounds = gfx::Rect( + bounds.right() - background->width() - + ShelfLayoutManager::kShelfItemInset, + bounds.y() + (bounds.height() - background->height()) / 2, + background->width(), background->height()); + } else if (alignment == SHELF_ALIGNMENT_RIGHT) { + bounds = gfx::Rect( + bounds.x() + ShelfLayoutManager::kShelfItemInset, + bounds.y() + (bounds.height() - background->height()) / 2, + background->width(), background->height()); } else { - if (alignment == SHELF_ALIGNMENT_BOTTOM) { - bounds = gfx::Rect( - bounds.x() + ((bounds.width() - kButtonHoverSize) / 2) - 1, - bounds.y() + kBackgroundOffset - 1, - kButtonHoverSize, kButtonHoverSize); - } else { - bounds = gfx::Rect( - bounds.x() + kBackgroundOffset -1, - bounds.y() + ((bounds.height() - kButtonHoverSize) / 2) -1, - kButtonHoverSize, kButtonHoverSize); - } - if (hover_animation_->is_animating()) { - PaintBackground( - canvas, - kButtonHoverAlpha * hover_animation_->GetCurrentValue()); - } else if (state() == STATE_HOVERED || state() == STATE_PRESSED) { - PaintBackground(canvas, kButtonHoverAlpha); - } + bounds = gfx::Rect( + bounds.x() + (bounds.width() - background->width()) / 2, + bounds.y() + ShelfLayoutManager::kShelfItemInset, + background->width(), background->height()); } + canvas->DrawImageInt(*background, bounds.x(), bounds.y()); if (height() < kButtonHoverSize) return; |