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

Unified Diff: ui/app_list/views/tile_item_view.cc

Issue 2952823002: cros: Make SearchResultTileItemView layout per DisplayType customized (Closed)
Patch Set: nits Created 3 years, 6 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 | « ui/app_list/views/tile_item_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/tile_item_view.cc
diff --git a/ui/app_list/views/tile_item_view.cc b/ui/app_list/views/tile_item_view.cc
index 5e6543b1db78547f906ed50596031e3d17554e69..351c77089d596136ccfd470e27541bb4db656433 100644
--- a/ui/app_list/views/tile_item_view.cc
+++ b/ui/app_list/views/tile_item_view.cc
@@ -21,8 +21,6 @@ constexpr int kTopPadding = 5;
constexpr int kTileSize = 90;
constexpr int kIconTitleSpacing = 6;
-constexpr int kBadgeBackgroundRadius = 10;
-
// The background image source for badge.
class BadgeBackgroundImageSource : public gfx::CanvasImageSource {
public:
@@ -154,21 +152,10 @@ void TileItemView::StateChanged(ButtonState old_state) {
void TileItemView::Layout() {
gfx::Rect rect(GetContentsBounds());
- if (rect.IsEmpty())
- return;
rect.Inset(0, kTopPadding, 0, 0);
icon_->SetBoundsRect(rect);
- if (badge_) {
- gfx::Rect badge_rect(rect);
- gfx::Size icon_size = icon_->GetImage().size();
- badge_rect.Offset(
- (icon_size.width() - kAppBadgeIconSize) / 2,
- icon_size.height() - kBadgeBackgroundRadius - kAppBadgeIconSize / 2);
- badge_->SetBoundsRect(badge_rect);
- }
-
rect.Inset(0, kGridIconDimension + kIconTitleSpacing, 0, 0);
rect.set_height(title_->GetPreferredSize().height());
title_->SetBoundsRect(rect);
@@ -183,6 +170,22 @@ void TileItemView::ImageShadowAnimationProgressed(
icon_->SetImage(animator->shadow_image());
}
+gfx::Size TileItemView::CalculatePreferredSize() const {
+ return gfx::Size(kTileSize, kTileSize);
+}
+
+bool TileItemView::GetTooltipText(const gfx::Point& p,
+ base::string16* tooltip) const {
+ // Use the label to generate a tooltip, so that it will consider its text
+ // truncation in making the tooltip. We do not want the label itself to have a
+ // tooltip, so we only temporarily enable it to get the tooltip text from the
+ // label, then disable it again.
+ title_->SetHandlesTooltips(true);
+ bool handled = title_->GetTooltipText(p, tooltip);
+ title_->SetHandlesTooltips(false);
+ return handled;
+}
+
void TileItemView::UpdateBackgroundColor() {
std::unique_ptr<views::Background> background;
SkColor background_color = parent_background_color_;
@@ -209,20 +212,4 @@ void TileItemView::UpdateBackgroundColor() {
SchedulePaint();
}
-gfx::Size TileItemView::CalculatePreferredSize() const {
- return gfx::Size(kTileSize, kTileSize);
-}
-
-bool TileItemView::GetTooltipText(const gfx::Point& p,
- base::string16* tooltip) const {
- // Use the label to generate a tooltip, so that it will consider its text
- // truncation in making the tooltip. We do not want the label itself to have a
- // tooltip, so we only temporarily enable it to get the tooltip text from the
- // label, then disable it again.
- title_->SetHandlesTooltips(true);
- bool handled = title_->GetTooltipText(p, tooltip);
- title_->SetHandlesTooltips(false);
- return handled;
-}
-
} // namespace app_list
« no previous file with comments | « ui/app_list/views/tile_item_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698