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

Unified Diff: ash/shelf/overflow_button.cc

Issue 198063003: Revert of Shelf Cleanup (- binary files) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/shelf/overflow_bubble_view.cc ('k') | ash/shelf/shelf_button.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shelf/overflow_button.cc
diff --git a/ash/shelf/overflow_button.cc b/ash/shelf/overflow_button.cc
index 3abaa424eb082e4fa8d4f2a2de01c79ac830eaef..3c899efd81a0aa4f8e6df45e2c89bc581c3b7506 100644
--- a/ash/shelf/overflow_button.cc
+++ b/ash/shelf/overflow_button.cc
@@ -90,35 +90,56 @@
ShelfAlignment alignment = layout_manager->GetAlignment();
gfx::Rect bounds(GetContentsBounds());
- 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;
+ 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());
+ 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());
} else {
- bounds = gfx::Rect(
- bounds.x() + (bounds.width() - background->width()) / 2,
- bounds.y() + ShelfLayoutManager::kShelfItemInset,
- background->width(), background->height());
+ 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);
+ }
}
- canvas->DrawImageInt(*background, bounds.x(), bounds.y());
if (height() < kButtonHoverSize)
return;
« no previous file with comments | « ash/shelf/overflow_bubble_view.cc ('k') | ash/shelf/shelf_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698