| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/app_list_folder_item.h" | 5 #include "ui/app_list/app_list_folder_item.h" |
| 6 | 6 |
| 7 #include "base/guid.h" | 7 #include "base/guid.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_list.h" | 9 #include "ui/app_list/app_list_item_list.h" |
| 10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 for (size_t i = 0; i < top_items_.size(); ++i) | 91 for (size_t i = 0; i < top_items_.size(); ++i) |
| 92 top_items_[i]->RemoveObserver(this); | 92 top_items_[i]->RemoveObserver(this); |
| 93 item_list_->RemoveObserver(this); | 93 item_list_->RemoveObserver(this); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void AppListFolderItem::UpdateIcon() { | 96 void AppListFolderItem::UpdateIcon() { |
| 97 FolderImageSource::Icons top_icons; | 97 FolderImageSource::Icons top_icons; |
| 98 for (size_t i = 0; i < top_items_.size(); ++i) | 98 for (size_t i = 0; i < top_items_.size(); ++i) |
| 99 top_icons.push_back(top_items_[i]->icon()); | 99 top_icons.push_back(top_items_[i]->icon()); |
| 100 | 100 |
| 101 const gfx::Size icon_size = | 101 const gfx::Size icon_size = gfx::Size(kGridIconDimension, kGridIconDimension); |
| 102 gfx::Size(kPreferredIconDimension, kPreferredIconDimension); | |
| 103 gfx::ImageSkia icon = gfx::ImageSkia( | 102 gfx::ImageSkia icon = gfx::ImageSkia( |
| 104 new FolderImageSource(top_icons, icon_size), | 103 new FolderImageSource(top_icons, icon_size), |
| 105 icon_size); | 104 icon_size); |
| 106 SetIcon(icon, false); | 105 SetIcon(icon, false); |
| 107 } | 106 } |
| 108 | 107 |
| 109 const gfx::ImageSkia& AppListFolderItem::GetTopIcon(size_t item_index) { | 108 const gfx::ImageSkia& AppListFolderItem::GetTopIcon(size_t item_index) { |
| 110 DCHECK(item_index <= top_items_.size()); | 109 DCHECK(item_index <= top_items_.size()); |
| 111 return top_items_[item_index]->icon(); | 110 return top_items_[item_index]->icon(); |
| 112 } | 111 } |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 for (size_t i = 0; | 249 for (size_t i = 0; |
| 251 i < kNumFolderTopItems && i < item_list_->item_count(); ++i) { | 250 i < kNumFolderTopItems && i < item_list_->item_count(); ++i) { |
| 252 AppListItem* item = item_list_->item_at(i); | 251 AppListItem* item = item_list_->item_at(i); |
| 253 item->AddObserver(this); | 252 item->AddObserver(this); |
| 254 top_items_.push_back(item); | 253 top_items_.push_back(item); |
| 255 } | 254 } |
| 256 UpdateIcon(); | 255 UpdateIcon(); |
| 257 } | 256 } |
| 258 | 257 |
| 259 } // namespace app_list | 258 } // namespace app_list |
| OLD | NEW |