OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/shelf/app_list_shelf_item_delegate.h" | 5 #include "ash/common/shelf/app_list_shelf_item_delegate.h" |
6 | 6 |
7 #include "ash/common/shelf/shelf_model.h" | 7 #include "ash/common/shelf/shelf_model.h" |
8 #include "ash/shell.h" | 8 #include "ash/common/wm_shell.h" |
9 #include "grit/ash_strings.h" | 9 #include "grit/ash_strings.h" |
10 #include "ui/app_list/app_list_switches.h" | 10 #include "ui/app_list/app_list_switches.h" |
11 #include "ui/base/l10n/l10n_util.h" | 11 #include "ui/base/l10n/l10n_util.h" |
12 | 12 |
13 namespace ash { | 13 namespace ash { |
14 | 14 |
15 AppListShelfItemDelegate::AppListShelfItemDelegate() { | 15 AppListShelfItemDelegate::AppListShelfItemDelegate() { |
16 ShelfItem app_list; | 16 ShelfItem app_list; |
17 app_list.type = TYPE_APP_LIST; | 17 app_list.type = TYPE_APP_LIST; |
18 Shell::GetInstance()->shelf_model()->Add(app_list); | 18 WmShell::Get()->shelf_model()->Add(app_list); |
19 } | 19 } |
20 | 20 |
21 AppListShelfItemDelegate::~AppListShelfItemDelegate() { | 21 AppListShelfItemDelegate::~AppListShelfItemDelegate() { |
22 // ShelfItemDelegateManager owns and destroys this class. | 22 // ShelfItemDelegateManager owns and destroys this class. |
23 } | 23 } |
24 | 24 |
25 ShelfItemDelegate::PerformedAction AppListShelfItemDelegate::ItemSelected( | 25 ShelfItemDelegate::PerformedAction AppListShelfItemDelegate::ItemSelected( |
26 const ui::Event& event) { | 26 const ui::Event& event) { |
27 // Pass NULL here to show the app list in the currently active RootWindow. | 27 WmShell::Get()->ToggleAppList(); |
28 Shell::GetInstance()->ToggleAppList(NULL); | |
29 return ShelfItemDelegate::kAppListMenuShown; | 28 return ShelfItemDelegate::kAppListMenuShown; |
30 } | 29 } |
31 | 30 |
32 base::string16 AppListShelfItemDelegate::GetTitle() { | 31 base::string16 AppListShelfItemDelegate::GetTitle() { |
33 ShelfModel* model = Shell::GetInstance()->shelf_model(); | 32 ShelfModel* model = WmShell::Get()->shelf_model(); |
34 DCHECK(model); | 33 DCHECK(model); |
35 int title_id; | 34 int title_id; |
36 if (app_list::switches::IsExperimentalAppListEnabled()) { | 35 if (app_list::switches::IsExperimentalAppListEnabled()) { |
37 title_id = model->status() == ShelfModel::STATUS_LOADING | 36 title_id = model->status() == ShelfModel::STATUS_LOADING |
38 ? IDS_ASH_SHELF_APP_LIST_LAUNCHER_SYNCING_TITLE | 37 ? IDS_ASH_SHELF_APP_LIST_LAUNCHER_SYNCING_TITLE |
39 : IDS_ASH_SHELF_APP_LIST_LAUNCHER_TITLE; | 38 : IDS_ASH_SHELF_APP_LIST_LAUNCHER_TITLE; |
40 } else { | 39 } else { |
41 title_id = model->status() == ShelfModel::STATUS_LOADING | 40 title_id = model->status() == ShelfModel::STATUS_LOADING |
42 ? IDS_ASH_SHELF_APP_LIST_SYNCING_TITLE | 41 ? IDS_ASH_SHELF_APP_LIST_SYNCING_TITLE |
43 : IDS_ASH_SHELF_APP_LIST_TITLE; | 42 : IDS_ASH_SHELF_APP_LIST_TITLE; |
(...skipping 15 matching lines...) Expand all Loading... |
59 return true; | 58 return true; |
60 } | 59 } |
61 | 60 |
62 bool AppListShelfItemDelegate::ShouldShowTooltip() { | 61 bool AppListShelfItemDelegate::ShouldShowTooltip() { |
63 return true; | 62 return true; |
64 } | 63 } |
65 | 64 |
66 void AppListShelfItemDelegate::Close() {} | 65 void AppListShelfItemDelegate::Close() {} |
67 | 66 |
68 } // namespace ash | 67 } // namespace ash |
OLD | NEW |