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

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

Issue 665233002: Experimental app list: Added "All apps" button on start page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/app-list-factor-folderimagesource
Patch Set: Rebase. Created 6 years, 2 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') | ui/strings/ui_strings.grd » ('j') | 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 15889b19f48777c4b533df6895576fe12f409190..a2018aa7f15e8e9c9726c9b71f3e605a81be8da0 100644
--- a/ui/app_list/views/tile_item_view.cc
+++ b/ui/app_list/views/tile_item_view.cc
@@ -4,16 +4,8 @@
#include "ui/app_list/views/tile_item_view.h"
-#include "base/strings/utf_string_conversions.h"
#include "ui/app_list/app_list_constants.h"
-#include "ui/app_list/app_list_item.h"
-#include "ui/app_list/app_list_model.h"
-#include "ui/app_list/app_list_view_delegate.h"
-#include "ui/app_list/search_result.h"
#include "ui/app_list/views/app_list_main_view.h"
-#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"
@@ -30,7 +22,6 @@ namespace app_list {
TileItemView::TileItemView()
: views::CustomButton(this),
- item_(NULL),
icon_(new views::ImageView),
title_(new views::Label) {
views::BoxLayout* layout_manager = new views::BoxLayout(
@@ -58,51 +49,18 @@ TileItemView::TileItemView()
}
TileItemView::~TileItemView() {
- if (item_)
- item_->RemoveObserver(this);
}
-void TileItemView::SetSearchResult(SearchResult* item) {
- SetVisible(item != NULL);
-
- SearchResult* old_item = item_;
- if (old_item)
- old_item->RemoveObserver(this);
-
- item_ = item;
-
- if (!item)
- return;
-
- item_->AddObserver(this);
-
- title_->SetText(item_->title());
+void TileItemView::SetIcon(const gfx::ImageSkia& icon) {
+ icon_->SetImage(icon);
+}
- // Only refresh the icon if it's different from the old one. This prevents
- // flickering.
- if (old_item == NULL ||
- !item->icon().BackedBySameObjectAs(old_item->icon())) {
- OnIconChanged();
- }
+void TileItemView::SetTitle(const base::string16& title) {
+ title_->SetText(title);
}
gfx::Size TileItemView::GetPreferredSize() const {
return gfx::Size(kTileSize, kTileSize);
}
-void TileItemView::ButtonPressed(views::Button* sender,
- const ui::Event& event) {
- item_->Open(event.flags());
-}
-
-void TileItemView::OnIconChanged() {
- icon_->SetImage(item_->icon());
-}
-
-void TileItemView::OnResultDestroying() {
- if (item_)
- item_->RemoveObserver(this);
- item_ = NULL;
-}
-
} // namespace app_list
« no previous file with comments | « ui/app_list/views/tile_item_view.h ('k') | ui/strings/ui_strings.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698