Add a struct for spellcheck marker
[chromium-blink-merge.git] / ash / shell / launcher_delegate_impl.cc
blob601adaccbfbc909e8f304b29606028515eb6ef2f
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"
14 namespace ash {
15 namespace shell {
17 LauncherDelegateImpl::LauncherDelegateImpl(WindowWatcher* watcher)
18 : watcher_(watcher) {
21 LauncherDelegateImpl::~LauncherDelegateImpl() {
24 // In the shell we'll create a window all the time.
25 void LauncherDelegateImpl::OnBrowserShortcutClicked(int event_flags) {
26 ash::shell::ToplevelWindow::CreateParams create_params;
27 create_params.can_resize = true;
28 create_params.can_maximize = true;
29 ash::shell::ToplevelWindow::CreateToplevelWindow(create_params);
32 void LauncherDelegateImpl::ItemSelected(const ash::LauncherItem& item,
33 const ui::Event& event) {
34 aura::Window* window = watcher_->GetWindowByID(item.id);
35 if (window->type() == aura::client::WINDOW_TYPE_PANEL)
36 ash::wm::MoveWindowToEventRoot(window, event);
37 window->Show();
38 ash::wm::ActivateWindow(window);
41 int LauncherDelegateImpl::GetBrowserShortcutResourceId() {
42 return IDR_AURA_LAUNCHER_BROWSER_SHORTCUT;
45 base::string16 LauncherDelegateImpl::GetTitle(const ash::LauncherItem& item) {
46 return watcher_->GetWindowByID(item.id)->title();
49 ui::MenuModel* LauncherDelegateImpl::CreateContextMenu(
50 const ash::LauncherItem& item,
51 aura::RootWindow* root_window) {
52 return NULL;
55 ash::LauncherMenuModel* LauncherDelegateImpl::CreateApplicationMenu(
56 const ash::LauncherItem& item,
57 int event_flags) {
58 return NULL;
61 ash::LauncherID LauncherDelegateImpl::GetIDByWindow(aura::Window* window) {
62 return watcher_ ? watcher_->GetIDByWindow(window) : 0;
65 bool LauncherDelegateImpl::IsDraggable(const ash::LauncherItem& item) {
66 return true;
69 bool LauncherDelegateImpl::ShouldShowTooltip(const ash::LauncherItem& item) {
70 return true;
73 void LauncherDelegateImpl::OnLauncherCreated(Launcher* launcher) {
76 void LauncherDelegateImpl::OnLauncherDestroyed(Launcher* launcher) {
79 bool LauncherDelegateImpl::IsPerAppLauncher() {
80 return false;
83 LauncherID LauncherDelegateImpl::GetLauncherIDForAppID(
84 const std::string& app_id) {
85 return 0;
88 void LauncherDelegateImpl::PinAppWithID(const std::string& app_id) {
91 void LauncherDelegateImpl::UnpinAppsWithID(const std::string& app_id) {
94 } // namespace shell
95 } // namespace ash