| 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/root_window_controller.h" |
| 8 #include "ash/session/session_state_delegate.h" | 8 #include "ash/session/session_state_delegate.h" |
| 9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
| 10 #include "ash/shelf/shelf_types.h" | 10 #include "ash/shelf/shelf_types.h" |
| 11 #include "ash/shelf/shelf_widget.h" | 11 #include "ash/shelf/shelf_widget.h" |
| 12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 13 #include "ash/system/status_area_widget.h" | 13 #include "ash/system/status_area_widget.h" |
| 14 #include "ash/wm/gestures/tray_gesture_handler.h" | |
| 15 #include "ash/wm/window_state.h" | 14 #include "ash/wm/window_state.h" |
| 16 #include "ash/wm/window_util.h" | 15 #include "ash/wm/window_util.h" |
| 17 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 18 #include "ui/compositor/layer.h" | 17 #include "ui/compositor/layer.h" |
| 19 #include "ui/compositor/scoped_layer_animation_settings.h" | 18 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 20 #include "ui/gfx/transform.h" | 19 #include "ui/gfx/transform.h" |
| 21 #include "ui/views/widget/widget.h" | 20 #include "ui/views/widget/widget.h" |
| 22 | 21 |
| 23 namespace ash { | 22 namespace ash { |
| 24 | 23 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN) { | 55 if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN) { |
| 57 drag_in_progress_ = true; | 56 drag_in_progress_ = true; |
| 58 shelf->StartGestureDrag(event); | 57 shelf->StartGestureDrag(event); |
| 59 return true; | 58 return true; |
| 60 } | 59 } |
| 61 | 60 |
| 62 if (!drag_in_progress_) | 61 if (!drag_in_progress_) |
| 63 return false; | 62 return false; |
| 64 | 63 |
| 65 if (event.type() == ui::ET_GESTURE_SCROLL_UPDATE) { | 64 if (event.type() == ui::ET_GESTURE_SCROLL_UPDATE) { |
| 66 if (tray_handler_) { | 65 shelf->UpdateGestureDrag(event); |
| 67 if (!tray_handler_->UpdateGestureDrag(event)) | |
| 68 tray_handler_.reset(); | |
| 69 } else if (shelf->UpdateGestureDrag(event) == | |
| 70 ShelfLayoutManager::DRAG_TRAY) { | |
| 71 tray_handler_.reset(new TrayGestureHandler()); | |
| 72 } | |
| 73 | |
| 74 return true; | 66 return true; |
| 75 } | 67 } |
| 76 | 68 |
| 77 drag_in_progress_ = false; | 69 drag_in_progress_ = false; |
| 78 | 70 |
| 79 if (event.type() == ui::ET_GESTURE_SCROLL_END || | 71 if (event.type() == ui::ET_GESTURE_SCROLL_END || |
| 80 event.type() == ui::ET_SCROLL_FLING_START) { | 72 event.type() == ui::ET_SCROLL_FLING_START) { |
| 81 if (tray_handler_) { | |
| 82 tray_handler_->CompleteGestureDrag(event); | |
| 83 tray_handler_.reset(); | |
| 84 } | |
| 85 | |
| 86 shelf->CompleteGestureDrag(event); | 73 shelf->CompleteGestureDrag(event); |
| 87 return true; | 74 return true; |
| 88 } | 75 } |
| 89 | 76 |
| 90 // Unexpected event. Reset the state and let the event fall through. | 77 // Unexpected event. Reset the state and let the event fall through. |
| 91 shelf->CancelGestureDrag(); | 78 shelf->CancelGestureDrag(); |
| 92 return false; | 79 return false; |
| 93 } | 80 } |
| 94 | 81 |
| 95 } // namespace ash | 82 } // namespace ash |
| OLD | NEW |