Chromium Code Reviews| Index: ui/app_list/views/app_list_item_view.cc |
| diff --git a/ui/app_list/views/app_list_item_view.cc b/ui/app_list/views/app_list_item_view.cc |
| index 54eda7d62cb146bd2b46de6d5d2f45d6a2173db7..06eace87a31d1a62d81b14d2a47c050fca713004 100644 |
| --- a/ui/app_list/views/app_list_item_view.cc |
| +++ b/ui/app_list/views/app_list_item_view.cc |
| @@ -96,7 +96,8 @@ AppListItemView::AppListItemView(AppsGridView* apps_grid_view, |
| } |
| AppListItemView::~AppListItemView() { |
| - item_->RemoveObserver(this); |
| + if (item_) |
|
xiyuan
2014/02/06 22:45:12
When will this happen?
jennyz
2014/02/07 00:03:10
You're right, I don't need to do so as long as mak
|
| + item_->RemoveObserver(this); |
| } |
| void AppListItemView::SetIconSize(const gfx::Size& size) { |
| @@ -266,9 +267,7 @@ void AppListItemView::Layout() { |
| rect.Inset(left_right_padding, kTopPadding, left_right_padding, 0); |
| const int y = rect.y(); |
| - gfx::Rect icon_bounds(rect.x(), y, rect.width(), icon_size_.height()); |
| - icon_bounds.Inset(gfx::ShadowValue::GetMargin(icon_shadows_)); |
| - icon_->SetBoundsRect(icon_bounds); |
| + icon_->SetBoundsRect(GetIconBoundsForTargetViewBounds(GetContentsBounds())); |
| const gfx::Size title_size = title_->GetPreferredSize(); |
| gfx::Rect title_bounds(rect.x() + (rect.width() - title_size.width()) / 2, |
| y + icon_size_.height() + kIconTitleSpacing, |
| @@ -466,4 +465,21 @@ const gfx::Rect& AppListItemView::GetIconBounds() const { |
| return icon_->bounds(); |
| } |
| +void AppListItemView::SetDragUIState() { |
|
xiyuan
2014/02/06 22:45:12
nit: Move the block under GetIconBounds to be cons
jennyz
2014/02/07 00:03:10
Isn't this just under GetIconsBound?
xiyuan
2014/02/07 00:32:19
Oops, I am blind. :p
|
| + SetUIState(UI_STATE_DRAGGING); |
| +} |
| + |
| +gfx::Rect AppListItemView::GetIconBoundsForTargetViewBounds( |
| + const gfx::Rect& target_bounds) { |
| + gfx::Rect rect(target_bounds); |
| + |
| + const int left_right_padding = |
| + title_->font_list().GetExpectedTextWidth(kLeftRightPaddingChars); |
| + rect.Inset(left_right_padding, kTopPadding, left_right_padding, 0); |
| + |
| + gfx::Rect icon_bounds(rect.x(), rect.y(), rect.width(), icon_size_.height()); |
| + icon_bounds.Inset(gfx::ShadowValue::GetMargin(icon_shadows_)); |
| + return icon_bounds; |
| +} |
| + |
| } // namespace app_list |