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
3 // found in the LICENSE file.
5 #include "ash/shelf/app_list_shelf_item_delegate.h"
7 #include "ash/shelf/shelf_model.h"
9 #include "ash/shell_delegate.h"
10 #include "grit/ash_strings.h"
11 #include "ui/base/l10n/l10n_util.h"
16 AppListShelfItemDelegate::AppListShelfItemDelegate() {
18 app_list.type = TYPE_APP_LIST;
19 Shell::GetInstance()->shelf_model()->Add(app_list);
22 AppListShelfItemDelegate::~AppListShelfItemDelegate() {
23 // ShelfItemDelegateManager owns and destroys this class.
26 bool AppListShelfItemDelegate::ItemSelected(const ui::Event& event) {
27 // Pass NULL here to show the app list in the currently active RootWindow.
28 Shell::GetInstance()->ToggleAppList(NULL);
32 base::string16 AppListShelfItemDelegate::GetTitle() {
33 ShelfModel* model = Shell::GetInstance()->shelf_model();
35 return model->status() == ShelfModel::STATUS_LOADING ?
36 l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_SYNCING_TITLE) :
37 l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_TITLE);
40 ui::MenuModel* AppListShelfItemDelegate::CreateContextMenu(
41 aura::Window* root_window) {
42 return Shell::GetInstance()->delegate()->CreateContextMenu(root_window,
47 ShelfMenuModel* AppListShelfItemDelegate::CreateApplicationMenu(
49 // AppList does not show an application menu.
53 bool AppListShelfItemDelegate::IsDraggable() {
57 bool AppListShelfItemDelegate::ShouldShowTooltip() {
61 void AppListShelfItemDelegate::Close() {
64 } // namespace internal