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/wm/app_list_controller.h" | 5 #include "ash/wm/app_list_controller.h" |
6 | 6 |
7 #include "ash/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_delegate.h" | 10 #include "ash/shell_delegate.h" |
11 #include "ash/shell_window_ids.h" | 11 #include "ash/shell_window_ids.h" |
12 #include "ash/wm/property_util.h" | 12 #include "ash/wm/property_util.h" |
13 #include "ash/wm/shelf_layout_manager.h" | 13 #include "ash/wm/shelf_layout_manager.h" |
14 #include "ui/app_list/app_list_view.h" | 14 #include "ui/app_list/app_list_view.h" |
15 #include "ui/app_list/icon_cache.h" | 15 #include "ui/app_list/icon_cache.h" |
16 #include "ui/app_list/pagination_model.h" | 16 #include "ui/app_list/pagination_model.h" |
17 #include "ui/aura/event.h" | |
18 #include "ui/aura/focus_manager.h" | 17 #include "ui/aura/focus_manager.h" |
19 #include "ui/aura/root_window.h" | 18 #include "ui/aura/root_window.h" |
20 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
| 20 #include "ui/base/event.h" |
21 #include "ui/compositor/layer.h" | 21 #include "ui/compositor/layer.h" |
22 #include "ui/compositor/scoped_layer_animation_settings.h" | 22 #include "ui/compositor/scoped_layer_animation_settings.h" |
23 #include "ui/gfx/transform_util.h" | 23 #include "ui/gfx/transform_util.h" |
24 #include "ui/views/widget/widget.h" | 24 #include "ui/views/widget/widget.h" |
25 | 25 |
26 namespace ash { | 26 namespace ash { |
27 namespace internal { | 27 namespace internal { |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 ui::ScopedLayerAnimationSettings animation(layer->GetAnimator()); | 195 ui::ScopedLayerAnimationSettings animation(layer->GetAnimator()); |
196 animation.SetTransitionDuration( | 196 animation.SetTransitionDuration( |
197 base::TimeDelta::FromMilliseconds(kAnimationDurationMs)); | 197 base::TimeDelta::FromMilliseconds(kAnimationDurationMs)); |
198 animation.AddObserver(this); | 198 animation.AddObserver(this); |
199 | 199 |
200 layer->SetOpacity(is_visible_ ? 1.0 : 0.0); | 200 layer->SetOpacity(is_visible_ ? 1.0 : 0.0); |
201 layer->SetBounds(target_bounds); | 201 layer->SetBounds(target_bounds); |
202 } | 202 } |
203 | 203 |
204 void AppListController::ProcessLocatedEvent(aura::Window* target, | 204 void AppListController::ProcessLocatedEvent(aura::Window* target, |
205 const aura::LocatedEvent& event) { | 205 const ui::LocatedEvent& event) { |
206 // If the event happened on a menu, then the event should not close the app | 206 // If the event happened on a menu, then the event should not close the app |
207 // list. | 207 // list. |
208 if (target) { | 208 if (target) { |
209 RootWindowController* root_controller = | 209 RootWindowController* root_controller = |
210 GetRootWindowController(target->GetRootWindow()); | 210 GetRootWindowController(target->GetRootWindow()); |
211 if (root_controller) { | 211 if (root_controller) { |
212 aura::Window* menu_container = root_controller->GetContainer( | 212 aura::Window* menu_container = root_controller->GetContainer( |
213 ash::internal::kShellWindowId_MenuContainer); | 213 ash::internal::kShellWindowId_MenuContainer); |
214 if (menu_container->Contains(target)) | 214 if (menu_container->Contains(target)) |
215 return; | 215 return; |
(...skipping 11 matching lines...) Expand all Loading... |
227 | 227 |
228 void AppListController::UpdateBounds() { | 228 void AppListController::UpdateBounds() { |
229 if (view_ && is_visible_) | 229 if (view_ && is_visible_) |
230 view_->UpdateBounds(); | 230 view_->UpdateBounds(); |
231 } | 231 } |
232 | 232 |
233 //////////////////////////////////////////////////////////////////////////////// | 233 //////////////////////////////////////////////////////////////////////////////// |
234 // AppListController, aura::EventFilter implementation: | 234 // AppListController, aura::EventFilter implementation: |
235 | 235 |
236 bool AppListController::PreHandleKeyEvent(aura::Window* target, | 236 bool AppListController::PreHandleKeyEvent(aura::Window* target, |
237 aura::KeyEvent* event) { | 237 ui::KeyEvent* event) { |
238 return false; | 238 return false; |
239 } | 239 } |
240 | 240 |
241 bool AppListController::PreHandleMouseEvent(aura::Window* target, | 241 bool AppListController::PreHandleMouseEvent(aura::Window* target, |
242 aura::MouseEvent* event) { | 242 ui::MouseEvent* event) { |
243 if (event->type() == ui::ET_MOUSE_PRESSED) | 243 if (event->type() == ui::ET_MOUSE_PRESSED) |
244 ProcessLocatedEvent(target, *event); | 244 ProcessLocatedEvent(target, *event); |
245 return false; | 245 return false; |
246 } | 246 } |
247 | 247 |
248 ui::TouchStatus AppListController::PreHandleTouchEvent( | 248 ui::TouchStatus AppListController::PreHandleTouchEvent( |
249 aura::Window* target, | 249 aura::Window* target, |
250 aura::TouchEvent* event) { | 250 ui::TouchEventImpl* event) { |
251 return ui::TOUCH_STATUS_UNKNOWN; | 251 return ui::TOUCH_STATUS_UNKNOWN; |
252 } | 252 } |
253 | 253 |
254 ui::GestureStatus AppListController::PreHandleGestureEvent( | 254 ui::GestureStatus AppListController::PreHandleGestureEvent( |
255 aura::Window* target, | 255 aura::Window* target, |
256 aura::GestureEvent* event) { | 256 ui::GestureEventImpl* event) { |
257 if (event->type() == ui::ET_GESTURE_TAP) | 257 if (event->type() == ui::ET_GESTURE_TAP) |
258 ProcessLocatedEvent(target, *event); | 258 ProcessLocatedEvent(target, *event); |
259 return ui::GESTURE_STATUS_UNKNOWN; | 259 return ui::GESTURE_STATUS_UNKNOWN; |
260 } | 260 } |
261 | 261 |
262 //////////////////////////////////////////////////////////////////////////////// | 262 //////////////////////////////////////////////////////////////////////////////// |
263 // AppListController, aura::FocusObserver implementation: | 263 // AppListController, aura::FocusObserver implementation: |
264 void AppListController::OnWindowFocused(aura::Window* window) { | 264 void AppListController::OnWindowFocused(aura::Window* window) { |
265 if (view_ && is_visible_) { | 265 if (view_ && is_visible_) { |
266 aura::Window* applist_container = Shell::GetContainer( | 266 aura::Window* applist_container = Shell::GetContainer( |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 | 307 |
308 //////////////////////////////////////////////////////////////////////////////// | 308 //////////////////////////////////////////////////////////////////////////////// |
309 // AppListController, LauncherIconObserver implementation: | 309 // AppListController, LauncherIconObserver implementation: |
310 | 310 |
311 void AppListController::OnLauncherIconPositionsChanged() { | 311 void AppListController::OnLauncherIconPositionsChanged() { |
312 UpdateBounds(); | 312 UpdateBounds(); |
313 } | 313 } |
314 | 314 |
315 } // namespace internal | 315 } // namespace internal |
316 } // namespace ash | 316 } // namespace ash |
OLD | NEW |