Commit 3cd167db authored by calamity's avatar calamity Committed by Commit bot

Remove TileItemBackground from experimental app list.

This CL removes the white TileItemBackground from the tiles on the
experimental app list start page.

BUG=349727

Review URL: https://codereview.chromium.org/492153002

Cr-Commit-Position: refs/heads/master@{#291632}
parent e6f6b730
......@@ -14,7 +14,6 @@
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_analysis.h"
#include "ui/gfx/color_utils.h"
#include "ui/views/background.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/box_layout.h"
......@@ -24,61 +23,15 @@ namespace {
const int kTileSize = 90;
const int kTileHorizontalPadding = 10;
const SkColor kTileBackgroundColor = SK_ColorWHITE;
const int kTileColorStripHeight = 2;
const SkAlpha kTileColorStripOpacity = 0X5F;
const int kTileCornerRadius = 2;
} // namespace
namespace app_list {
// A background for the start page item view which consists of a rounded rect
// with a dominant color strip at the bottom.
class TileItemView::TileItemBackground : public views::Background {
public:
TileItemBackground() : strip_color_(SK_ColorBLACK) {}
virtual ~TileItemBackground() {}
void set_strip_color(SkColor strip_color) { strip_color_ = strip_color; }
// Overridden from views::Background:
virtual void Paint(gfx::Canvas* canvas, views::View* view) const OVERRIDE {
SkPaint paint;
paint.setFlags(SkPaint::kAntiAlias_Flag);
// Paint the border.
paint.setColor(kStartPageBorderColor);
canvas->DrawRoundRect(view->GetContentsBounds(), kTileCornerRadius, paint);
// Paint a rectangle for the color strip.
gfx::Rect color_strip_rect(view->GetContentsBounds());
color_strip_rect.Inset(1, 1, 1, 1);
paint.setColor(SkColorSetA(strip_color_, kTileColorStripOpacity));
canvas->DrawRoundRect(color_strip_rect, kTileCornerRadius, paint);
// Paint the main background rectangle, leaving part of the color strip
// unobscured.
gfx::Rect static_background_rect(color_strip_rect);
static_background_rect.Inset(0, 0, 0, kTileColorStripHeight);
paint.setColor(kTileBackgroundColor);
canvas->DrawRoundRect(static_background_rect, kTileCornerRadius, paint);
}
private:
SkColor strip_color_;
DISALLOW_COPY_AND_ASSIGN(TileItemBackground);
};
TileItemView::TileItemView()
: views::CustomButton(this),
item_(NULL),
icon_(new views::ImageView),
title_(new views::Label),
background_(new TileItemBackground()) {
set_background(background_);
title_(new views::Label) {
views::BoxLayout* layout_manager = new views::BoxLayout(
views::BoxLayout::kVertical, kTileHorizontalPadding, 0, 0);
layout_manager->set_main_axis_alignment(
......@@ -141,9 +94,6 @@ void TileItemView::ButtonPressed(views::Button* sender,
void TileItemView::OnIconChanged() {
icon_->SetImage(item_->icon());
background_->set_strip_color(
color_utils::CalculateKMeanColorOfBitmap(*item_->icon().bitmap()));
SchedulePaint();
}
void TileItemView::OnResultDestroying() {
......
......@@ -30,8 +30,6 @@ class APP_LIST_EXPORT TileItemView : public views::CustomButton,
void SetSearchResult(SearchResult* item);
private:
class TileItemBackground;
// Overridden from views::View:
virtual gfx::Size GetPreferredSize() const OVERRIDE;
......@@ -49,8 +47,6 @@ class APP_LIST_EXPORT TileItemView : public views::CustomButton,
views::ImageView* icon_; // Owned by views hierarchy.
views::Label* title_; // Owned by views hierarchy.
TileItemBackground* background_;
DISALLOW_COPY_AND_ASSIGN(TileItemView);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment