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/all_apps_tile_item_view.h" | 5 #include "ui/app_list/views/all_apps_tile_item_view.h" |
6 | 6 |
7 #include "ui/app_list/views/contents_view.h" | 7 #include "ui/app_list/views/contents_view.h" |
8 #include "ui/base/l10n/l10n_util.h" | 8 #include "ui/base/l10n/l10n_util.h" |
9 #include "ui/strings/grit/ui_strings.h" | 9 #include "ui/strings/grit/ui_strings.h" |
10 | 10 |
11 namespace app_list { | 11 namespace app_list { |
12 | 12 |
13 AllAppsTileItemView::AllAppsTileItemView(ContentsView* contents_view) | 13 AllAppsTileItemView::AllAppsTileItemView(ContentsView* contents_view, |
14 : contents_view_(contents_view) { | 14 AppListItemList* item_list) |
| 15 : contents_view_(contents_view), folder_image_(item_list) { |
15 SetTitle(l10n_util::GetStringUTF16(IDS_APP_LIST_ALL_APPS)); | 16 SetTitle(l10n_util::GetStringUTF16(IDS_APP_LIST_ALL_APPS)); |
16 // TODO(mgiuca): Set the button's icon. | 17 folder_image_.AddObserver(this); |
17 } | 18 } |
18 | 19 |
19 AllAppsTileItemView::~AllAppsTileItemView() { | 20 AllAppsTileItemView::~AllAppsTileItemView() { |
| 21 folder_image_.RemoveObserver(this); |
| 22 } |
| 23 |
| 24 void AllAppsTileItemView::UpdateIcon() { |
| 25 folder_image_.UpdateIcon(); |
20 } | 26 } |
21 | 27 |
22 void AllAppsTileItemView::ButtonPressed(views::Button* sender, | 28 void AllAppsTileItemView::ButtonPressed(views::Button* sender, |
23 const ui::Event& event) { | 29 const ui::Event& event) { |
24 contents_view_->SetActivePage( | 30 contents_view_->SetActivePage( |
25 contents_view_->GetPageIndexForState(AppListModel::STATE_APPS)); | 31 contents_view_->GetPageIndexForState(AppListModel::STATE_APPS)); |
26 } | 32 } |
27 | 33 |
| 34 void AllAppsTileItemView::OnFolderImageUpdated() { |
| 35 SetIcon(folder_image_.icon()); |
| 36 } |
| 37 |
28 } // namespace app_list | 38 } // namespace app_list |
OLD | NEW |