OLD | NEW |
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 Loading... |
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())); |
| 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 Loading... |
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 |
199 void AppListItemView::ItemHighlightedChanged() { | 205 void AppListItemView::ItemHighlightedChanged() { |
200 apps_grid_view_->EnsureViewVisible(this); | 206 apps_grid_view_->EnsureViewVisible(this); |
201 SchedulePaint(); | 207 SchedulePaint(); |
202 } | 208 } |
203 | 209 |
204 void AppListItemView::ItemIsInstallingChanged() { | 210 void AppListItemView::ItemIsInstallingChanged() { |
205 if (model_->is_installing()) | 211 if (model_->is_installing()) |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 SetTouchDragging(false); | 405 SetTouchDragging(false); |
400 break; | 406 break; |
401 default: | 407 default: |
402 break; | 408 break; |
403 } | 409 } |
404 if (!event->handled()) | 410 if (!event->handled()) |
405 CustomButton::OnGestureEvent(event); | 411 CustomButton::OnGestureEvent(event); |
406 } | 412 } |
407 | 413 |
408 } // namespace app_list | 414 } // namespace app_list |
OLD | NEW |