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/app_list_constants.h" | 7 #include "ui/app_list/app_list_constants.h" |
8 #include "ui/app_list/app_list_item.h" | 8 #include "ui/app_list/app_list_item.h" |
9 #include "ui/app_list/app_list_item_list.h" | 9 #include "ui/app_list/app_list_item_list.h" |
10 #include "ui/app_list/folder_image_source.h" | 10 #include "ui/app_list/folder_image_source.h" |
11 #include "ui/app_list/views/contents_view.h" | 11 #include "ui/app_list/views/contents_view.h" |
12 #include "ui/base/l10n/l10n_util.h" | 12 #include "ui/base/l10n/l10n_util.h" |
13 #include "ui/gfx/image/image_skia.h" | 13 #include "ui/gfx/image/image_skia.h" |
14 #include "ui/strings/grit/ui_strings.h" | 14 #include "ui/strings/grit/ui_strings.h" |
15 | 15 |
16 namespace app_list { | 16 namespace app_list { |
17 | 17 |
18 AllAppsTileItemView::AllAppsTileItemView(ContentsView* contents_view) | 18 AllAppsTileItemView::AllAppsTileItemView(ContentsView* contents_view, |
19 : contents_view_(contents_view) { | 19 AppListItemList* item_list) |
20 : contents_view_(contents_view), folder_image_(item_list) { | |
20 SetTitle(l10n_util::GetStringUTF16(IDS_APP_LIST_ALL_APPS)); | 21 SetTitle(l10n_util::GetStringUTF16(IDS_APP_LIST_ALL_APPS)); |
21 // TODO(mgiuca): Set the button's icon. | 22 folder_image_.AddObserver(this); |
22 } | 23 } |
23 | 24 |
24 AllAppsTileItemView::~AllAppsTileItemView() { | 25 AllAppsTileItemView::~AllAppsTileItemView() { |
26 folder_image_.RemoveObserver(this); | |
27 } | |
28 | |
29 void AllAppsTileItemView::UpdateIcon() { | |
30 folder_image_.UpdateIcon(); | |
calamity
2014/10/28 05:12:58
It would be nice not to need this. If FolderImage'
Matt Giuca
2014/10/29 07:11:23
Yeah would be nice...
http://google-styleguide.go
| |
25 } | 31 } |
26 | 32 |
27 void AllAppsTileItemView::ButtonPressed(views::Button* sender, | 33 void AllAppsTileItemView::ButtonPressed(views::Button* sender, |
28 const ui::Event& event) { | 34 const ui::Event& event) { |
29 contents_view_->SetActivePage( | 35 contents_view_->SetActivePage( |
30 contents_view_->GetPageIndexForNamedPage(ContentsView::NAMED_PAGE_APPS)); | 36 contents_view_->GetPageIndexForNamedPage(ContentsView::NAMED_PAGE_APPS)); |
31 } | 37 } |
32 | 38 |
39 void AllAppsTileItemView::OnFolderImageUpdated(const gfx::ImageSkia& icon) { | |
40 SetIcon(icon); | |
41 } | |
42 | |
33 } // namespace app_list | 43 } // namespace app_list |
OLD | NEW |