| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/app_list/views/tile_item_view.h" | 5 #include "ui/app_list/views/tile_item_view.h" |
| 6 | 6 |
| 7 #include "ui/app_list/app_list_constants.h" | 7 #include "ui/app_list/app_list_constants.h" |
| 8 #include "ui/app_list/views/app_list_main_view.h" | 8 #include "ui/app_list/views/app_list_main_view.h" |
| 9 #include "ui/views/background.h" | 9 #include "ui/views/background.h" |
| 10 #include "ui/views/controls/image_view.h" | 10 #include "ui/views/controls/image_view.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 views::BoxLayout::kVertical, kTileHorizontalPadding, 0, 0); | 28 views::BoxLayout::kVertical, kTileHorizontalPadding, 0, 0); |
| 29 layout_manager->set_main_axis_alignment( | 29 layout_manager->set_main_axis_alignment( |
| 30 views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); | 30 views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); |
| 31 SetLayoutManager(layout_manager); | 31 SetLayoutManager(layout_manager); |
| 32 | 32 |
| 33 icon_->SetImageSize(gfx::Size(kTileIconSize, kTileIconSize)); | 33 icon_->SetImageSize(gfx::Size(kTileIconSize, kTileIconSize)); |
| 34 | 34 |
| 35 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 35 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 36 title_->SetAutoColorReadabilityEnabled(false); | 36 title_->SetAutoColorReadabilityEnabled(false); |
| 37 title_->SetEnabledColor(kGridTitleColor); | 37 title_->SetEnabledColor(kGridTitleColor); |
| 38 title_->set_background(views::Background::CreateSolidBackground( | |
| 39 kLabelBackgroundColor)); | |
| 40 title_->SetFontList(rb.GetFontList(kItemTextFontStyle)); | 38 title_->SetFontList(rb.GetFontList(kItemTextFontStyle)); |
| 41 title_->SetHorizontalAlignment(gfx::ALIGN_CENTER); | 39 title_->SetHorizontalAlignment(gfx::ALIGN_CENTER); |
| 42 | 40 |
| 43 AddChildView(icon_); | 41 AddChildView(icon_); |
| 44 AddChildView(title_); | 42 AddChildView(title_); |
| 45 } | 43 } |
| 46 | 44 |
| 47 TileItemView::~TileItemView() { | 45 TileItemView::~TileItemView() { |
| 48 } | 46 } |
| 49 | 47 |
| 48 void TileItemView::SetTitleBackgroundColor(SkColor color) { |
| 49 title_->set_background(views::Background::CreateSolidBackground(color)); |
| 50 } |
| 51 |
| 50 void TileItemView::SetIcon(const gfx::ImageSkia& icon) { | 52 void TileItemView::SetIcon(const gfx::ImageSkia& icon) { |
| 51 icon_->SetImage(icon); | 53 icon_->SetImage(icon); |
| 52 } | 54 } |
| 53 | 55 |
| 54 void TileItemView::SetTitle(const base::string16& title) { | 56 void TileItemView::SetTitle(const base::string16& title) { |
| 55 title_->SetText(title); | 57 title_->SetText(title); |
| 56 } | 58 } |
| 57 | 59 |
| 58 gfx::Size TileItemView::GetPreferredSize() const { | 60 gfx::Size TileItemView::GetPreferredSize() const { |
| 59 return gfx::Size(kTileSize, kTileSize); | 61 return gfx::Size(kTileSize, kTileSize); |
| 60 } | 62 } |
| 61 | 63 |
| 62 } // namespace app_list | 64 } // namespace app_list |
| OLD | NEW |