1 // Copyright (c) 2012 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/shell/launcher_delegate_impl.h"
7 #include "ash/launcher/launcher_util.h"
8 #include "ash/shell/toplevel_window.h"
9 #include "ash/shell/window_watcher.h"
10 #include "ash/wm/window_util.h"
11 #include "grit/ash_resources.h"
12 #include "ui/aura/window.h"
17 LauncherDelegateImpl::LauncherDelegateImpl(WindowWatcher
* watcher
)
21 LauncherDelegateImpl::~LauncherDelegateImpl() {
24 void LauncherDelegateImpl::ItemSelected(const ash::LauncherItem
& item
,
25 const ui::Event
& event
) {
26 aura::Window
* window
= watcher_
->GetWindowByID(item
.id
);
27 if (window
->type() == aura::client::WINDOW_TYPE_PANEL
)
28 ash::wm::MoveWindowToEventRoot(window
, event
);
30 ash::wm::ActivateWindow(window
);
33 base::string16
LauncherDelegateImpl::GetTitle(const ash::LauncherItem
& item
) {
34 return watcher_
->GetWindowByID(item
.id
)->title();
37 ui::MenuModel
* LauncherDelegateImpl::CreateContextMenu(
38 const ash::LauncherItem
& item
,
39 aura::RootWindow
* root_window
) {
43 ash::LauncherMenuModel
* LauncherDelegateImpl::CreateApplicationMenu(
44 const ash::LauncherItem
& item
,
49 ash::LauncherID
LauncherDelegateImpl::GetIDByWindow(aura::Window
* window
) {
50 return watcher_
? watcher_
->GetIDByWindow(window
) : 0;
53 bool LauncherDelegateImpl::IsDraggable(const ash::LauncherItem
& item
) {
57 bool LauncherDelegateImpl::ShouldShowTooltip(const ash::LauncherItem
& item
) {
61 void LauncherDelegateImpl::OnLauncherCreated(Launcher
* launcher
) {
64 void LauncherDelegateImpl::OnLauncherDestroyed(Launcher
* launcher
) {
67 bool LauncherDelegateImpl::IsPerAppLauncher() {
71 LauncherID
LauncherDelegateImpl::GetLauncherIDForAppID(
72 const std::string
& app_id
) {
76 void LauncherDelegateImpl::PinAppWithID(const std::string
& app_id
) {
79 bool LauncherDelegateImpl::IsAppPinned(const std::string
& app_id
) {
83 void LauncherDelegateImpl::UnpinAppsWithID(const std::string
& app_id
) {