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

Side by Side Diff: ui/app_list/views/tile_item_view.cc

Issue 326023002: App list: TileItemView::SetAppListItem exits early if item already set. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "ui/app_list/app_list_constants.h" 8 #include "ui/app_list/app_list_constants.h"
9 #include "ui/app_list/app_list_item.h" 9 #include "ui/app_list/app_list_item.h"
10 #include "ui/app_list/app_list_model.h" 10 #include "ui/app_list/app_list_model.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 title_->SetHorizontalAlignment(gfx::ALIGN_CENTER); 95 title_->SetHorizontalAlignment(gfx::ALIGN_CENTER);
96 96
97 AddChildView(icon_); 97 AddChildView(icon_);
98 AddChildView(title_); 98 AddChildView(title_);
99 } 99 }
100 100
101 TileItemView::~TileItemView() { 101 TileItemView::~TileItemView() {
102 } 102 }
103 103
104 void TileItemView::SetAppListItem(AppListItem* item) { 104 void TileItemView::SetAppListItem(AppListItem* item) {
105 if (item == item_)
tapted 2014/06/10 04:21:54 Does the pointer change when just the title/icon c
Matt Giuca 2014/06/10 05:28:54 Done (TODO). Calamity says not worth addressing n
106 return;
107
105 item_ = item; 108 item_ = item;
106 if (!item) { 109 if (!item) {
107 SetVisible(false); 110 SetVisible(false);
108 icon_->SetImage(NULL); 111 icon_->SetImage(NULL);
109 title_->SetText(base::string16()); 112 title_->SetText(base::string16());
110 return; 113 return;
111 } 114 }
112 115
113 SetVisible(true); 116 SetVisible(true);
114 icon_->SetImage(item_->icon()); 117 icon_->SetImage(item_->icon());
115 title_->SetText(base::UTF8ToUTF16(item_->name())); 118 title_->SetText(base::UTF8ToUTF16(item_->name()));
116 119
117 background_->set_strip_color( 120 background_->set_strip_color(
118 color_utils::CalculateKMeanColorOfBitmap(*item_->icon().bitmap())); 121 color_utils::CalculateKMeanColorOfBitmap(*item_->icon().bitmap()));
119 } 122 }
120 123
121 gfx::Size TileItemView::GetPreferredSize() const { 124 gfx::Size TileItemView::GetPreferredSize() const {
122 return gfx::Size(kTileSize, kTileSize); 125 return gfx::Size(kTileSize, kTileSize);
123 } 126 }
124 127
125 void TileItemView::ButtonPressed(views::Button* sender, 128 void TileItemView::ButtonPressed(views::Button* sender,
126 const ui::Event& event) { 129 const ui::Event& event) {
127 item_->Activate(event.flags()); 130 item_->Activate(event.flags());
128 } 131 }
129 132
130 } // namespace app_list 133 } // namespace app_list
OLDNEW
« ui/app_list/views/tile_item_view.h ('K') | « 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