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/shelf/app_list_shelf_item_delegate.h" |
6 | 6 |
7 #include "ash/shelf/shelf_model.h" | 7 #include "ash/shelf/shelf_model.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_delegate.h" | 9 #include "ash/shell_delegate.h" |
10 #include "grit/ash_strings.h" | 10 #include "grit/ash_strings.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 Shell::GetInstance()->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 bool AppListShelfItemDelegate::ItemSelected(const ui::Event& event) { | 25 bool AppListShelfItemDelegate::ItemSelected(const ui::Event& event) { |
26 // Pass NULL here to show the app list in the currently active RootWindow. | 26 // Pass NULL here to show the app list in the currently active RootWindow. |
27 Shell::GetInstance()->ToggleAppList(NULL); | 27 if (Shell::GetInstance()->GetAppListTargetVisibility()) |
Matt Giuca
2014/08/14 04:17:07
... here's the second one.
calamity
2014/08/14 05:00:59
Done.
| |
28 Shell::GetInstance()->DismissAppList(); | |
29 else | |
30 Shell::GetInstance()->ShowAppList(NULL); | |
28 return false; | 31 return false; |
29 } | 32 } |
30 | 33 |
31 base::string16 AppListShelfItemDelegate::GetTitle() { | 34 base::string16 AppListShelfItemDelegate::GetTitle() { |
32 ShelfModel* model = Shell::GetInstance()->shelf_model(); | 35 ShelfModel* model = Shell::GetInstance()->shelf_model(); |
33 DCHECK(model); | 36 DCHECK(model); |
34 return model->status() == ShelfModel::STATUS_LOADING ? | 37 return model->status() == ShelfModel::STATUS_LOADING ? |
35 l10n_util::GetStringUTF16(IDS_ASH_SHELF_APP_LIST_SYNCING_TITLE) : | 38 l10n_util::GetStringUTF16(IDS_ASH_SHELF_APP_LIST_SYNCING_TITLE) : |
36 l10n_util::GetStringUTF16(IDS_ASH_SHELF_APP_LIST_TITLE); | 39 l10n_util::GetStringUTF16(IDS_ASH_SHELF_APP_LIST_TITLE); |
37 } | 40 } |
(...skipping 16 matching lines...) Expand all Loading... | |
54 } | 57 } |
55 | 58 |
56 bool AppListShelfItemDelegate::ShouldShowTooltip() { | 59 bool AppListShelfItemDelegate::ShouldShowTooltip() { |
57 return true; | 60 return true; |
58 } | 61 } |
59 | 62 |
60 void AppListShelfItemDelegate::Close() { | 63 void AppListShelfItemDelegate::Close() { |
61 } | 64 } |
62 | 65 |
63 } // namespace ash | 66 } // namespace ash |
OLD | NEW |