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_util.h" |
7 #include "ash/shell/toplevel_window.h" | 8 #include "ash/shell/toplevel_window.h" |
8 #include "ash/shell/window_watcher.h" | 9 #include "ash/shell/window_watcher.h" |
9 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
10 #include "grit/ash_resources.h" | 11 #include "grit/ash_resources.h" |
11 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
12 | 13 |
13 namespace ash { | 14 namespace ash { |
14 namespace shell { | 15 namespace shell { |
15 | 16 |
16 LauncherDelegateImpl::LauncherDelegateImpl(WindowWatcher* watcher) | 17 LauncherDelegateImpl::LauncherDelegateImpl(WindowWatcher* watcher) |
17 : watcher_(watcher) { | 18 : watcher_(watcher) { |
18 } | 19 } |
19 | 20 |
20 LauncherDelegateImpl::~LauncherDelegateImpl() { | 21 LauncherDelegateImpl::~LauncherDelegateImpl() { |
21 } | 22 } |
22 | 23 |
23 // In the shell we'll create a window all the time. | 24 // In the shell we'll create a window all the time. |
24 void LauncherDelegateImpl::OnBrowserShortcutClicked(int event_flags) { | 25 void LauncherDelegateImpl::OnBrowserShortcutClicked(int event_flags) { |
25 ash::shell::ToplevelWindow::CreateParams create_params; | 26 ash::shell::ToplevelWindow::CreateParams create_params; |
26 create_params.can_resize = true; | 27 create_params.can_resize = true; |
27 create_params.can_maximize = true; | 28 create_params.can_maximize = true; |
28 ash::shell::ToplevelWindow::CreateToplevelWindow(create_params); | 29 ash::shell::ToplevelWindow::CreateToplevelWindow(create_params); |
29 } | 30 } |
30 | 31 |
31 void LauncherDelegateImpl::ItemClicked(const ash::LauncherItem& item, | 32 void LauncherDelegateImpl::ItemClicked(const ash::LauncherItem& item, |
32 int event_flags) { | 33 const ui::Event& event) { |
33 aura::Window* window = watcher_->GetWindowByID(item.id); | 34 aura::Window* window = watcher_->GetWindowByID(item.id); |
| 35 ash::launcher::MoveToEventRootIfPanel(window, event); |
34 window->Show(); | 36 window->Show(); |
35 ash::wm::ActivateWindow(window); | 37 ash::wm::ActivateWindow(window); |
36 } | 38 } |
37 | 39 |
38 int LauncherDelegateImpl::GetBrowserShortcutResourceId() { | 40 int LauncherDelegateImpl::GetBrowserShortcutResourceId() { |
39 return IDR_AURA_LAUNCHER_BROWSER_SHORTCUT; | 41 return IDR_AURA_LAUNCHER_BROWSER_SHORTCUT; |
40 } | 42 } |
41 | 43 |
42 string16 LauncherDelegateImpl::GetTitle(const ash::LauncherItem& item) { | 44 string16 LauncherDelegateImpl::GetTitle(const ash::LauncherItem& item) { |
43 return watcher_->GetWindowByID(item.id)->title(); | 45 return watcher_->GetWindowByID(item.id)->title(); |
(...skipping 13 matching lines...) Expand all Loading... |
57 ash::LauncherID LauncherDelegateImpl::GetIDByWindow(aura::Window* window) { | 59 ash::LauncherID LauncherDelegateImpl::GetIDByWindow(aura::Window* window) { |
58 return watcher_ ? watcher_->GetIDByWindow(window) : 0; | 60 return watcher_ ? watcher_->GetIDByWindow(window) : 0; |
59 } | 61 } |
60 | 62 |
61 bool LauncherDelegateImpl::IsDraggable(const ash::LauncherItem& item) { | 63 bool LauncherDelegateImpl::IsDraggable(const ash::LauncherItem& item) { |
62 return true; | 64 return true; |
63 } | 65 } |
64 | 66 |
65 } // namespace shell | 67 } // namespace shell |
66 } // namespace ash | 68 } // namespace ash |
OLD | NEW |