Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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. | |
| 4 | |
| 5 #include "ash/launcher/app_list_launcher_item_delegate.h" | |
| 6 | |
| 7 #include "ash/launcher/launcher_item_delegate_manager.h" | |
| 8 #include "ash/launcher/launcher_model.h" | |
| 9 #include "ash/shell.h" | |
| 10 #include "ash/shell_delegate.h" | |
| 11 #include "grit/ash_strings.h" | |
| 12 #include "ui/base/l10n/l10n_util.h" | |
| 13 | |
| 14 namespace ash { | |
| 15 namespace internal { | |
| 16 | |
| 17 AppListLauncherItemDelegate::AppListLauncherItemDelegate() { | |
| 18 // TODO(simon.hong81): This works for the moment, but the AppList LauncherItem | |
|
sky
2013/08/27 00:03:47
nit: indent comments here and 25/26.
simonhong_
2013/08/27 01:05:29
Done.
| |
| 19 // creation should move here. | |
| 20 ash::Shell::GetInstance()->launcher_item_delegate_manager()-> | |
| 21 RegisterLauncherItemDelegate(ash::TYPE_APP_LIST, this); | |
| 22 } | |
| 23 | |
| 24 AppListLauncherItemDelegate::~AppListLauncherItemDelegate() { | |
| 25 // Don't unregister this from LauncherItemDelegateManager. | |
| 26 // LauncherItemDelegateManager is already destroyed. | |
| 27 } | |
| 28 | |
| 29 void AppListLauncherItemDelegate::ItemSelected(const LauncherItem& item, | |
| 30 const ui::Event& event) { | |
| 31 // Pass NULL here to show the app list in the currently active RootWindow. | |
| 32 Shell::GetInstance()->ToggleAppList(NULL); | |
| 33 } | |
| 34 | |
| 35 base::string16 AppListLauncherItemDelegate::GetTitle(const LauncherItem& item) { | |
| 36 LauncherModel* model = Shell::GetInstance()->launcher_model(); | |
| 37 DCHECK(model); | |
| 38 return model->status() == LauncherModel::STATUS_LOADING ? | |
| 39 l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_SYNCING_TITLE) : | |
| 40 l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_TITLE); | |
| 41 } | |
| 42 | |
| 43 ui::MenuModel* AppListLauncherItemDelegate::CreateContextMenu( | |
| 44 const LauncherItem& item, | |
| 45 aura::RootWindow* root_window) { | |
| 46 return NULL; | |
| 47 } | |
| 48 | |
| 49 LauncherMenuModel* AppListLauncherItemDelegate::CreateApplicationMenu( | |
| 50 const LauncherItem& item, | |
| 51 int event_flags) { | |
| 52 // AppList does not show an application menu. | |
| 53 return NULL; | |
| 54 } | |
| 55 | |
| 56 bool AppListLauncherItemDelegate::IsDraggable(const LauncherItem& item) { | |
| 57 return false; | |
| 58 } | |
| 59 | |
| 60 bool AppListLauncherItemDelegate::ShouldShowTooltip(const LauncherItem& item) { | |
| 61 return true; | |
| 62 } | |
| 63 | |
| 64 } // namespace internal | |
| 65 } // namespace ash | |
| OLD | NEW |