| OLD | NEW |
| 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 "ui/app_list/app_list_constants.h" | 7 #include "ui/app_list/app_list_constants.h" |
| 8 #include "ui/app_list/views/app_list_main_view.h" | 8 #include "ui/app_list/views/app_list_main_view.h" |
| 9 #include "ui/views/background.h" | 9 #include "ui/views/background.h" |
| 10 #include "ui/views/controls/image_view.h" | 10 #include "ui/views/controls/image_view.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 TileItemView::~TileItemView() { | 49 TileItemView::~TileItemView() { |
| 50 } | 50 } |
| 51 | 51 |
| 52 void TileItemView::SetSelected(bool selected) { | 52 void TileItemView::SetSelected(bool selected) { |
| 53 if (selected == selected_) | 53 if (selected == selected_) |
| 54 return; | 54 return; |
| 55 | 55 |
| 56 selected_ = selected; | 56 selected_ = selected; |
| 57 UpdateBackgroundColor(); | 57 UpdateBackgroundColor(); |
| 58 NotifyAccessibilityEvent(ui::AX_EVENT_FOCUS, true); |
| 58 } | 59 } |
| 59 | 60 |
| 60 void TileItemView::SetParentBackgroundColor(SkColor color) { | 61 void TileItemView::SetParentBackgroundColor(SkColor color) { |
| 61 parent_background_color_ = color; | 62 parent_background_color_ = color; |
| 62 UpdateBackgroundColor(); | 63 UpdateBackgroundColor(); |
| 63 } | 64 } |
| 64 | 65 |
| 65 void TileItemView::SetIcon(const gfx::ImageSkia& icon) { | 66 void TileItemView::SetIcon(const gfx::ImageSkia& icon) { |
| 66 icon_->SetImage(icon); | 67 icon_->SetImage(icon); |
| 67 } | 68 } |
| 68 | 69 |
| 69 void TileItemView::SetTitle(const base::string16& title) { | 70 void TileItemView::SetTitle(const base::string16& title) { |
| 70 title_->SetText(title); | 71 title_->SetText(title); |
| 72 SetAccessibleName(title); |
| 71 } | 73 } |
| 72 | 74 |
| 73 void TileItemView::StateChanged() { | 75 void TileItemView::StateChanged() { |
| 74 UpdateBackgroundColor(); | 76 UpdateBackgroundColor(); |
| 75 } | 77 } |
| 76 | 78 |
| 77 void TileItemView::UpdateBackgroundColor() { | 79 void TileItemView::UpdateBackgroundColor() { |
| 78 views::Background* background = nullptr; | 80 views::Background* background = nullptr; |
| 79 SkColor background_color = parent_background_color_; | 81 SkColor background_color = parent_background_color_; |
| 80 | 82 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 93 | 95 |
| 94 set_background(background); | 96 set_background(background); |
| 95 SchedulePaint(); | 97 SchedulePaint(); |
| 96 } | 98 } |
| 97 | 99 |
| 98 gfx::Size TileItemView::GetPreferredSize() const { | 100 gfx::Size TileItemView::GetPreferredSize() const { |
| 99 return gfx::Size(kTileSize, kTileSize); | 101 return gfx::Size(kTileSize, kTileSize); |
| 100 } | 102 } |
| 101 | 103 |
| 102 } // namespace app_list | 104 } // namespace app_list |
| OLD | NEW |