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

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

Issue 23709003: Display an app's short name in the app launcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/app_list_item_view.h" 5 #include "ui/app_list/views/app_list_item_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "ui/app_list/app_list_constants.h" 10 #include "ui/app_list/app_list_constants.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 gfx::ImageSkia shadow( 123 gfx::ImageSkia shadow(
124 gfx::ImageSkiaOperations::CreateImageWithDropShadow(resized, 124 gfx::ImageSkiaOperations::CreateImageWithDropShadow(resized,
125 icon_shadows_)); 125 icon_shadows_));
126 icon_->SetImage(shadow); 126 icon_->SetImage(shadow);
127 return; 127 return;
128 }; 128 };
129 129
130 icon_->SetImage(resized); 130 icon_->SetImage(resized);
131 } 131 }
132 132
133 void AppListItemView::UpdateTooltip() {
134 title_->SetTooltipText(model_->title() == model_->full_name() ?
135 string16() : UTF8ToUTF16(model_->full_name()));
benwells 2013/08/29 09:14:15 I think the correct indenting here is to go in ano
tmdiep 2013/08/30 02:48:13 Done.
136 }
137
133 void AppListItemView::SetUIState(UIState state) { 138 void AppListItemView::SetUIState(UIState state) {
134 if (ui_state_ == state) 139 if (ui_state_ == state)
135 return; 140 return;
136 141
137 ui_state_ = state; 142 ui_state_ = state;
138 143
139 #if defined(USE_AURA) 144 #if defined(USE_AURA)
140 ui::ScopedLayerAnimationSettings settings(layer()->GetAnimator()); 145 ui::ScopedLayerAnimationSettings settings(layer()->GetAnimator());
141 switch (ui_state_) { 146 switch (ui_state_) {
142 case UI_STATE_NORMAL: 147 case UI_STATE_NORMAL:
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 return gfx::ImageSkia(canvas.ExtractImageRep()); 191 return gfx::ImageSkia(canvas.ExtractImageRep());
187 } 192 }
188 193
189 void AppListItemView::ItemIconChanged() { 194 void AppListItemView::ItemIconChanged() {
190 UpdateIcon(); 195 UpdateIcon();
191 } 196 }
192 197
193 void AppListItemView::ItemTitleChanged() { 198 void AppListItemView::ItemTitleChanged() {
194 title_->SetText(UTF8ToUTF16(model_->title())); 199 title_->SetText(UTF8ToUTF16(model_->title()));
195 title_->Invalidate(); 200 title_->Invalidate();
201 UpdateTooltip();
196 Layout(); 202 Layout();
197 } 203 }
198 204
205 void AppListItemView::ItemFullNameChanged() {
206 UpdateTooltip();
207 }
208
199 void AppListItemView::ItemHighlightedChanged() { 209 void AppListItemView::ItemHighlightedChanged() {
200 apps_grid_view_->EnsureViewVisible(this); 210 apps_grid_view_->EnsureViewVisible(this);
201 SchedulePaint(); 211 SchedulePaint();
202 } 212 }
203 213
204 void AppListItemView::ItemIsInstallingChanged() { 214 void AppListItemView::ItemIsInstallingChanged() {
205 if (model_->is_installing()) 215 if (model_->is_installing())
206 apps_grid_view_->EnsureViewVisible(this); 216 apps_grid_view_->EnsureViewVisible(this);
207 title_->SetVisible(!model_->is_installing()); 217 title_->SetVisible(!model_->is_installing());
208 progress_bar_->SetVisible(model_->is_installing()); 218 progress_bar_->SetVisible(model_->is_installing());
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 SetTouchDragging(false); 409 SetTouchDragging(false);
400 break; 410 break;
401 default: 411 default:
402 break; 412 break;
403 } 413 }
404 if (!event->handled()) 414 if (!event->handled())
405 CustomButton::OnGestureEvent(event); 415 CustomButton::OnGestureEvent(event);
406 } 416 }
407 417
408 } // namespace app_list 418 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698