Updating XTBs based on .GRDs from branch master
[chromium-blink-merge.git] / ash / shelf / app_list_shelf_item_delegate.cc
bloba0c187375fad062e438dd6b1b0e0fead0b984345
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 ShelfItemDelegate::PerformedAction AppListShelfItemDelegate::ItemSelected(
27 const ui::Event& event) {
28 // Pass NULL here to show the app list in the currently active RootWindow.
29 Shell::GetInstance()->ToggleAppList(NULL);
30 return ShelfItemDelegate::kAppListMenuShown;
33 base::string16 AppListShelfItemDelegate::GetTitle() {
34 ShelfModel* model = Shell::GetInstance()->shelf_model();
35 DCHECK(model);
36 int title_id;
37 if (app_list::switches::IsExperimentalAppListEnabled()) {
38 title_id = model->status() == ShelfModel::STATUS_LOADING
39 ? IDS_ASH_SHELF_APP_LIST_LAUNCHER_SYNCING_TITLE
40 : IDS_ASH_SHELF_APP_LIST_LAUNCHER_TITLE;
41 } else {
42 title_id = model->status() == ShelfModel::STATUS_LOADING
43 ? IDS_ASH_SHELF_APP_LIST_SYNCING_TITLE
44 : IDS_ASH_SHELF_APP_LIST_TITLE;
46 return l10n_util::GetStringUTF16(title_id);
49 ui::MenuModel* AppListShelfItemDelegate::CreateContextMenu(
50 aura::Window* root_window) {
51 return Shell::GetInstance()->delegate()->CreateContextMenu(root_window,
52 NULL,
53 NULL);
56 ShelfMenuModel* AppListShelfItemDelegate::CreateApplicationMenu(
57 int event_flags) {
58 // AppList does not show an application menu.
59 return NULL;
62 bool AppListShelfItemDelegate::IsDraggable() {
63 return false;
66 bool AppListShelfItemDelegate::ShouldShowTooltip() {
67 return true;
70 void AppListShelfItemDelegate::Close() {
73 } // namespace ash