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

Side by Side Diff: ui/app_list/views/search_result_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, 1 month 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 unified diff | Download patch
« no previous file with comments | « ui/app_list/views/search_result_tile_item_view.h ('k') | ui/app_list/views/start_page_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/app_list/views/search_result_tile_item_view.h"
6
7 #include "ui/app_list/search_result.h"
8
9 namespace app_list {
10
11 SearchResultTileItemView::SearchResultTileItemView() : item_(NULL) {
12 }
13
14 SearchResultTileItemView::~SearchResultTileItemView() {
15 if (item_)
16 item_->RemoveObserver(this);
17 }
18
19 void SearchResultTileItemView::SetSearchResult(SearchResult* item) {
20 SetVisible(item != NULL);
21
22 SearchResult* old_item = item_;
23 if (old_item)
24 old_item->RemoveObserver(this);
25
26 item_ = item;
27
28 if (!item)
29 return;
30
31 item_->AddObserver(this);
32
33 SetTitle(item_->title());
34
35 // Only refresh the icon if it's different from the old one. This prevents
36 // flickering.
37 if (old_item == NULL ||
38 !item->icon().BackedBySameObjectAs(old_item->icon())) {
39 OnIconChanged();
40 }
41 }
42
43 void SearchResultTileItemView::ButtonPressed(views::Button* sender,
44 const ui::Event& event) {
45 item_->Open(event.flags());
46 }
47
48 void SearchResultTileItemView::OnIconChanged() {
49 SetIcon(item_->icon());
50 }
51
52 void SearchResultTileItemView::OnResultDestroying() {
53 if (item_)
54 item_->RemoveObserver(this);
55 item_ = NULL;
56 }
57
58 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/views/search_result_tile_item_view.h ('k') | ui/app_list/views/start_page_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698