Chromium Code Reviews| Index: ash/launcher/app_list_launcher_item_delegate.cc |
| diff --git a/ash/launcher/app_list_launcher_item_delegate.cc b/ash/launcher/app_list_launcher_item_delegate.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9e269566e7915aa085c22abc4447a33e431b4a47 |
| --- /dev/null |
| +++ b/ash/launcher/app_list_launcher_item_delegate.cc |
| @@ -0,0 +1,61 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "ash/launcher/app_list_launcher_item_delegate.h" |
| + |
| +#include "ash/launcher/launcher_model.h" |
| +#include "ash/shell.h" |
| +#include "ash/shell_delegate.h" |
| +#include "grit/ash_strings.h" |
| +#include "ui/base/l10n/l10n_util.h" |
| + |
| +namespace ash { |
| +namespace internal { |
| + |
| +AppListLauncherItemDelegate::AppListLauncherItemDelegate() { |
| +// TODO: Create AppList LauncherItem here. |
|
Mr4D (OOO till 08-26)
2013/08/13 18:18:24
?? Does this actually work already?
simonhong_
2013/08/13 19:54:56
Yes, AppList button works well with this ItemDeleg
Mr4D (OOO till 08-26)
2013/08/14 15:52:19
Why then this comment? (that makes it sound like t
simonhong_
2013/08/14 23:47:51
Done.
|
| +} |
| + |
| +AppListLauncherItemDelegate::~AppListLauncherItemDelegate() { |
| +} |
| + |
| +void AppListLauncherItemDelegate::ItemSelected(const LauncherItem& item, |
| + const ui::Event& event) { |
| + // Passing NULL to ToggleAppList() can show app list on the right shelf |
| + // because when LauncherItem is selected target root window is set to active |
| + // root window. |
|
Mr4D (OOO till 08-26)
2013/08/14 15:52:19
I don't understand what this comment means. Maybe:
simonhong_
2013/08/14 23:47:51
Done.
|
| + Shell::GetInstance()->ToggleAppList(NULL); |
| +} |
| + |
| +base::string16 AppListLauncherItemDelegate::GetTitle(const LauncherItem& item) { |
| + LauncherModel* model = Shell::GetInstance()->launcher_model(); |
| + DCHECK(model); |
| + return model->status() == LauncherModel::STATUS_LOADING ? |
| + l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_SYNCING_TITLE) : |
| + l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_TITLE); |
| +} |
| + |
| +ui::MenuModel* AppListLauncherItemDelegate::CreateContextMenu( |
| + const LauncherItem& item, |
| + aura::RootWindow* root_window) { |
| + return NULL; |
| +} |
| + |
| +LauncherMenuModel* AppListLauncherItemDelegate::CreateApplicationMenu( |
| + const LauncherItem& item, |
| + int event_flags) { |
| + // AppList don't show application menu. |
|
Mr4D (OOO till 08-26)
2013/08/14 15:52:19
An AppList does not show an application menu.
simonhong_
2013/08/14 23:47:51
Done.
|
| + return NULL; |
| +} |
| + |
| +bool AppListLauncherItemDelegate::IsDraggable(const LauncherItem& item) { |
| + return false; |
| +} |
| + |
| +bool AppListLauncherItemDelegate::ShouldShowTooltip(const LauncherItem& item) { |
| + return true; |
| +} |
| + |
| +} // namespace internal |
| +} // namespace ash |