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
3 // found in the LICENSE file.
5 #include "ui/app_list/views/all_apps_tile_item_view.h"
7 #include "base/metrics/histogram_macros.h"
8 #include "ui/app_list/app_list_constants.h"
9 #include "ui/app_list/views/contents_view.h"
10 #include "ui/base/l10n/l10n_util.h"
11 #include "ui/strings/grit/ui_strings.h"
15 AllAppsTileItemView::AllAppsTileItemView(ContentsView
* contents_view
,
16 AppListItemList
* item_list
)
17 : contents_view_(contents_view
), folder_image_(item_list
) {
18 SetTitle(l10n_util::GetStringUTF16(IDS_APP_LIST_ALL_APPS
));
19 folder_image_
.AddObserver(this);
22 AllAppsTileItemView::~AllAppsTileItemView() {
23 folder_image_
.RemoveObserver(this);
26 void AllAppsTileItemView::UpdateIcon() {
27 folder_image_
.UpdateIcon();
30 void AllAppsTileItemView::ButtonPressed(views::Button
* sender
,
31 const ui::Event
& event
) {
32 UMA_HISTOGRAM_ENUMERATION(kPageOpenedHistogram
, AppListModel::STATE_APPS
,
33 AppListModel::STATE_LAST
);
35 contents_view_
->SetActiveState(AppListModel::STATE_APPS
);
38 void AllAppsTileItemView::OnFolderImageUpdated() {
39 SetIcon(folder_image_
.icon());
42 } // namespace app_list