Replacing old devtools pillar page with newer one
[chromium-blink-merge.git] / ash / shelf / app_list_shelf_item_delegate.cc
blob18ff11d265344403269d1f4a5f533a59f849169a
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/base/l10n/l10n_util.h"
13 namespace ash {
14 namespace internal {
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 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,
43 NULL,
44 NULL);
47 ShelfMenuModel* AppListShelfItemDelegate::CreateApplicationMenu(
48 int event_flags) {
49 // AppList does not show an application menu.
50 return NULL;
53 bool AppListShelfItemDelegate::IsDraggable() {
54 return false;
57 bool AppListShelfItemDelegate::ShouldShowTooltip() {
58 return true;
61 void AppListShelfItemDelegate::Close() {
64 } // namespace internal
65 } // namespace ash