| 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/gestures/shelf_gesture_handler.h" | 5 #include "ash/wm/gestures/shelf_gesture_handler.h" |
| 6 | 6 |
| 7 #include "ash/root_window_controller.h" |
| 7 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 8 #include "ash/shell_delegate.h" | 9 #include "ash/shell_delegate.h" |
| 9 #include "ash/system/status_area_widget.h" | 10 #include "ash/system/status_area_widget.h" |
| 10 #include "ash/wm/gestures/tray_gesture_handler.h" | 11 #include "ash/wm/gestures/tray_gesture_handler.h" |
| 11 #include "ash/wm/shelf_layout_manager.h" | 12 #include "ash/wm/shelf_layout_manager.h" |
| 12 #include "ash/wm/shelf_types.h" | 13 #include "ash/wm/shelf_types.h" |
| 13 #include "ash/wm/window_util.h" | 14 #include "ash/wm/window_util.h" |
| 14 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
| 15 #include "ui/compositor/layer.h" | 16 #include "ui/compositor/layer.h" |
| 16 #include "ui/compositor/scoped_layer_animation_settings.h" | 17 #include "ui/compositor/scoped_layer_animation_settings.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 33 shell->delegate()->IsScreenLocked()) { | 34 shell->delegate()->IsScreenLocked()) { |
| 34 // The gestures are disabled in the lock/login screen. | 35 // The gestures are disabled in the lock/login screen. |
| 35 return false; | 36 return false; |
| 36 } | 37 } |
| 37 | 38 |
| 38 // The gesture are disabled for fullscreen windows. | 39 // The gesture are disabled for fullscreen windows. |
| 39 aura::Window* active = wm::GetActiveWindow(); | 40 aura::Window* active = wm::GetActiveWindow(); |
| 40 if (active && wm::IsWindowFullscreen(active)) | 41 if (active && wm::IsWindowFullscreen(active)) |
| 41 return false; | 42 return false; |
| 42 | 43 |
| 43 ShelfLayoutManager* shelf = shell->shelf(); | 44 // TODO(oshima): Find the root window controller from event's location. |
| 45 ShelfLayoutManager* shelf = Shell::GetPrimaryRootWindowController()->shelf(); |
| 44 if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN) { | 46 if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN) { |
| 45 drag_in_progress_ = true; | 47 drag_in_progress_ = true; |
| 46 shelf->StartGestureDrag(event); | 48 shelf->StartGestureDrag(event); |
| 47 return true; | 49 return true; |
| 48 } | 50 } |
| 49 | 51 |
| 50 if (!drag_in_progress_) | 52 if (!drag_in_progress_) |
| 51 return false; | 53 return false; |
| 52 | 54 |
| 53 if (event.type() == ui::ET_GESTURE_SCROLL_UPDATE) { | 55 if (event.type() == ui::ET_GESTURE_SCROLL_UPDATE) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 75 return true; | 77 return true; |
| 76 } | 78 } |
| 77 | 79 |
| 78 // Unexpected event. Reset the state and let the event fall through. | 80 // Unexpected event. Reset the state and let the event fall through. |
| 79 shelf->CancelGestureDrag(); | 81 shelf->CancelGestureDrag(); |
| 80 return false; | 82 return false; |
| 81 } | 83 } |
| 82 | 84 |
| 83 } // namespace internal | 85 } // namespace internal |
| 84 } // namespace ash | 86 } // namespace ash |
| OLD | NEW |