| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/shell/launcher_delegate_impl.h" | 5 #include "ash/shell/launcher_delegate_impl.h" |
| 6 | 6 |
| 7 #include "ash/launcher/launcher_item_delegate_manager.h" |
| 7 #include "ash/launcher/launcher_util.h" | 8 #include "ash/launcher/launcher_util.h" |
| 9 #include "ash/shell.h" |
| 8 #include "ash/shell/toplevel_window.h" | 10 #include "ash/shell/toplevel_window.h" |
| 9 #include "ash/shell/window_watcher.h" | 11 #include "ash/shell/window_watcher.h" |
| 10 #include "ash/wm/window_util.h" | 12 #include "ash/wm/window_util.h" |
| 11 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 12 #include "grit/ash_resources.h" | 14 #include "grit/ash_resources.h" |
| 13 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
| 14 | 16 |
| 15 namespace ash { | 17 namespace ash { |
| 16 namespace shell { | 18 namespace shell { |
| 17 | 19 |
| 18 LauncherDelegateImpl::LauncherDelegateImpl(WindowWatcher* watcher) | 20 LauncherDelegateImpl::LauncherDelegateImpl(WindowWatcher* watcher) |
| 19 : watcher_(watcher) { | 21 : watcher_(watcher) { |
| 22 ash::LauncherItemDelegateManager* manager = |
| 23 ash::Shell::GetInstance()->launcher_item_delegate_manager(); |
| 24 manager->RegisterLauncherItemDelegate(ash::TYPE_TABBED, this); |
| 25 manager->RegisterLauncherItemDelegate(ash::TYPE_APP_PANEL, this); |
| 20 } | 26 } |
| 21 | 27 |
| 22 LauncherDelegateImpl::~LauncherDelegateImpl() { | 28 LauncherDelegateImpl::~LauncherDelegateImpl() { |
| 29 ash::LauncherItemDelegateManager* manager = |
| 30 ash::Shell::GetInstance()->launcher_item_delegate_manager(); |
| 31 manager->UnregisterLauncherItemDelegate(ash::TYPE_TABBED); |
| 32 manager->UnregisterLauncherItemDelegate(ash::TYPE_APP_PANEL); |
| 23 } | 33 } |
| 24 | 34 |
| 25 void LauncherDelegateImpl::ItemSelected(const ash::LauncherItem& item, | 35 void LauncherDelegateImpl::ItemSelected(const ash::LauncherItem& item, |
| 26 const ui::Event& event) { | 36 const ui::Event& event) { |
| 27 aura::Window* window = watcher_->GetWindowByID(item.id); | 37 aura::Window* window = watcher_->GetWindowByID(item.id); |
| 28 if (window->type() == aura::client::WINDOW_TYPE_PANEL) | 38 if (window->type() == aura::client::WINDOW_TYPE_PANEL) |
| 29 ash::wm::MoveWindowToEventRoot(window, event); | 39 ash::wm::MoveWindowToEventRoot(window, event); |
| 30 window->Show(); | 40 window->Show(); |
| 31 ash::wm::ActivateWindow(window); | 41 ash::wm::ActivateWindow(window); |
| 32 } | 42 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 89 |
| 80 bool LauncherDelegateImpl::IsAppPinned(const std::string& app_id) { | 90 bool LauncherDelegateImpl::IsAppPinned(const std::string& app_id) { |
| 81 return false; | 91 return false; |
| 82 } | 92 } |
| 83 | 93 |
| 84 void LauncherDelegateImpl::UnpinAppWithID(const std::string& app_id) { | 94 void LauncherDelegateImpl::UnpinAppWithID(const std::string& app_id) { |
| 85 } | 95 } |
| 86 | 96 |
| 87 } // namespace shell | 97 } // namespace shell |
| 88 } // namespace ash | 98 } // namespace ash |
| OLD | NEW |