Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / ash / shelf / app_list_shelf_item_delegate.cc
blob99c58e1eecbe4588dd33602065af819b34d99f1d
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"
8 #include "ash/shell.h"
9 #include "ash/shell_delegate.h"
10 #include "grit/ash_strings.h"
11 #include "ui/app_list/app_list_switches.h"
12 #include "ui/base/l10n/l10n_util.h"
14 namespace ash {
16 AppListShelfItemDelegate::AppListShelfItemDelegate() {
17 ShelfItem app_list;
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);
29 return false;
32 base::string16 AppListShelfItemDelegate::GetTitle() {
33 ShelfModel* model = Shell::GetInstance()->shelf_model();
34 DCHECK(model);
35 int title_id;
36 if (app_list::switches::IsExperimentalAppListEnabled()) {
37 title_id = model->status() == ShelfModel::STATUS_LOADING
38 ? IDS_ASH_SHELF_APP_LIST_LAUNCHER_SYNCING_TITLE
39 : IDS_ASH_SHELF_APP_LIST_LAUNCHER_TITLE;
40 } else {
41 title_id = model->status() == ShelfModel::STATUS_LOADING
42 ? IDS_ASH_SHELF_APP_LIST_SYNCING_TITLE
43 : IDS_ASH_SHELF_APP_LIST_TITLE;
45 return l10n_util::GetStringUTF16(title_id);
48 ui::MenuModel* AppListShelfItemDelegate::CreateContextMenu(
49 aura::Window* root_window) {
50 return Shell::GetInstance()->delegate()->CreateContextMenu(root_window,
51 NULL,
52 NULL);
55 ShelfMenuModel* AppListShelfItemDelegate::CreateApplicationMenu(
56 int event_flags) {
57 // AppList does not show an application menu.
58 return NULL;
61 bool AppListShelfItemDelegate::IsDraggable() {
62 return false;
65 bool AppListShelfItemDelegate::ShouldShowTooltip() {
66 return true;
69 void AppListShelfItemDelegate::Close() {
72 } // namespace ash