| 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/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
| 10 #include "ash/shelf/shelf.h" | 10 #include "ash/shelf/shelf.h" |
| 11 #include "ash/shelf/shelf_layout_manager.h" | 11 #include "ash/shelf/shelf_layout_manager.h" |
| 12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 13 #include "ash/shell_delegate.h" | 13 #include "ash/shell_delegate.h" |
| 14 #include "ash/shell_window_ids.h" | 14 #include "ash/shell_window_ids.h" |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "ui/app_list/app_list_constants.h" | 16 #include "ui/app_list/app_list_constants.h" |
| 17 #include "ui/app_list/app_list_switches.h" | 17 #include "ui/app_list/app_list_switches.h" |
| 18 #include "ui/app_list/pagination_model.h" | 18 #include "ui/app_list/pagination_model.h" |
| 19 #include "ui/app_list/views/app_list_view.h" | 19 #include "ui/app_list/views/app_list_view.h" |
| 20 #include "ui/aura/client/focus_client.h" | 20 #include "ui/aura/client/focus_client.h" |
| 21 #include "ui/aura/window.h" | 21 #include "ui/aura/window.h" |
| 22 #include "ui/aura/window_event_dispatcher.h" | 22 #include "ui/aura/window_event_dispatcher.h" |
| 23 #include "ui/compositor/layer.h" | 23 #include "ui/compositor/layer.h" |
| 24 #include "ui/compositor/scoped_layer_animation_settings.h" | 24 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 25 #include "ui/events/event.h" | 25 #include "ui/events/event.h" |
| 26 #include "ui/gfx/transform_util.h" | 26 #include "ui/gfx/transform_util.h" |
| 27 #include "ui/views/widget/widget.h" | 27 #include "ui/views/widget/widget.h" |
| 28 | 28 |
| 29 namespace ash { | 29 namespace ash { |
| 30 namespace internal { | |
| 31 | |
| 32 namespace { | 30 namespace { |
| 33 | 31 |
| 34 // Duration for show/hide animation in milliseconds. | 32 // Duration for show/hide animation in milliseconds. |
| 35 const int kAnimationDurationMs = 200; | 33 const int kAnimationDurationMs = 200; |
| 36 | 34 |
| 37 // Offset in pixels to animation away/towards the shelf. | 35 // Offset in pixels to animation away/towards the shelf. |
| 38 const int kAnimationOffset = 8; | 36 const int kAnimationOffset = 8; |
| 39 | 37 |
| 40 // The maximum shift in pixels when over-scroll happens. | 38 // The maximum shift in pixels when over-scroll happens. |
| 41 const int kMaxOverScrollShift = 48; | 39 const int kMaxOverScrollShift = 48; |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 if (!view_ || !is_visible_) | 286 if (!view_ || !is_visible_) |
| 289 return; | 287 return; |
| 290 | 288 |
| 291 // If the event happened on a menu, then the event should not close the app | 289 // If the event happened on a menu, then the event should not close the app |
| 292 // list. | 290 // list. |
| 293 aura::Window* target = static_cast<aura::Window*>(event->target()); | 291 aura::Window* target = static_cast<aura::Window*>(event->target()); |
| 294 if (target) { | 292 if (target) { |
| 295 RootWindowController* root_controller = | 293 RootWindowController* root_controller = |
| 296 GetRootWindowController(target->GetRootWindow()); | 294 GetRootWindowController(target->GetRootWindow()); |
| 297 if (root_controller) { | 295 if (root_controller) { |
| 298 aura::Window* menu_container = root_controller->GetContainer( | 296 aura::Window* menu_container = |
| 299 internal::kShellWindowId_MenuContainer); | 297 root_controller->GetContainer(kShellWindowId_MenuContainer); |
| 300 if (menu_container->Contains(target)) | 298 if (menu_container->Contains(target)) |
| 301 return; | 299 return; |
| 302 aura::Window* keyboard_container = root_controller->GetContainer( | 300 aura::Window* keyboard_container = root_controller->GetContainer( |
| 303 internal::kShellWindowId_VirtualKeyboardContainer); | 301 kShellWindowId_VirtualKeyboardContainer); |
| 304 if (keyboard_container->Contains(target)) | 302 if (keyboard_container->Contains(target)) |
| 305 return; | 303 return; |
| 306 } | 304 } |
| 307 } | 305 } |
| 308 | 306 |
| 309 aura::Window* window = view_->GetWidget()->GetNativeView(); | 307 aura::Window* window = view_->GetWidget()->GetNativeView(); |
| 310 if (!window->Contains(target)) | 308 if (!window->Contains(target)) |
| 311 SetVisible(false, window); | 309 SetVisible(false, window); |
| 312 } | 310 } |
| 313 | 311 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 should_snap_back_ = true; | 428 should_snap_back_ = true; |
| 431 } else if (should_snap_back_) { | 429 } else if (should_snap_back_) { |
| 432 should_snap_back_ = false; | 430 should_snap_back_ = false; |
| 433 ui::ScopedLayerAnimationSettings animation(widget_animator); | 431 ui::ScopedLayerAnimationSettings animation(widget_animator); |
| 434 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( | 432 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( |
| 435 app_list::kOverscrollPageTransitionDurationMs)); | 433 app_list::kOverscrollPageTransitionDurationMs)); |
| 436 widget->SetBounds(view_bounds_); | 434 widget->SetBounds(view_bounds_); |
| 437 } | 435 } |
| 438 } | 436 } |
| 439 | 437 |
| 440 } // namespace internal | |
| 441 } // namespace ash | 438 } // namespace ash |
| OLD | NEW |